Home > Advanced Programming Techni... > Implementing Web Services > Example: Creating a Web Ser...
Previous |
Next |
To utilize Web services in Oracle Application Express, you create a Web service reference using a wizard. When you create the Web reference, you can follow one of these methods:
You supply the URL to a WSDL document. The wizard then analyzes the WSDL and collects all the necessary information to create a valid SOAP message.
The wizard provides a step where you can locate a WSDL using the Universal Description, Discovery, and Integration (UDDI) registry. A UDDI registry is a directory where businesses register their Web services. You search for the WSDL by entering either a service or business name.
You supply the relevant information on how to interact with the Web service, including the SOAP request envelope, and create the Web reference manually.
You supply the relevant information on how to interact with a RESTful style Web service including the URL endpoint, HTTP method and input parameters or payload.
In this example, you create a Web service reference by supplying the location of a WSDL document to a Web service. You then test the Web service reference and create a form and report to display movie theaters and locations.
Note: If your environment requires a proxy server to access the Internet, you must specify a proxy server address on the Application Attributes page before you can create a Web service reference. See Specifying an Application Proxy Server Address for instructions. |
Note: The following example is dependent upon the availability of the specified Web service ultimately invoked. If the Web service is unavailable, you may experience difficulties completing this exercise. |
To create a new Web reference by supplying the WSDL location:
On the Application home page, click Shared Components.
The Shared Components page appears.
Under Logic, select Web Service References.
Click Create.
Choose Based on WSDL and click Next.
When prompted whether to search a UDDI registry to find a WSDL, select No and click Next.
In the WSDL Location field enter the following and click Next:
http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx?wsdl
A summary page appears describing the selected Web service.
Click Create Reference.
The Create Web Service Reference page appears. The Web service reference for MovieInformation is added to the Web Service References Repository.
Next, you need to create a page that contains a form and report to use with your Web Service Reference.
To create a form and report after creating a Web Service Reference:
On the Create Web Service Reference success page, select Create Form and Report on Web Service.
For Choose Service and Operation:
Web Service Reference - Select MovieInformation.
Operation - Select GetTheatersAndMovies.
Click Next.
For Page and Region Attributes:
Form Region Title - Change to Theater Information
.
Accept the other defaults and click Next.
For Input Items:
For P2_ZIPCODE and P2_RADIUS, accept the default, Yes, in the Create column.
For P2_ZIPCODE, change the Item Label default to ZIP Code
.
Click Next.
For Web Service Results:
Temporary Result Set Name (Collection) - Accept the default.
Result Tree to Report On - Select Theater (tns:Theater).
Click Next.
For Result Parameters, select all the parameters and click Finish.
Click Run Page.
If prompted to log in, enter the user name and password for your workspace and click Login.
A form and report resembling Figure: Theater Information Form and Report without Data appear. Notice that the Theater Information Form at the top of the page contains a data entry field and a submit button, but the Results Report does not contain any data.
Theater Information Form and Report without Data
To test the form, enter 43221
in the ZIP Code field and 5
in the Radius field. Then click Submit.
The report at the bottom of the page should resemble Figure: Theater Information Report Showing Resulting Data. The report lists the names and addresses of movie theaters matching the entered ZIP code and radius.
Theater Information Report Showing Resulting Data