on ‎2010 Oct 08 6:44 AM
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.
Request clarification before answering.
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);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
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
| User | Count |
|---|---|
| 9 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.