的Apache CXF客户端与Spring MVC - BindingInfo不SOAPBindingInfo
问题描述:
我工作的一个春天MVC项目,从中我需要访问一个Web服务(客户端模式)的Apache CXF客户端与Spring MVC - BindingInfo不SOAPBindingInfo
我的Web服务客户端是一个不同的Maven项目是从其JUnit测试用例中运行良好。
当我将此作为依赖添加到我的Spring MVC项目并访问该jar文件时,出现以下异常。
Jul 10, 2012 2:40:09 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [rest] in context with path [/mdot] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: Can not initialize SoapBinding, BindingInfo is not SoapBindingInfo] with root cause
java.lang.RuntimeException: Can not initialize SoapBinding, BindingInfo is not SoapBindingInfo
at org.apache.cxf.binding.soap.SoapBindingFactory.createBinding(SoapBindingFactory.java:385)
at org.apache.cxf.endpoint.EndpointImpl.createBinding(EndpointImpl.java:135)
at org.apache.cxf.endpoint.EndpointImpl.<init>(EndpointImpl.java:82)
at org.apache.cxf.jaxws.support.JaxWsEndpointImpl.<init>(JaxWsEndpointImpl.java:125)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.createEndpoint(JaxWsServiceFactoryBean.java:235)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createEndpoints(ReflectionServiceFactoryBean.java:328)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:260)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:153)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:151)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318)
at javax.xml.ws.Service.getPort(Service.java:119)
at com.test.wsdl.MyWebServiceSOAP_Service.getMyWebServiceSOAPPort(MyWebServiceSOAP_Service.java:63)
我刚刚发现我的mvc项目已经有了一个cxf总线。
<cxf:bus>
<cxf:features>
<cxf:logging />
</cxf:features>
</cxf:bus>
我找不到任何额外的配置,但我认为一些REST服务拦截器正在参与我的SOAP服务客户端或其他类似的冲突。任何想法 ?
答
我从编程方式创建Web服务使用类似弹簧的改变了我的代码:
<jaxws:client id="helloClient"
serviceClass="demo.spring.HelloWorld"
address="http://localhost:9002/HelloWorld" />
,并开始在综合项目工作也。但是我还不明白原因。如果有人能告诉我理由,这将是有益的。
谢谢。