Home:ALL Converter>Get SOAP response from soap object in webservices

Get SOAP response from soap object in webservices

Ask Time:2013-01-07T14:58:03         Author:Patan

Json Formatter

I have the soap address location in my wsdl is as "<soap:address location="http://localhost:8080/rpc/soap/helloworldsoap"/>"

In my web service method I have the following path.

@HttpResource(location="/{name}")

I want to get the SOAP response object.

I tried the following url.

http://localhost:8080/rpc/soap/helloworldsoap/abcd

WSDL

<?xml version='1.0' encoding='UTF-8'?>

<wsdl:definitions name="HelloWorldImplService" targetNamespace="some name space" xmlns:ns1="http://test.com/webservices" xmlns:ns2="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="some name space" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:import location="http://localhost:8080/rpc/soap/helloworldsoap?wsdl=HelloWorld.wsdl" namespace="http://test.com/webservices">
    </wsdl:import>
  <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:HelloWorld">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="getHelloWorldAsString">
      <soap:operation soapAction="" style="rpc" />
      <wsdl:input name="getHelloWorldAsString">
        <soap:body namespace="http://test.com/webservices" use="literal" />
      </wsdl:input>
      <wsdl:output name="getHelloWorldAsStringResponse">
        <soap:body namespace="http://test.com/webservices" use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="HelloWorldImplService">
    <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
      <soap:address location="http://localhost:8080/rpc/soap/helloworldsoap" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

SOAP:

    <soap:Envelope>
       <soap:Body>
        <soap:Fault>
       <faultcode>soap:Server</faultcode>
      <faultstring>No such operation:  (HTTP GET PATH_INFO: /soap/helloworldsoap)     
      </faultstring>
    </soap:Fault>
  </soap:Body>
  </soap:Envelope>

But I am not getting the response object.

Can any one tell me how to achieve this.

Thanks in Advance.

Author:Patan,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/14191286/get-soap-response-from-soap-object-in-webservices
Vinay Veluri :

I'm in confusion whether we can use the Resource location for SOAP. For REST, it holds good,\nand also from your error, it gives error on server side(your input holds good)that too about location. \n\nTry some thing like this...\n\nRemove Resource location, use @WebMethod.\n\nPost your Interface definition and also SOAP input.\n\nExample :\n\nInterface:\n\n@WebService\npublic interface Service {\n\npublic Address validate(Address address);\n\n@WebMethod\npublic String sayHi(\n @WebParam(mode = WebParam.Mode.IN)\n String msg);\n}\n\n\nImplementation:\n\npackage com.example;\n\n\nimport javax.jws.WebService;\n\n@WebService(endpointInterface = \"com.example.AddressService\" )\npublic class AddressServiceImpl implements AddressService {\n\n@Override\npublic Address validateAdress(Address address) {\n return address;\n }\n\n @Override\n public String sayHi(String msg) {\n return \"Vinay\";\n }\n}\n\n\nHope the example helps",
2013-01-07T07:32:25
yy