|Oracle® Database 2 Day + Application Express Developer's Guide
Part Number B28839-01
Web services enable applications to interact with one another over the Web in a platform-neutral, language independent environment. In a typical Web services scenario, a business application sends a request to a service at a given URL by using the HTTP protocol. The service receives the request, processes it, and returns a response. You can incorporate calls to external Web services in applications developed in Oracle Application Express.
Web services in Oracle Application Express are based on SOAP (Simple Object Access Protocol). SOAP is a World Wide Web Consortium (W3C) standard protocol for sending and receiving requests and responses across the Internet. SOAP messages can be sent back and forth between a service provider and a service user in SOAP envelopes.
This tutorial illustrates how to call a Web service from within an Oracle Application Express application.
Topics in this section include:
Note:The SOAP 1.1 specification is a W3C note. (The W3C XML Protocol Working Group has been formed to create a standard that will supersede SOAP.)
For information about Simple Object Access Protocol (SOAP) 1.1 see:
See Also:"Implementing Web Services" in Oracle Database Application Express User's Guide
To utilize Web services in Oracle Application Express, you create a Web service reference using a wizard. Each Web service reference is based on a Web Services Description Language (WSDL) document that describes the target Web service. When you create a Web service reference, the wizard analyzes the WSDL and collects all the necessary information to create a valid SOAP message.
In a Web service reference you can locate the WSDL in the following ways:
By searching a Universal Description, Discovery, and Integration (UDDI) registry for either a service name or business name.
A UDDI registry is a directory where businesses register their Web services.
By entering the URL to the WSDL document.
In this tutorial, you create Web service references by searching a UDDI registry.
First, create a new application.
To create an application:
On the Workspace home page, click the Application Builder icon.
When the Application Builder home page appears, click Create.
For Method, accept the default, Create Application, and then click Next.
For Name, enter
Accept the remaining defaults and click Next.
Add a blank page:
For Tabs, accept the default, One Level of Tabs, and then click Next.
For Shared Components, accept the default and then click Next.
For Attributes, accept the default for Authentication Scheme, Language, and User Language Preference Derived From and click Next.
For User Interface, select Theme 2 and then click Next.
Review your selections and click Create.
The Application home page appears.
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.
To specify a proxy address:
On the Application home page, click the Edit Attributes icon.
Under Name, enter the proxy server in Proxy Server.
Click Apply Changes.
The Application home page appears.
In this exercise, you create a Web service reference by searching a UDDI registry for a service name. Then, you create a form and report for displaying market futures.
Note:The following exercise is dependent upon the availability of the specified UDDI registry as well as the Web service ultimately invoked. If the UDDI registry or Web service is unavailable, you may experience difficulties completing this exercise.
To create a new Web service by searching for a service name:
Navigate to the Application Builder home page.
Click the Web Services application.
Click Shared Components.
The Shared Components page appears.
Under Logic, select Web Service References.
The Web Service References page appears.
When prompted whether to search a UDDI registry to find a WSDL, select Yes and click Next.
For UDDI Location, select XMethods UDDI v2 and click Next.
For Search Type, select Service Name.
In Name, enter
xignite and click Search.
This is a search engine for market news.
Under Matching Services, select
A summary page appears, describing the selected Web service.
Review your selection and click Next.
The WSDL Location field displays the URL to the WSDL document.
The Web service reference, XigniteFutures, is added to the Web Service References Repository.
Next, you need to create a page that contains a form and report.
To create a form and report after creating a Web Service Reference:
On the Create Web Service Reference page, select Create Form and Report on Web Service.
For Choose Service and Operation:
For Web Service Reference, select XigniteFutures.
For Operation, select ListFuturesByExchange.
For Page and Region Attributes:
Change Form Region Title to
List Futures By Exchange.
Accept the other defaults and click Next.
For Input Items:
For P2_USERNAME, P2_PASSWORD, P2_TRACER, select No in the Create column.
For P2_EXCHANGE, accept the default Yes in the Create column.
For Web Service Results:
For Temporary Result Set Name (Collection), accept the default.
For Result Tree to Report On, select Future (tns:Future).
For Result Parameters to Display, select all the parameters and click Finish.
Click Run Page.
If a Log in page appears, enter the User Name and Password for your workspace and click Login.
A form and report resembling Figure 7-2 appear. Notice that the List Futures by Exchange Form on the top of the page contains a data entry field and a submit button, but the Results Report does not contain any data.
Figure 7-2 List Futures by Exchange Form and Report without Data
To test the form, enter
NYMEX in Exchange and click Submit.
The report at the bottom of the page should resemble Figure 7-3. The report lists the symbol, name, month, and year of futures from the New York Mercantile Exchange (NYMEX).
Figure 7-3 List Futures by Exchange Form and Report with Data