bamboojohn
bamboojohn
2016-05-04 08:20

java cxf webservice整合问题

jws代码:
@Service("iom4crm")
@WebService(targetNamespace = "http://service.iom.test.com/", serviceName="IOM4CRM")
public class Iom4Crm implements IIom4Crm{
@Override
@WebMethod(operationName = "exchange")
public String exchange(@WebParam(targetNamespace = "http://service.iom.test.com/")String data) {
}
}

cxf配置:
<?xml version="1.0" encoding="UTF-8"?>

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />    
 <!-- 测试-->
<jaxws:endpoint id="IOM4CRM" implementor="#iom4crm"
  address="/IOM4CRM">
  <jaxws:features>
      <bean class="org.apache.cxf.feature.LoggingFeature" />
  </jaxws:features>
</jaxws:endpoint>
    </beans>

    问题:
    服务能正常发布,也能调用,但是生成的服务,请求格式soap报文为:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.iom.test.com/">

soapenv:Header/
soapenv:Body
ser:exchange
<!--Optional:-->
ser:arg0?/ser:arg0
/ser:exchange
/soapenv:Body

/soapenv:Envelope

现在想要请求的报文

soapenv:Header/
soapenv:Body
ns1:exchange
<!--Optional:-->
ns1:arg0?/ns1:arg0
/ns1:exchange
/soapenv:Body

/soapenv:Envelope

即命名空间前缀有ser修改为ns1,这个ser我也没设置,不知道哪里可以修改设置

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐