How to make web service in xdp file working in HTML form after conversion | Community
Skip to main content
Level 2
June 11, 2021
Solved

How to make web service in xdp file working in HTML form after conversion

  • June 11, 2021
  • 1 reply
  • 1240 views

Hello there,

How to make web service in xdp file work after the xdp file is converted to HTML form? 

For example, the xdp contains javascripts (or use ConnectionSet) to call web service

form1.#subform[0].Button1::click - (JavaScript, server)

      var countryTextField = "AFK";

      var cURL = "http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL";
      SOAP.wireDump = false;
      var service = SOAP.connect(cURL);
      var Input = {sCountryISOCode:countryTextField};
      var result = service.FullCountryInfo(Input);
      tfCurrency.rawValue = result.sCurrencyISOCode;
      tfCapital.rawValue = result.sCapitalCity;

 

Is there any way make the web service working in previewHTML or HTML form converted from xdp?

Please suggest.

Thanks in advance.

Harry

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Pulkit_Jain_

@harry2ca 

xfa.connectionSet won't work in this case, if rendered at client but you can make a web service call if the script is rendered at server. Yes, if the requirement is to run the script at the client, then you can make an Ajax call to the webservice as below:

 

if (typeof(xfa.connectionSet)=="undefined") { var data = new FormData(); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange=function() { //Custom logic// } }; xhttp.open("POST", http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL, true); xhttp.send(data); } else { xfa.connectionSet.LookupUser.execute(0); }

 

Hope that helps!

1 reply

Pulkit_Jain_
Adobe Employee
Pulkit_Jain_Adobe EmployeeAccepted solution
Adobe Employee
June 17, 2021

@harry2ca 

xfa.connectionSet won't work in this case, if rendered at client but you can make a web service call if the script is rendered at server. Yes, if the requirement is to run the script at the client, then you can make an Ajax call to the webservice as below:

 

if (typeof(xfa.connectionSet)=="undefined") { var data = new FormData(); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange=function() { //Custom logic// } }; xhttp.open("POST", http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL, true); xhttp.send(data); } else { xfa.connectionSet.LookupUser.execute(0); }

 

Hope that helps!

harry2caAuthor
Level 2
June 21, 2021
I couldn't make POST work. I hope to call the FullCountryInfo to get the CountryName from CountryISOCode "AFK". How to pass parameter to a method? Could you provide more details of the code?