0
votes

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

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

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)

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>

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 ?

1

1 Answers

0
votes

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.

Thanks.