Please enable JavaScript to view this site.

ESL Documentation

Having build the message body and header, we need to Post the message to the Web Service and parse the response. The template for the returned message body is:

<?xml version="1.0" encoding="utf-8"?> 

<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">

  <soap12:Body>

    <CelsiusToFahrenheitResponse xmlns="http://tempuri.org/">

      <CelsiusToFahrenheitResult>string</CelsiusToFahrenheitResult>

    </CelsiusToFahrenheitResponse>

  </soap12:Body> 

</soap12:Envelope>

Note: the placeholder "string" is hi-lighted in a different color.

For this part of the tutorial we will assume that the float variable required to hold the returned result will be passed into routine. Although a float variable type is used, ESL will automatically convert the string type data, so the following "extract from" statement is all that is required.

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

Note: that the call to the HTTP Post function is included within the "extract from" statement, which is quite acceptable with simple structures. If the response had multiple occurrences of a field or fields then you will need to copy the response to an ESL string, then use a loop construct to extract each occurrence.