带有Spring MVC的Apache CXF客户端-BindingInfo不是SOAPBindingInfo [英] Apache CXF client with Spring MVC - BindingInfo is not SOAPBindingInfo

查看:288
本文介绍了带有Spring MVC的Apache CXF客户端-BindingInfo不是SOAPBindingInfo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Spring MVC项目,我需要从该项目访问Web服务(客户端模式)

I am working on a spring MVC project, from which I need to access a webservice(client mode)

我的Web服务客户端是一个不同的Maven项目,从其JUnit测试用例中可以正常工作。

My web service client is a different maven project which is working fine from its JUnit test cases.

当我将其添加为Spring MVC项目的依赖项并访问jar文件时,出现以下异常。

When i add this as a dependency to my Spring MVC project and access the jar file, I am getting the following exception.

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总线在运行。

I just found that my mvc project has a cxf bus running in it already.

    <cxf:bus>
    <cxf:features>
        <cxf:logging />
    </cxf:features>
</cxf:bus>

我找不到任何其他配置,但我认为某些REST服务拦截器正在参与我的SOAP服务客户或类似的其他冲突。任何想法吗?

I could not find any additional configuration but i think some REST service interceptors are taking part in my SOAP service client or some other conflict like this. Any Idea ?

推荐答案

我将代码从以编程方式创建Web服务的方式更改为使用spring:

I changed my code from programmatically creating web service to use spring like:

 <jaxws:client id="helloClient"
                  serviceClass="demo.spring.HelloWorld"
                  address="http://localhost:9002/HelloWorld" />

,它也开始在集成项目中工作。但是我还不明白原因。如果有人可以告诉我原因,将很有帮助。

and it started working in integrated project also. However I did not understand the reason yet. It would be helpful if anybody can show me the reason.

谢谢。

这篇关于带有Spring MVC的Apache CXF客户端-BindingInfo不是SOAPBindingInfo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆