3 Replies Latest reply: Oct 23, 2012 11:13 AM by 965123 RSS

    Newbie: can I use JAX WS here?

    970180
      hello,
      I am new to web services and I am trying to use JAX WS to access a Web Service. I do have the wsdl locally, and I have generated the corresponding java-classes using wsimport.
      However, when I see the generated classes, the action of the WebMethod does not match the actual URL where the services are (the services are located at https://services.acme.com/some/other/path)

      @WebMethod(operationName = "SearchRQ", action = "http://www.acme.com/schema/services/qo/search:SearchRQIn")
      @WebResult(name = "SearchRS", targetNamespace = "http://www.foo.org/bar/2003", partName = "messagePart")
      public SearchRS mySearchRQ(@WebParam(name = "SearchRQ", targetNamespace = "http://www.foo.org/bar/2003", partName = "messagePart") SearchRQ messagePart);

      so when I try to access the services through the code below, I get a HTTP 404

      SearchServicePort servicePort = new SearchServicePort();
      SearchServiceInterface port = servicePort.getSearchServicePort();
      SearchRQ rq = new SearchRQ();
      SearchRS rs = port.mySearchRQ(rq);

      I do realize that the action differs from where the services are located and that probably is the reason, but I do not understand why the wsdl points me to the wrong place. Is this a service that is not compatible with JAX WS? How can I tell?

      the WSDL header looks like this

      <definitions xmlns:tns="http://www.acme.com/schema/services/qo/search" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:import0="http://www.foo.org/bar/2003" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SearchService" targetNamespace="http://www.acme.com/schema/services/qo/search" xmlns="http://schemas.xmlsoap.org/wsdl/">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">This service provides search</wsdl:documentation>
        • 1. Re: Newbie: can I use JAX WS here?
          jtahlborn
          what is in the "address" attribute of the "location" element of the wsdl?
          • 2. Re: Newbie: can I use JAX WS here?
            970180
            <service name="SearchServicePort">
            <port name="SearchServicePort" binding="tns:SearchService">
            <soap:address location="https://www.acme.com/some/other/path" />
            </port>
            </service>

            aha, the address part is almost correct. It contains a 'www' instead of 'services', but the remaining part is correct. When replacing the 'www' with the 'services' in the wsdl, I do not get any 404 anymore, instead I get the below. Seems like I am getting an answer, right?

            Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Internal Error (from client)
                 at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
                 at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
                 at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
                 at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
                 at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
            • 3. Re: Newbie: can I use JAX WS here?
              965123
              May be you should post here the code of SyncMethodHandler.java and SEIStub.java without edits (so that line numbers reported in exception trace can correctly be linked to lines in code).