2 Replies Latest reply on May 14, 2009 9:51 AM by Luigi_247_365

    BASIC CALL, TO & FROM A SIMPLE LIVE WEBSERVICE

    Luigi_247_365 Level 1

      Hi All,

       

      Using folder level scripting - in the config.js

       

      I am trying to make a call to the following webservice

                         http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit

       

      =========================================

       

      Code Try 1:

      SOAP.wireDump = true;

      var cURL = "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl";

      var oService = Net.SOAP.connect(cURL);

      var response = oService.CelsiusToFahrenheit({Celsius:"10"});

       

       

      RESULT 1:

      "

      <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CelsiusToFahrenheitResponse xmlns="http://tempuri.org/"><CelsiusToFahrenheitResult>50</CelsiusToFahrenheitResult></CelsiusToFahrenheitResponse></soap:Body></soap:Envelope>

       

      SOAP.stripNS is not a function

      "

      COMMENT 1:

      Result is correct, but then the response object doesn't react to: console.println(response);

      And "SOAP.stripNS is not a function" appears

       

      =========================================

       

      Code Try 2:

      SOAP.wireDump = true;

      var cURL = "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl";

      var degrees = {soapType:"xsd:string", soapValue:"10"};

      var oResponse = Net.SOAP.request({

         cURL: cURL,

         oRequest: {

         "CelsiusToFahrenheit":{Celsius: degrees}

         },

         cAction: "http://tempuri.org/CelsiusToFahrenheit",

         bEncoded: false

      });

       

      RESULT 2:

      "

      <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CelsiusToFahrenheitResponse xmlns="http://tempuri.org/"><CelsiusToFahrenheitResult>Error</CelsiusToFahrenheitResult></CelsiusToFahrenheitResponse></soap:Body></soap:Envelope>

      "

      COMMENT 2:

      The CelsiusToFahrenheitResult tag has a ERROR in it as per below!

       

      =========================================

       

      SUMMARY:

      Anything obvious I am missing?

      Can somebody please provide code or provide guidance on the correcting of the above code!?

      Can't seem to handle the response object

       

      Thanks in advance!

        • 1. Re: BASIC CALL, TO & FROM A SIMPLE LIVE WEBSERVICE
          Patrick Leckey Level 3

          If the response from the webservice is not RPC encoded, then the response object will be a complex object and not a string.  You need to parse through it as an array, using the response namespace from your webservice, to get to the data.

          • 2. Re: BASIC CALL, TO & FROM A SIMPLE LIVE WEBSERVICE
            Luigi_247_365 Level 1

            Thank for the reply Patrick.

             

            The webservice: "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl" is a document-literal!?

             

            Thanks for the info on the response object from the Webservice - once I get a stable call to the webservice and NO errors - I will get to disecting the response object / stream / thing!

             

            ======================================================

             

            1) What is wrong with my code attempts to call the webservice?

            2) Which code attempt would you suggest is the correct/suggested method (or on the right track) - try 1 or try 2?

            3) If you could please provide code that makes a call to the webservice mentioned and writes out the result to the console.

             

             

            I have looked through many many of the Adobe examples, APIs, listings, googled, etc etc...

            I've had many varied results and have tried many combinations, just can't seems to piece this puzzle together!

             

             

            ======================================================

            Im trying to figure out all the combinations with AcroScript: (Sync'd only)

            Call a document-literal WS with a single response

            Call a RPC encoded WS with a single response

            Call a document-literal WS with multiple responses

            Call a RPC encoded WS with multiple responses

            ======================================================