Web service example 9: Step-by-step instructions

Previous Next

To define a web service provider method that retrieves Scheduled Tour details and logs the request, using a batch job:

1.In the Definer, define a SCHEDTOUR_REQUEST table, with columns:
REQUEST_ID, Key: 1, based on a sequence number domain.
REQUEST_DATE, based on a DATETIME domain, and default value: $$TRANSACTIONDATETIME$$
REQUEST, based on a CLOB domain.
2.Define a PAR_DESTINATION external set, File Format: FIXEDVLE, with a DESTINATION element with CLOB Data Type.
3.Define a PAR_SCHEDTOURS external set, File Format: FIXEDVLE, with a SCHEDULED_TOURS element with CLOB Data Type.
4.Define a LOG_REQUEST Sql Task, with one SQL Statement:

INSERT INTO schedtour_request (request)

SELECT destination



5.Define a GET_SCHEDULED_TOURS Sql Task, with one SQL Statement:

INSERT INTO par_schedtours (scheduled_tours)

INVOKE xml.export


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

FROM                schedtour s,par_destination i

WHERE                s.destination=



 ,        '/ns:Destination'

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



6.Create a new batcj job called LOGGESCHEDULEDTOURS with the following settings:
Input Parameter Set = PAR_DESTINATION
Output Parameter Set = PAR_SCHEDTOURS
Commit Type = Job

and with a task list that has the following SQL Tasks executed, in this order:




7.Validate this job. The job is ready to use. It has one input parameter: the destination in XML format. The first task stores the request in a table (but you can of course do anything you like) and the second one composes the response.
8.Open the TRAVELSERVICE web service provider. and add a LogGetScheduledTours method, Style: document-oriented, with SQL statement:

SELECT BatchRunner.LogGetScheduledTours

(:log_destination destination, 'True' "-quiet")


9.Click the Check button, and in the Question dialog, click Yes.
10.For the LogGetScheduledTours method, change some attributes of the output parameter:
Change the Namespace Alias to: SchedTours.
Click the XML Data Type button and select the Scheduled_Tours record.
11.Save your changes, and click the Create Web Service button.
The web server publication folder now contains an up-to-date TRAVELSERVICE.ashx and web.config files.
12.Click the Create WSDL File button.
The web server publication folder now contains an up-to-date TRAVELSERVICE.wsdl file.
13.Restart the Rules Service for the TRAVEL application that you configured in Example 1.
14.From the Definer catalog, open the TRAVELCOMPONENT Web Service Component that you defined in Web service example 1: Define a web service component
15.Click the Refresh button.
16.In the Refresh Web Service Component dialog, select the LogGetScheduledTours method, and click OK.
A new LOGGETSCHEDULEDTOURS method is added.
17.Open the TRAVEL application and in the SQL command dialog, issue SQL statement:



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



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