开发了一个web service服务,客户居然不认,查看客户发过来的请求,其soap header是
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope">
但我们给回的响应soap header是
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
查了一下资料,发现客户发过来的是soap1.1的header,我们的响应却是soap1.2的header,所以怀疑是不是这里出了问题
由于我们的服务端是根据wsdl证书反向生成的,所以就先查了一下原始wsdl
<wsdl:service name="inbound.webServices.ticket.saService">
<wsdl:port name="inbound.webServices.ticket.saServiceSoap" binding="tns:inbound.webServices.ticket.saServiceSoap">
<soap:address location="http://localhost:49169/saService.asmx" />
</wsdl:port>
<wsdl:port name="inbound.webServices.ticket.saServiceSoap12" binding="tns:inbound.webServices.ticket.saServiceSoap12">
<soap12:address location="http://localhost:49169/saService.asmx" />
</wsdl:port>
</wsdl:service>
可以看到,wsdl同时声明了soap11和soap12,上网查了一下,在cxf的配置文件里增加了以下的配置
<jaxws:endpoint id="sp" implementor="xxx" address="/WebServiceSP">
<jaxws:binding>
<soap:soapBinding version="1.1" />
</jaxws:binding>
</jaxws:endpoint>
重启应用以后,发现没有生效,不知道是为什么
于是又检查了web service实现类的代码,发现类开头的注解是这么写的:
@WebService(serviceName = "xxx", portName = "inbound.webServices.ticket.saServiceSoap12", targetNamespace = "xxx", wsdlLocation = "xxx/saService.wsdl", endpointInterface = "xxx")
看来看去,觉得就是portName最为可疑,把这里改成:
@WebService(serviceName = "xxx", portName = "inbound.webServices.ticket.saServiceSoap", targetNamespace = "xxx", wsdlLocation = "xxx/saService.wsdl", endpointInterface = "xxx")
再重启应用就OK了
分享到:
相关推荐
<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"/>
用于使用CXF打印SOAP报文,记录WebService日志~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
该项目集成 webservice cxf eclipse endpoint 导入eclipse直接可以运行
Soap1.1和soap1.2区别: 跟踪soap协议 综合案例: 使用webservice传输xml数据(重点掌握) 第二天: Jaxws的深入开发: 常用注解 测试jaxws传输复杂对象类型 CXF开发webservice: CXF入门程序 Spring+...
NULL 博文链接:https://huiseyiyu.iteye.com/blog/1172161
cxf生成客户端 服务端代码
CXF整合spring实现SOAP接口开发
cxf soap header cxf soap header cxf soap header cxf soap header
赠送jar包:cxf-rt-bindings-soap-3.0.1.jar; 赠送原API文档:cxf-rt-bindings-soap-3.0.1-javadoc.jar; 赠送源代码:cxf-rt-bindings-...人性化翻译,文档中的代码和结构保持不变,注释和说明精准翻译,请放心使用。
cxf生成webservice客户端代码
支持java端 生成soap-ui的自定义报文,功能和soap-ui软件相似
结合网上的例子,在本地搭建并且跑通了的基于CXF的例子,soap webservice 和 restful webservice的混搭模式. 依赖cxf 3.0.4 测试工具SOAPUI 5.0 服务器 tomcat 7 浏览器 chrome
弹簧-CXF-WS 一些使用spring和cxf生成webservice Rest和Soap的例子
spring + cxf + restful + soap 方便初学者很快上手。 注解描述 @Path注解的值是一个相对的URI路径,这个路径指定了该Java类的位置,例如/helloworld。在这个URI中可以包含变量,例如可以获取用户的姓名然后作为参数...
CXF Spring开发WebService,基于SOAP方式,所需jar包。 经过测试的,绝对可以使用
使用cxf生成webservice,包括客户端和服务器端,非常好用
cxf 生成java代码的执行命令
使用cxf生成onvif协议的客户端。使用onvif协议提供的wsdl文件生成客户端。
cxf生成webservice客户端
CXF SOAP 应用实例