Expand my Community achievements bar.

A webservice call and Javascript

Avatar

Level 1

Environment:

Win7(x64)

LiveCycle Designer ES 8.2

Acrobe 9.0 Pro

This problem is similar if not identical to this existing thread which does not appear to contain an answer: http://forums.adobe.com/thread/636798

I'm calling a web service that returns some xml that I'd like to process in JavaScript within a PDF form. My script looks like this:

var e;

try

{

     var oListURL = "http://localhost:8080/ListDataService.wsdl";

     SOAP.wireDump = true;

     var service = SOAP.connect(oListURL);

     if(typeof service != "object") {

          xfa.host.messageBox("Couldn't connect to " + oListURL);

     }

     if(!service.GetAgents) {

          xfa.host.messageBox("The GetAgents method does not exist on the service at " + oListURL);

     }

     //call the service

     var svcResponse = service.GetAgents();

     if(!svcResponse) {

          xfa.host.messageBox("The service returned nothing");

     }

     var itemCount = 0;

     var nodeCount = 0;

     for(var nItemCount in svcResponse)

     {

          for(var listItemNode in svcResponse[nItemCount])

          {

               //TODO: do something with the data here...

               nodeCount++;

          }

          itemCount++;

     }

}

catch(e)

{

     xfa.host.messageBox("Exception: " + e);

}

I have JavaScript debugging switched on, I can see the result of the web service call and I'm seeing something unexpected. All of the elements in the xml document represented in JavaScript look like undefined objects. This means I'm unable to process the result of the web service call. I hope this screenshot of the runtime debugger variables can be clearly seen:

PDF_JS_Debug2.jpg

The xml document is being fully populated and returned from the web service. I can see the xml returned in the JS debugger console window:

<?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>

          <GetAgentsResponse xmlns="https://localhost:8080/ListDataService.asmx">

               <GetAgentsResult xmlns="http://localhost:8080/ListDataService.asmx">

                    <Item ItemId="0" ItemName="Name0"/>

                    <Item ItemId="1" ItemName="Name1"/>

                    <Item ItemId="2" ItemName="Name2"/>

                    <Item ItemId="3" ItemName="Name3"/>

                    <Item ItemId="4" ItemName="Name4"/>

                    <Item ItemId="5" ItemName="Name5"/>

                    <Item ItemId="6" ItemName="Name6"/>

                    <Item ItemId="7" ItemName="Name7"/>

                    <Item ItemId="8" ItemName="Name8"/>

                    <Item ItemId="9" ItemName="Name9"/>

               </GetAgentsResult>

          </GetAgentsResponse>

     </soap:Body>

</soap:Envelope>

I'm using the 'SOAP.connect' method to call the web service because I want to have full control of this process.
This is strange behaviour. Is it a bug?
Thanks,
Joe
0 Replies