Web Service Example 9: Step-by-Step Instructions |
This topic contains step-by-step instructions to complete Web Service Example 9: Web Service Executing a Batch Job. 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:
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 FROM PAR_DESTINATION 5. Define a GET_SCHEDULED_TOURS Sql Task, with one SQL Statement: INSERT INTO par_schedtours (scheduled_tours) INVOKE xml.export WITH 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= usxsl.value ( i.destination ,'/ns:Destination' ,'xmlns:ns="http://localhost/TravelService/TRAVELSERVICE.wsdl"' ) 6. Define a LOGGETSCHEDULEDTOURS job as follows:
The job is now defined and 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. 7. 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") 8. Click the Check button, and in the Question dialog, click Yes. 9. For the LogGetScheduledTours method, change some attributes of the output parameter:
10. Save your changes, and click the Create Web Service button. The web server publication folder now contains an up-to-date TRAVELSERVICE.xml, TRAVELSERVICE.asp file, and TRAVELSERVICE.inc file. 11. Click the Create WSDL File button. The web server publication folder now contains an up-to-date TRAVELSERVICE.wsdl file. 12. Restart the Rules Service for the TRAVEL application that you configured in Example 1. 13. From the Definer catalog, open the TRAVELCOMPONENT Web Service Component that you defined in Web Service Example 1: Define a Web Service Component. 14. Click the Refresh button. 15. In the Refresh Web Service Component dialog, select the LogGetScheduledTours method, and click OK. A new LOGGETSCHEDULEDTOURS method is added. 16. Open the TRAVEL application and in the SQL command dialog, issue SQL statement: INVOKE TRAVELCOMPONENT.logGetScheduledTours WITH SELECT '<Destination xmlns="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl"> AUSTRALIA</Destination>' All scheduled tours to this destination are returned in XML Export format. |