1 Reply Latest reply on Nov 23, 2010 9:28 AM by kyle.adams

    Cant parse Document/Literal WS Response

    kyle.adams

      It might be the case that i'm not doing correctly, but I cant seem to parse the document/literal response for the life of me. The response parses as expected when I build the web service as an RPC WSDL, but fails when I build as document/literal. The company standard is document/literal wrapped, so thats the one I need to use. Any help would be greatly appreciated!!

       

      Here is the WSDL contents and the javascript...

       

      WSDL:

      <wsdl:definitions targetNamespace="http://dao.test.crowley.com">
      
      <!--
      WSDL created by Apache Axis version: 1.4
      Built on Apr 22, 2006 (06:55:48 PDT)
      -->
      
      <wsdl:types>
      
      <schema elementFormDefault="qualified" targetNamespace="http://dao.test.crowley.com">
      
      <element name="getUserJSON">
      
      <complexType>
      
      <sequence>
      <element name="sql" type="xsd:string"/>
      </sequence>
      </complexType>
      </element>
      
      <element name="getUserJSONResponse">
      
      <complexType>
      
      <sequence>
      <element name="getUserJSONReturn" type="xsd:string"/>
      </sequence>
      </complexType>
      </element>
      </schema>
      </wsdl:types>
      
      <wsdl:message name="getUserJSONRequest">
      <wsdl:part element="impl:getUserJSON" name="parameters">
      
            </wsdl:part>
      </wsdl:message>
      
      <wsdl:message name="getUserJSONResponse">
      <wsdl:part element="impl:getUserJSONResponse" name="parameters">
      
            </wsdl:part>
      </wsdl:message>
      
      <wsdl:portType name="UserDAO">
      
      <wsdl:operation name="getUserJSON">
      <wsdl:input message="impl:getUserJSONRequest" name="getUserJSONRequest">
      
             </wsdl:input>
      <wsdl:output message="impl:getUserJSONResponse" name="getUserJSONResponse">
      
             </wsdl:output>
      </wsdl:operation>
      </wsdl:portType>
      
      <wsdl:binding name="UserDAOSoapBinding" type="impl:UserDAO">
      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      
      <wsdl:operation name="getUserJSON">
      <wsdlsoap:operation soapAction=""/>
      
      <wsdl:input name="getUserJSONRequest">
      <wsdlsoap:body use="literal"/>
      </wsdl:input>
      
      <wsdl:output name="getUserJSONResponse">
      <wsdlsoap:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
      
      <wsdl:service name="UserDAOService">
      
      <wsdl:port binding="impl:UserDAOSoapBinding" name="UserDAO">
      <wsdlsoap:address location="http://localhost:8080/PDFTest/services/UserDAO"/>
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>
      

       

      Javascript:

      function testDocumentLiteral(){
           try{
                var cURL = "http://localhost:8080/PDFTest/services/UserDAO?wsdl";
              console.println("\n\n***** ECHO *****");
              console.println("\nWSDL: " + cURL);
                
                //Set SQL String
              var sqlString = "SELECT * FROM USER WHERE EMPLOYEE_ID = 123456";
                console.println("SQL: " + sqlString);
                
                // Call the echoString SOAP method -- it is an RPC Encoded method
                SOAP.wireDump = false;
                var response = SOAP.request(
                {
                     cURL: cURL,
                     oRequest: {
                          "http://localhost:8080/PDFTest/services/UserDAO?wsdl:getUserJSON": {
                               sql: sqlString
                          }
                     },
                     cAction: ""
                });
                
                var parsedResult = response["http://localhost:8080/PDFTest/services/UserDAO?wsdl:getUserJSONResponse"]["getUserJSONReturn"];
                console.println("Web Service Response: " + parsedResult);
      
           }
           catch(e){
                console.println("Exception...\n" + e);
           }
           
      }