Skip Headers
Oracle® Database 2 Day + Application Express Developer's Guide
Release 2.2

Part Number B28839-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

7 How to Implement a Web Service

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:

http://www.w3.org/TR/SOAP/

See Also:

"Implementing Web Services" in Oracle Database Application Express User's Guide

About Creating Web Service References

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:

In this tutorial, you create Web service references by searching a UDDI registry.

Creating a New Application

First, create a new application.

To create an application:

  1. On the Workspace home page, click the Application Builder icon.

  2. When the Application Builder home page appears, click Create.

  3. For Method, accept the default, Create Application, and then click Next.

  4. For Name:

    1. For Name, enter Web Services.

    2. Accept the remaining defaults and click Next.

  5. Add a blank page:

    1. Under Select Page Type, accept the default, Blank, as shown in Figure 7-1.

    2. In Page Name, enter Web Services and then click Add Page.

      The new page appears in the list at the top of the page.

    3. Click Next.

  6. For Tabs, accept the default, One Level of Tabs, and then click Next.

  7. For Shared Components, accept the default and then click Next.

  8. For Attributes, accept the default for Authentication Scheme, Language, and User Language Preference Derived From and click Next.

  9. For User Interface, select Theme 2 and then click Next.

  10. Review your selections and click Create.

The Application home page appears.

Specifying an Application Proxy Server Address

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:

  1. On the Application home page, click the Edit Attributes icon.

  2. Click Definition.

  3. Under Name, enter the proxy server in Proxy Server.

  4. Click Apply Changes.

    The Application home page appears.

Searching a UDDI Registry

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:

  1. Navigate to the Application Builder home page.

  2. Click the Web Services application.

  3. Click Shared Components.

    The Shared Components page appears.

  4. Under Logic, select Web Service References.

    The Web Service References page appears.

  5. Click Create.

  6. When prompted whether to search a UDDI registry to find a WSDL, select Yes and click Next.

  7. For UDDI Location, select XMethods UDDI v2 and click Next.

  8. For Search:

    1. For Search Type, select Service Name.

    2. In Name, enter xignite and click Search.

      This is a search engine for market news.

    3. Under Matching Services, select XigniteFutures.

    4. Click Next.

    A summary page appears, describing the selected Web service.

  9. Review your selection and click Next.

    The WSDL Location field displays the URL to the WSDL document.

  10. Click Finish.

The Web service reference, XigniteFutures, is added to the Web Service References Repository.

Create a Form and Report

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:

  1. On the Create Web Service Reference page, select Create Form and Report on Web Service.

  2. For Choose Service and Operation:

    1. For Web Service Reference, select XigniteFutures.

    2. For Operation, select ListFuturesByExchange.

    3. Click Next.

  3. For Page and Region Attributes:

    1. Change Form Region Title to List Futures By Exchange.

    2. Accept the other defaults and click Next.

  4. For Input Items:

    1. For P2_USERNAME, P2_PASSWORD, P2_TRACER, select No in the Create column.

    2. For P2_EXCHANGE, accept the default Yes in the Create column.

    3. Click Next.

  5. For Web Service Results:

    1. For Temporary Result Set Name (Collection), accept the default.

    2. For Result Tree to Report On, select Future (tns:Future).

    3. Click Next.

  6. For Result Parameters to Display, select all the parameters and click Finish.

  7. Click Run Page.

  8. 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

    Description of Figure 7-2 follows
    Description of "Figure 7-2 List Futures by Exchange Form and Report without Data"

  9. 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

    Description of Figure 7-3 follows
    Description of "Figure 7-3 List Futures by Exchange Form and Report with Data"