Expand my Community achievements bar.

Web service call using javascript

Avatar

Former Community Member

Hi All,

I am working on web service call using javascript. I used below code while calling web service on click event of button.

var e;
try
{

     var oListURL = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL";
     SOAP.wireDump = true;
     var service = SOAP.connect(oListURL);
     xfa.host.messageBox(service.toString());

     if(typeof service != "object")
     {

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

     }
     
     if(!service.ConversionRate(138,56))
     {
          xfa.host.messageBox("The ConversionRate method does not exist on the service at " + oListURL);
     }
     //call the service

     var svcResponse = service.ConversionRate(138,56);

     xfa.host.messageBox(svcResponse.toString());
     if(!svcResponse)
     {

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

     }

   
}

catch(e)

{

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

}

I do not get any response for it. I always get "0" as response.

How do i passed session id to soap header while calling web service in designer??

Is there any other adobe javascript with which i can call web service as well as i may able to provide session id to its soap header.

Request you all to share any information regarding this.

Thanks in advance.

Regards

Abhishek

4 Replies

Avatar

Level 10

Hi Abhishek,

This service seems to take the country codes as parameters, not the numerics 138,56, and I have always passed in the parameters as xml.

So I have just tried;

var svcResponse = service.ConversionRate("<FromCurrency>AUD</FromCurrency><ToCurrency>NZD</ToCurrency>");

and got a response

1.2557

Which is about right.

Hope this helps

Bruce

Avatar

Former Community Member

Hi Bruce,

Thanks for your quick reply on this

I do get response as well by making above changes.

But how do we passed session id,username and password using javascript in live cycle designer

There are several web services need some authentication before invoking it.

Regards

Abhishek

Avatar

Level 10

Hi,

I haven't tried using a webservice that requires authentication, I know it is mentioned in the "JavaScript for Acrobat® API Reference" manual so assume it can be done.

Regards

Bruce

Avatar

Level 1

Hi Abhishek,

Sorry for replying to this post a year later.

I have a requirement to use a web service, which is secured and need authentication, in Interactive PDF. I have Adobe Livecycle Designer ES2.

I have created a New Data Connection with the WSDL. After this I got three elements in my Data view namely "request", "respone", "Create button".

I added these elements in the form and previewed. But when I click on the execute button nothing is happening. Ideally it should ask for authentication in a dialog box. But its not happening.

Please help me in this regard.

Thanks and Regards,

Sathya