Web Service Example 8: SOAP request and response messages

Previous Next

See Also

This topic provides background information about the SOAP messages that are sent in Web Service Example 8: Component Table with an Input XSL Transformation. In example 8, the following client SQL statement is executed (by executing a query from an info window):

SELECT *

FROM TRAVELCOMPONENT

WHERE search_destination='AUSTRALIA'

The Web Service component internally translates this SQL statement into the component table XML format:

<Table>

<Row>

<Field Value="AUSTRALIA" Index="0"/>

</Row>

</Table>

The Input XSL transformation that you wrote in Example 8 transforms this into:

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

AUSTRALIA</SearchDestination>

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

<wsdl:operation name="GetMultipleTours">

<soap:operation soapAction="http://MyWebServer/TravelService/TRAVELSERVICE.asp#GetMultipleTours" style="document"/>

<wsdl:input name="GetMultipleTours">

<soap:body use="literal"/>

</wsdl:input>

<wsdl:output name="GetMultipleToursResponse">

<soap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

In this code fragment, the attributes style="document" and use="literal" do NOT result in any method names or parameter names appearing in the SOAP request message. This is why in a document-oriented method, all XML elements must be included in the SQL statement:

<?xml version="1.0" encoding="Windows-1252"?>

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

       <SearchDestination xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl"

       xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">

           AUSTRALIA

       </SearchDestination>

   </soapenv:Body>

</soapenv:Envelope>

The body of this SOAP request message includes the XML elements that are included in the SQL statement.

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

INVOKE

TRAVELSERVICE.GetMultipleTours

WITH

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

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>

   <tns:Tours documentName="Tours">

<TOUR DESTINATION="AUSTRALIA" TOUR_TYPE="ISLAND SUNTANNER" NUM_DAYS="13" MAX_AGE="65" DESCRIPTION="sailing adventure"></TOUR>

<TOUR DESTINATION="AUSTRALIA" TOUR_TYPE="ROCK 'N' ALICE" NUM_DAYS="12" MAX_AGE="65" DESCRIPTION="Ayers Rock climb"></TOUR>

   </tns:Tours>

</soap:Body>

</soap:Envelope>

The body of this SOAP response message only includes the Tours parameter of the web service provider method in XML format.

The Output XSL transformation that you wrote in Example 8 transforms the body of this SOAP message into:

<Table xmlns:ns1="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">

<Row>

   <Field Name="DESTINATION" Value="AUSTRALIA" Index="1"/>

   <Field Name="TOUR_TYPE" Value="ISLAND SUNTANNER" Index="2"/>

   <Field Name="NUM_DAYS" Value="13" Index="3"/>

   <Field Name="MAX_AGE" Value="65" Index="4"/>

   <Field Name="DESCRIPTION" Value="sailing adventure" Index="5"/>

</Row>

<Row>

   <Field Name="DESTINATION" Value="AUSTRALIA" Index="1"/>

   <Field Name="TOUR_TYPE" Value="ROCK 'N' ALICE" Index="2"/>

   <Field Name="NUM_DAYS" Value="12" Index="3"/>

   <Field Name="MAX_AGE" Value="65" Index="4"/>

   <Field Name="DESCRIPTION" Value="Ayers Rock climb" Index="5"/>

</Row>

</Table>

Finally, this XML document is represented as record set in the info window.