2012-07-10 59 views
0

我工作的一個春天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服務客戶端或其他類似的衝突。任何想法 ?

回答

0

我從編程方式創建Web服務使用類似彈簧的改變了我的代碼:

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

,並開始在綜合項目工作也。但是我還不明白原因。如果有人能告訴我理由,這將是有益的。

謝謝。