Web Service Example 4: Step-by-Step Instructions |
This topic contains step-by-step instructions to complete Web Service Example 4: Document-Oriented Method with Simple Type Parameters. To define a document-oriented method that retrieves Tour details for a specified destination and tour type:
SELECT '<DestinationResponse>'||destination||'</DestinationResponse>' DestinationResponse , '<TourTypeResponse>'||tour_type||'</TourTypeResponse>' TourTypeResponse , '<NumDaysResponse>'||num_days||'</NumDaysResponse>' NumDaysResponse , '<DescriptionResponse>'||description||'</DescriptionResponse>' DescriptionResponse FROM tour WHERE destination = USXSL.value(:DestinationRequest , '/ns:DestinationRequest' , 'xmlns:ns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl"') AND tour_type = USXSL.value(:TourTypeRequest , '/ns:TourTypeRequest' , 'xmlns:ns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl"')
6. Click the Create Web Service button. The web server publication folder now contains an up-to-date TRAVELSERVICE.ashx and web.config files.
INVOKE TRAVELCOMPONENT.GETTOURSDocument WITH SELECT '<DestinationRequest xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">AUSTRALIA</DestinationRequest>' , '<TourTypeRequest xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">ISLAND SUNTANNER</TourTypeRequest>'
All details of this record (if any) are returned, and are surrounded by the XML elements defined in the SQL Statement of the Web Service Provider. For example: <ns1:DestinationResponse xmlns:ns1="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">AUSTRALIA</ns1:DestinationResponse> <ns1:TourTypeResponse xmlns:ns1="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">ISLAND SUNTANNER</ns1:TourTypeResponse> <ns1:NumDaysResponse xmlns:ns1="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">13</ns1:NumDaysResponse> <ns1:DescriptionResponse xmlns:ns1="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">Exclusive sailing adventure,to the Great Barrier Reef</ns1:DescriptionResponse>
For background information about all SOAP messages sent, refer to: Web Service Example 4: SOAP request and response messages. |