cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

javascript in adobe forms

Former Member
0 Likes
1,500

Hi experts,

I call a web service in javascript when button is clicked. Please help check the following code:


try {
xfa.host.messageBox("welcome");  //pop-up
var myRequest={Celsius:"50"};
var service = SOAP.connect( "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl");
xfa.host.messageBox("Connected" + service); //pop-up "Connected[objectSoapService]"
for(var i in service) xfa.host.messageBox(i);    //nothing
var response = service.CelsiusToFahrenheit(myRequest);   
xfa.host.messageBox("Called");
xfa.resolveNode("TextField1").rawValue = response ;
} catch(e) {
xfa.host.messageBox(e.toString());    //pop-up "TypeError:service.CelsiusToFahrenheit is not a funciton"
}

Thanks.

View Entire Topic
chintan_virani
Active Contributor
0 Likes

How are you developing this form i.e. in SAP or in Stand-alone mode through Adobe LiveCycle Designer.

Also I do not understand the service.myRequest statement, normally for Web Services you follow below steps:-

1. Create a data connection from the WSDL file of the Web Service .

2. Drag-drop the input / output fields to form or create the form UI manually and bind it to respective parameter.

3. Create a button of type Regular and in click event of it write code as mentioned below:-

var cURL = "http://someserver:port/sap/bc/srt/wsdl/bndg_XXX/wsdl11/standard/ws_policy/document?sap-client=100" ;
var service = SOAP.connect(cURL);
xfa.connectionSet.<your connection name>.execute(0);

Former Member
0 Likes

Thanks for Chintan's help. I follow your way to do a demo, and it works.

I have 2 more questions:

1: If sap need username/password to access the web service, how to do in the interactive forms?

2. if call web service failed, the webservice.output.flag has the call result. How to read the value in javascript?

thanks.

chintan_virani
Active Contributor
0 Likes

Well if I remember correctly the parameters would be sap-username and sap-password so your statement would be

var cURL = "http://someserver:port/sap/bc/srt/wsdl/bndg_XXX/wsdl11/standard/ws_policy/document?sap-client=100&sap-username='abc'&sap-password='xyz' ;

Put a textfield (say name is TextField1) and bind the to output flag of Web Service and it should display the value after the Web Service is executed.

Now if you want to read the value then you can do so easily by accessing as TextField1.rawValue.

Former Member
0 Likes

Hi chintan,

I have developed a standalone adobe form using the lifecycle designer, and followed the steps mentione dby u in the thread, i hav eput up the break point in my webservice but it is not getting triggered on the click of the button.

My standalone webservice is working perfectly fine, I am not sure what has gone wrong.

Thanks

Pooja