Web service example 1: SOAP request and response messages

Previous Next

This topic provides background information about the SOAP messages that are sent in Web Service Example 1: RPC-Oriented Method with Simple Type Parameters.

In example 1, the following client SQL statement is executed:

INVOKE TRAVELCOMPONENT.GETTOURS WITH

SELECT 'AUSTRALIA','ISLAND SUNTANNER'

 

The Web Service component handles this statement, and composes a SOAP request message. The information how to compose this message is defined in the TRAVELSERVICE.wsdl file:

<wsdl:operation name="GETTOURS">

   <soap:operation soapAction="http://MyWebServer/TravelService/TRAVELSERVICE.ashx#GETTOURS"

       style="rpc"/>

   <wsdl:input name="GETTOURS">

       <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl" />

       </wsdl:input>

   <wsdl:output name="GETTOURSResponse">

       <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl" />

       </wsdl:output>

</wsdl:operation>

In this code fragment, the attributes style="rpc" and use="encoded" result in method names and parameter names appearing in the SOAP request message:

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

<soapenv:Envelope

   xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

   xmlns:xsd="http://www.w3.org/2001/XMLSchema"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

   <ns1:GETTOURS

   soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"

   xmlns:ns1="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">        <ns1:destination xsi:type="xsd:string">

           AUSTRALIA</ns1:destination>

       <ns1:tour_type xsi:type="xsd:string">

           SUNTANNER</ns1:tour_type>

   </ns1:GETTOURS></soapenv:Body>

</soapenv:Envelope>

The body of this SOAP request message includes a GETTOURS method and destination and tour_type input parameters.

Next, the following statement is sent to the Rules Service:

INVOKE TRAVELSERVICE.GETTOURS WITH

SELECT '... soap message above ...' request

 

You can view this statement in the Rules service log files, if the Rules Service is in Debug mode.

Then, the Web Service provider composes a SOAP response:

<soap:Envelope

    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

    xmlns:tns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">

<soap:Body>

    <GETTOURSResponse

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<DESTINATION

    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

    xsi:type="xsd:string">AUSTRALIA

</DESTINATION>

...

...

    </GETTOURSResponse>

</soap:Body>

</soap:Envelope>

The body of this SOAP response message includes a GETTOURSResponse method and all output parameters.