Web Service Example 4: SOAP request and response messages |
This topic provides background information about the SOAP messages that are sent in Web Service Example 4: Document-Oriented Method with Simple Type Parameters. In example 4, the following client SQL statement is executed: INVOKE TRAVELCOMPONENT.GETTOURSDocument WITH SELECT '<DestinationRequest xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">AUSTRALIA</DestinationRequest>' ,'<TourTypeRequest xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">ISLAND SUNTANNER</TourTypeRequest>'
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="GETTOURSDocument"> <soap:operation soapAction="http://MyWebServer/TravelService/TRAVELSERVICE.ashx#GETTOURSDocument" style="document" /> <wsdl:input name="GETTOURSDocument"> <soap:body use="literal" /> </wsdl:input> <wsdl:output name="GETTOURSDocumentResponse"> <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> <DestinationRequest xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> AUSTRALIA </DestinationRequest> <TourTypeRequest xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> ISLAND SUNTANNER </TourTypeRequest></soapenv:Body></soapenv:Envelope>
The body of this SOAP request message includes XML elements that are included in the SQL statement. Next, the following statement is sent to the Rules Service: INVOKE TRAVELSERVICE.GETTOURSDocument 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:DestinationResponse>AUSTRALIA</tns:DestinationResponse> <tns:TourTypeResponse>ISLAND SUNTANNER</tns:TourTypeResponse> <tns:NumDaysResponse>13</tns:NumDaysResponse> <tns:DescriptionResponse>Exclusive sailing adventure...</tns:DescriptionResponse> </soap:Body> </soap:Envelope>
The body of this SOAP response message only includes XML elements that are included in the SQL statement of the web service provider method. |