Please enable JavaScript to view this site.

ESL Documentation

Having built the message and the function to parse the response, you will need to wrap the code into a subroutine, including any local variables required and the main input and output data.

subroutine CelsiusToFahrenheit(float: Celsius_FV,

                               float: Fahrenheit_FV) is

 

string Header_SV

       Body_SV

 

copy "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"

     "<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">\r\n"

     "  <soap12:Body>\r\n"

     "    <CelsiusToFahrenheit xmlns=\"http://tempuri.org/\">\r\n"

     "      <Celsius>"Celsius_FV"</Celsius>\r\n"

     "    </CelsiusToFahrenheit>\r\n"

     "  </soap12:Body>\r\n"

     "</soap12:Envelope>" to Body_SV

 

copy "Host: www.w3schools.com\r\n"

     "Content-Type: application/soap+xml; charset=utf-8\r\n"

     "Content-Length: " length of Body_SV "\r\n" to Header_SV

 

extract from HTTPPostWithHdr("https://www.w3schools.com/XML/tempconvert.asmx",

                             Header_SV,

                             Body_SV,

                             false,

                             false,

                             false)

      skip by "<CelsiusToFahrenheitResult>"

      take to "</CelsiusToFahrenheitResult>" Fahrenheit_FV

Before copying this web service interface routine to your main ESL application, we recommend you use a simple test application, for example:

subroutine Test() is

 

float Celsius_FV is 21.0

      Fahrenheit_FV

 

   call CelsiusToFahrenheit(Celsius_FV,

                            Fahrenheit_FV)

 

   send "Temp is " Fahrenheit_FV "\n" to errorlog

 

response to start

   call Test()
   exit

 

Note: Remember to include the "EslWeb.inc" file at the start of the application source code file and have the test routine and response to start at the end, so the single pass compiler picks up the references in the correct order.