0

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

我的 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 服务客户端或其他类似的冲突。任何的想法 ?

4

1 回答 1

0

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

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

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

谢谢。

于 2012-07-11T11:45:14.750 回答