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 an RPC-oriented InsertTour method that inserts a Tour record.
One of the inserted column values is a maximum age. The corresponding AGE domain has four allowed values. You have to write an XML Schema (XSD) definition to let the client application know that these restrictions exist.
To define an RPC-oriented method that inserts a Tour record:
1. | In the Web Services (Provider) window, query the TRAVELSERVICE web service provider that you defined in Example 1. |
2. | On the Methods tab page, define a InsertTour method, set the Operation Style to: RPC-oriented, and set the Method Call to: Synchronous. |
INSERT INTO TOUR(destination,tour_type, num_days, max_age)
VALUES
(
:destination,
:tour_type,
:num_days,
:max_age
)
4. | Click the Check button, and in the Question dialog, click Yes. |
| Four input parameters are generated. |
5. | From the Definer menu, select: Define, Web Services Provider, Namespaces. Define a Namespace: |
| Namespace Alias: InsertTour |
| Namespace: urn:InsertTour |
| Location: http://MyWebServer/TravelService/InsertTour.xsd |
7. | For the InsertTour method, change some attributes of the max_age input parameter: |
| Change the Domain to: AGE. |
| Change the Namespace Alias to: InsertTour. |
| Click the XML Data Type button and select the Age record. |
| This parameter is based on a domain with an IO Format other than: XML. The parameter name (max_age), is not included in the XML document. USoft automatically handles the parameter name. |
9. | Click the Create Web Service button. |
| The web server publication folder now contains an up-to-date TRAVELSERVICE.ashx and web.config files. |
10. | Click the Create WSDL File button. |
| The web server publication folder now contains an up-to-date TRAVELSERVICE.wsdl file. |
11. | Restart the Rules Service for the TRAVEL application that you configured in Example 1. |
12. | From the Definer catalog, open the TRAVELCOMPONENT Web Service Component that you defined in Web Service Example 1: Define a Web Service Component. |
13. | Click the Refresh button. |
14. | In the Refresh Web Service Component dialog, select the InsertTour method, and click OK. |
| A new INSERTTOUR method is added. |
15. | Open the application that contains the web service component, and in the SQL command dialog, issue SQL statement: |
INVOKE TRAVELCOMPONENT.INSERTTOUR WITH
SELECT 'AUSTRALIA','SCENIC',28,'<max_age>36</max_age>'
| You will get an error message, because 36 is not an allowed value. If you execute the same statement with value 35, an insert takes place, including a commit by the web service provider. |
See also
Web service example 3: XML schema definition for an AGE type with allowed values
|