Web Service Example 5: SOAP request and response messages |
This topic provides background information about the SOAP messages that are sent in Web Service Example 5: Document-Oriented Method with Complex Type Parameters. In example 5, the following client SQL statement is executed: INVOKE TRAVELCOMPONENT.GETSCHEDULEDTOURS WITH SELECT '<Destination xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">AUSTRALIA</Destination>'
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="GetScheduledTours"> <soap:operation soapAction="http://MyWebServer/TravelService/TRAVELSERVICE.ashx#GetScheduledTours" style="document"/> <wsdl:input name="GetScheduledTours"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="GetScheduledToursResponse"> <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="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> <Destination xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> AUSTRALIA </Destination> </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.GetScheduledTours 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:Scheduled_Tours documentName="Scheduled Tours"> <SCHEDTOUR TOUR_TYPE="ISLAND SUNTANNER" START_DATE="2005-11-01000000" RETURN_DATE="2005-11-13000000" PRICE="120" MAX_PART="10" GUIDE="137"> </SCHEDTOUR> <SCHEDTOUR TOUR_TYPE="ISLAND SUNTANNER" START_DATE="2005-11-15000000" RETURN_DATE="2005-11-27000000" PRICE="122" MAX_PART="5" GUIDE="6"> </SCHEDTOUR> </tns:Scheduled_Tours> </soap:Body> </soap:Envelope>
The body of this SOAP response message only includes the Scheduled_Tours parameter of the web service provider method in XML format. |