Web service example 5: Step-by-step instructions

Previous Next

This topic contains step-by-step instructions to complete Web Service Example 5: Document-Oriented Method with Complex Type Parameters.

To define a document-oriented method that retrieves Scheduled Tour details for a specified destination:

1.In the Web Service Provider window, query the TRAVELSERVICE web service provider that you defined in Example 1.
2.On the Methods tab page, define a GetScheduledTours method, set the Operation Style to: Document-oriented, and set the Method Call to: Synchronous.
3.Define SQL statement:

INVOKE XML.EXPORT

WITH

SELECT                tour_type, start_date, return_date, price, max_part, guide

FROM                schedtour

WHERE                destination = USXSL.value(:Destination

,                '/ns:Destination'

,                'xmlns:ns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl"')

 

The USXSL value method extracts the destination ( 'AUSTRALIA' for example ) from the input parameter:

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

 AUSTRALIA</Destination>

 

4.Click the Check button, and in the Question dialog, click Yes.
One input parameter and one output parameter, by default XMLDOCUMENT, are generated.
5.From the Definer menu, select: Define, Web Services Provider, Namespaces. Define a Namespace:
Namespace Alias: SchedTours
Namespace: urn:ScheduledTour
Location: http://<web server>/TravelService/MyScheduledTours.xsd

 

6.Define a MyScheduledTours.xsd XML schema file that describes the structure of the returning XML document. This XML schema file is described in: Web service example 5: XML schema definition for scheduled tours.
7.For the GetScheduledTours method of the TRAVELSERVICE web service provider, change some attributes of the output parameter:
Change the parameter name to: Scheduled_Tours
Change the Namespace Alias to: SchedTours
8.Click the XML Data Type button and select the Scheduled_Tours record.
9.Save your changes.
Click the Create Web Service button.
The web server publication folder now contains an up-to-date TRAVELSERVICE.ashx and web.config files.

 Click the Create WSDL File button.

 The web server publication folder now contains an up-to-date TRAVELSERVICE.wsdl file.

10.Restart the Rules Service for the TRAVEL application that you configured in Example 1.
11.From the Definer catalog, open the TRAVELCOMPONENT Web Service Component that you defined in Web Service Example 1: Define a Web Service Component.
12.Click the Refresh button.
13.In the Refresh Web Service Component dialog, select the GetScheduledTours method, and click OK.
A new GETSCHEDULEDTOURS method is added.
14.Open the application that contains the web service component, and in the SQL command dialog, issue SQL statement:

INVOKE TRAVELCOMPONENT.GETSCHEDULEDTOURS

WITH

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

 

All scheduled tours to this destination are returned in XML Export format.

For background information about all SOAP messages sent, refer to: Web service example 5: SOAP request and response messages