1 Reply Latest reply on Feb 17, 2016 4:52 PM by MikeIs2C

    Can't get SOAP examples to work in console -- always get "undefined"

    MikeIs2C Level 1

      First, I am a newbie to using SOAP in general.  I was able to write a php client and service that worked on my localhost (using WAMP) to get results from a database using a function call.  I then wanted to get it to work on a PDF on my computer (Windows 10 using Acrobat DC Pro).


      I started by trying to run some basic examples from the"Javascript Developer's Guide" using the console and substituting my own values.  But it always came back with "undefined".  So I thought I would just follow the examples as given but had the same problem.  I have since been all over the Web looking at other people's examples and problems. But I always get undefined when I run them -- despite other people saying it worked for them!


      I suspect I am using the URL incorrectly since that is missing in most examples.  In any case, using the basic example below,

      I hope someone can point out what I am doing wrong:


      var cURL = "http://www.whitemesa.com/interop/InteropTest.wsdl";

      var myProxy = SOAP.connect(cURL);

      var testString = "This is a test string.";

      var result = myProxy.echoString(testString);

      console.println("Result is " + result);


      Thanks so much for your time,



        • 1. Re: Can't get SOAP examples to work in console -- always get "undefined"
          MikeIs2C Level 1

          I figured out what I was doing wrong in general: I was incorrectly using the console!  In reviewing the guide on executing code on the console (multiple lines), it specifically states:


          To evaluate multiple lines of code, highlight those

          lines and press either the Enter key on the numeric

          keypad or press Ctrl + Enter.


          I was just hitting Ctrl + Enter without highlighting the lines to execute first.  Nevertheless, my code example still didn't work when I executed it.  I am pretty certain this has to do with the cURL used, because the result said "echoString is not a function".  So hopefully someone can provide a correct URL so others possibly struggling like me with the examples can benefit from it.


          On a brighter note for my original concern, I was able to get my localhost PHP service to the console recognized.  For anyone curious what that looks like, see the following:


          SOAP.wireDump = false;

          var myProxy = SOAP.connect("http://localhost:8080/demo/service.php?wsdl");

          var testString = "Quality Assurance Form X";

          var result = myProxy.getForm_QAPersonnelTbl(testString);

          console.println("Result is " + result.fullName);Result is Michael Faggard




          Note that my localhost is using port "8080" and is why that is in the URL.