Web Service Example 4: Document-Oriented Method with Simple Type Parameters

Previous Next

See Also

First complete Web Service Example 1: RPC-Oriented Method with Simple Type Parameters. This example is an add-on.

In this example, you extend the TRAVELSERVICE web service provider with a documented-oriented GETTOURSDocument method that retrieves Tour details for a specified destination and tour type. Functionally, this is equivalent to Web Service Example 1.

The difference is that for a documented-oriented method, the body of the SOAP request and response messages must contain one or more XML documents. This has an impact in three places:

1. For a documented-oriented method, the body of the SOAP response message must contain one or more XML documents. You, the developer of the web service provider, must provide the XML elements surrounding the parameter values.

So the SELECT clause of the SQL Statement of the method reads:

SELECT     '<DestinationResponse>'||destination||'</DestinationResponse>',

   '<TourTypeResponse>'||tour_type||'</TourTypeResponse>',

   '<NumDaysResponse>'||num_days||'</Num_DaysResponse>',

   '<DescriptionResponse>'||description||'</DescriptionResponse>'

FROM    tour

2. Also, the body of the SOAP request message must contain one or more XML documents. The INVOKE statement, issued by the client application now reads:

INVOKE    TRAVELCOMPONENT.GETTOURSDocument

WITH

SELECT '<DestinationRequest xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">

AUSTRALIA</DestinationRequest>'

,'<TourTypeRequest xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl">

ISLAND SUNTANNER</TourTypeRequest>'

3. To execute a query on Tours, you need to extract the relevant values from these input parameters.

You can use the internal USXSL component. The WHERE clause of the SQL Statement of the method reads:

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"')

For details, refer to See Also topic: The USXSL Component.

Next: Web Service Example 4: Step-by-Step Instructions.

Related Topics

Web Service Example 4: Step-by-Step Instructions

Web Service Example 4: SOAP request and response messages