Response from Web service using Apache CXF shows “No binding operation info..”

后端 未结 5 1861
故里飘歌
故里飘歌 2021-02-07 10:46

The problem description might be long. Please be patient and provide any kind of help since I am new to the web services.

What I have done: I have creat

相关标签:
5条回答
  • 2021-02-07 11:14

    I had the same problem. Using cxf 2.6 2.7 This request by a web browser like chrome or firefox just didn't worked. I tried use a client did in cxf and it works! Your web services are working but you can't do a request by a web browser, you need a client since the cliente knows the requirements of the XML.

    0 讨论(0)
  • 2021-02-07 11:18

    In general, this exception usually occurs if the incoming soap method doesn't correctly match the WSDL. In such a case, the soap message could not be mapped to an appropriate method on the service. CXF just doesn't know what to do. Double check the incoming soap message.

    Source of the above explanation.

    Possible solution:

    @WebService(targetNamespace = "http://ws.service.com/",
            portName = "DeepThoughtPort",
            serviceName = "DeepThoughtService",
            endpointInterface = "your.pck.DeepThoughtService",
            wsdlLocation = "WEB-INF/wsdl/DeepThoughtService.wsdl")
    public class DeepThought {
    
        @WebMethod(action = "whatIsTheAnswer")
        public String whatIsTheAnswer(@WebParam(name = "arg0") String interviewer) {
            return ("The answer " + interviewer);
        }
    }
    

    What I would do is to add the WSDL location and endpointInterface in your @WebService. Also you are using Java-First approach so your method should be annotated with @WebMethod(action = "whatIsTheAnswer"). So if the method is not annotated CXF "understands" that your web service does not contain any methods at all and says: No binding operation info while invoking unknown method with params unknown.

    See also:

    • Developing a Service using JAX-WS
    0 讨论(0)
  • 2021-02-07 11:35

    Someone calls your SOAP WebService with GET request, but SOAP WebServices can not receive GET request. You should say to him/her don't call my SOAP WebService with GET request or call my web service with GET request like described here.

    0 讨论(0)
  • 2021-02-07 11:35

    Yes already answered you can't directly access the service in a browser url. You need a client code like this

    import org.apache.cxf.interceptor.LoggingInInterceptor;
    import org.apache.cxf.interceptor.LoggingOutInterceptor;
    import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
    import org.junit.Test;
    
    
    @Test
    public void testWhatIsTheAnswer() {
    
        JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();
    
        factoryBean.getInInterceptors().add(new LoggingInInterceptor());
        factoryBean.getOutInterceptors().add(new LoggingOutInterceptor());
        factoryBean.setServiceClass(DeepThought.class);
        factoryBean.setAddress("http://localhost:8084/DeepThoughtWS/services/DeepThoughtPort");
    
        DeepThought service = (DeepThought) factoryBean.create();
    
        service.whatIsTheAnswer("some answer");
    
    }
    
    0 讨论(0)
  • 2021-02-07 11:36

    You should query using wsdl(like adding ?wsdl)at the end of url to check your webservice implementation works. Browser cannot send any soap request as a soap client.

    0 讨论(0)
提交回复
热议问题