Webservice having "No such operation: HTTP GET PATH_INFO"

13,047

Typically, SOAP services are exposed over HTTP using the POST operation. You seem to be trying to access the service using the GET operation.

I am not sure how you try to invoke the service in your unit test, but you need to make sure it's a HTTP/POST call. If you are using plain HTTP, then you could set a header before invoking the HTTP component.

 .setHeader(Exchange.HTTP_METHOD, constant("POST"))

Show your unit test for more detailed input.

Share:
13,047
parchambeau
Author by

parchambeau

Founding Partner at Angle Capital, Crypto/Angel investor, previously Engineering @CoinDesk Founder and CTO @Lawnmower (acquired)

Updated on June 30, 2022

Comments

  • parchambeau
    parchambeau almost 2 years

    I currently have a SOAP web service and I am trying to access it's endpoint but I keep getting this error:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <soap:Fault>
          <faultcode>soap:Server</faultcode>
            <faultstring>
     No such operation: (HTTP GET PATH_INFO: /camel-example-reportincident/webservices/incident)
            </faultstring>
           </soap:Fault>
        </soap:Body>
     </soap:Envelope>
    

    UNIT TEST

    package org.apache.camel.example.reportincident;
    
    import junit.framework.TestCase;
    
    import org.apache.camel.CamelContext;
    import org.apache.camel.impl.DefaultCamelContext;
    import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
    import org.jvnet.mock_javamail.Mailbox;
    
    /**
     * Unit test of our routes
     */
    public class ReportIncidentRoutesTest extends TestCase {
    
    private CamelContext camel;
    
    // should be the same address as we have in our route
    private static String ADDRESS = "cxf://http://localhost:8080/camel-example-reportincident/webservices/incident"
                + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                + "&wsdlURL=report_incident.wsdl";
    
    protected void startCamel() throws Exception {
        camel = new DefaultCamelContext();
        camel.addRoutes(new ReportIncidentRoutes());
        camel.start();
    }
    
    protected static ReportIncidentEndpoint createCXFClient() {
        // we use CXF to create a client for us as its easier than JAXWS and works
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(ReportIncidentEndpoint.class);
        factory.setAddress(ADDRESS);
        return (ReportIncidentEndpoint) factory.create();
    }
    
    public void testRendportIncident() throws Exception {
        // start camel
        startCamel();
    
        // assert mailbox is empty before starting
        Mailbox inbox = Mailbox.get("[email protected]");
        assertEquals("Should not have mails", 0, inbox.size());
    
        // create input parameter
        InputReportIncident input = new InputReportIncident();
        input.setIncidentId("123");
        input.setIncidentDate("2008-08-18");
        input.setGivenName("Claus");
        input.setFamilyName("Ibsen");
        input.setSummary("Bla");
        input.setDetails("Bla bla");
        input.setEmail("[email protected]");
        input.setPhone("0045 2962 7576");
    
        // create the webservice client and send the request
        ReportIncidentEndpoint client = createCXFClient();
        OutputReportIncident out = client.reportIncident(input);
    
        // assert we got a OK back
        assertEquals("0", out.getCode());
    
        // let some time pass to allow Camel to pickup the file and send it as an email
        Thread.sleep(3000);
        // assert mail box
        assertEquals("Should have got 1 mail", 1, inbox.size());
    
        // stop camel
        camel.stop();
    }
    

    }

    I am attempting to use CFX endpoint along with my camel routing and when I am putting the endpoint address in the route and then unit testing it I am getting a "No endpoint could be found for: //path/to/endpoint".

    I am assuming that the fact that I am getting an error when I try to access the endpoint url is the issue but I do not even know where to begin on figuring out how to fix it.

    When I hit my webservice on SOAP UI it runs fine as well. Any help would be greatly appreciated, and I can provide any info that is needed.

  • parchambeau
    parchambeau over 11 years
    Alright, I edited the original and added in the unit test. Thanks for your help!
  • Reddymails
    Reddymails over 10 years
    I had the same issue and noticed that if we dont append "?wsdl" to the end of url I was getting soap fault. So basically url like this works localhost:9081/TST/TSTWebServiceImpl?wsdl But the below url will throw soap fault exception since the ?wsdl is missing at the end of url. localhost:9081/TST/TSTWebServiceImpl This was for a JAX-WS webservice.
  • Petter Nordlander
    Petter Nordlander over 10 years
    @Reddymails ?wsdl is there to retrieve the WSDL definition from the web service. It's not to be confused with the actual service.
  • grep
    grep about 10 years
    I have the same problem. when I don't append "?wsdl" I have soap faylt. how can I avoid this exception?
  • dlamotte
    dlamotte over 9 years
    Had this same problem, found this from google and discovered that my http client was following a redirect that lead to the client using a GET request at the new location. Had to convince the client to continue to use a POST request and it works fine now.
  • Petter Nordlander
    Petter Nordlander over 9 years
    @dlamotte POST and redirects are complicated as the specs require you to prompt the user before a new POST is made to the redirect location.