2 bamboojohn bamboojohn 于 2016.05.04 16: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我也没设置,不知道哪里可以修改设置

3个回答

bamboojohn
bamboojohn   2016.05.04 16:24

目前格式为:发布服务后,请求的soap报文格式为

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


bamboojohn
bamboojohn   2016.05.04 16:26
CSDNXIAON
CSDNXIAON   2016.05.04 16:32

JAVA webservice之CXF
CXF 之 Java WebService
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!