Web service example 2: RPC-oriented method with simple type parameters based on a domain

Previous Next

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 GetSchedtoursBetween method that retrieves the number of scheduled tours between two dates.

These two input parameters are based on a DATE domain. This ensures that the input parameter values conform to the XML Data Type specified for this parameter.

To define an RPC-oriented method that retrieves the number of scheduled tours between two dates:

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 GetSchedtoursBetween method, set the Operation Style to: RPC-oriented, and set the Method Call to: Synchronous.
3.Define SQL statement:

SELECT                count(*) "NumberOfScheduledTours"

FROM                schedtour st

WHERE                st.start_date BETWEEN :start_date AND :end_date

 

4.Click the Check button, and in the Question dialog, click Yes.
Two input parameters and one number_of_scheduled_tours output parameter are generated.
5.Define a new domain:
Domain Name: DATE_DOMAIN_IO
Data Type: DATE
IO Format: YYYY-MM-DD
This IO Format is the default IO format for representing date values in XML.
6.For the GetSchedtoursBetween method, change some attributes of the two input parameters:
7.Change the Domain to: DATE_DOMAIN_IO.
8.Change the XML Data Type to: date.
9.Save your changes.
10.Click the Create Web Service button.
The web server publication folder now contains an up-to-date TRAVELSERVICE.ashx and web.config files.
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 GetSchedtoursBetween method, and click OK.
A new GETSCHEDTOURSBETWEEN method is added. The Data Type of the input parameters is set to: Date.
16.Open the application that contains the web service component, and in the SQL command dialog, issue SQL statement:

INVOKE TRAVELCOMPONENT.GETSCHEDTOURSBETWEEN WITH

SELECT sysdate, to_date('01-01-2012','dd-mm-yyyy')

 

The number of scheduled tours is returned.

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

 

See also

Web service example 2: SOAP request and response messages