Skip Headers
Oracle® HTML DB 2 Day Developer
Release 1.6

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

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

6 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 HTML DB.

Web services in Oracle HTML DB are based on SOAP (the 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 HTML DB 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 more information on Simple Object Access Protocol (SOAP) 1.1 see:

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

About Creating Web Service References

To utilize Web services in Oracle HTML DB, 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.

When you create a Web service reference you need to decide how to locate the WSDL. You can locate a WSDL two ways:

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

Creating a New Application

First, create a new application.

To create an application:

  1. From the Application Builder home page, click Create Application.

  2. On Select Creation Method, select From Scratch and click Next.

  3. On Create Application:

    1. For Name, enter Web Services.

    2. From Pages, select 1.

    3. Click Next.

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

  5. For Page Names, enter Web Services and click Next.

  6. For Page Tab Name, enter Web Services and click Next.

  7. On Theme, select Theme 2 and click Next.

  8. Review your selections and click Create Application.

The Application Builder 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 for an application:

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

  2. Under Application Definition, enter the proxy server in Proxy Server.

  3. Click Apply Changes.

Searching a UDDI Registry for a Business Name

In this exercise you create a form which displays stock quotes based on a stock symbol you provide. You will create a Web service reference by searching the UDDI registry for a business name:

To create a Web service reference by search for a business name:

  1. Navigate to the Application Builder home page.

  2. Click Shared Components.

  3. Under Logic, select Web Service References.

    The Web Service References page appears.

  4. Click Create.

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

  6. For UDDI Location, select IBM UDDI and click Next.

  7. On Search for Services:

    1. For Search Type, select Business Name.

    2. In Name, enter:

      %xMethods%
      
      
    3. Click Search.

    4. Under Matching Services, select xMethods Delayed Stock Quotes.

    5. Click Next.

    A summary page appears describing the selected Web service.

  8. Review your selection and click Next to continue.

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

  9. Click Finish.

Create a Form to Display a Stock Quote

Next, you will create a form to display a stock quote based on the stock symbol you provide.

To create a form after creating a Web Service Reference:

  1. On Web Service Reference Added page, select Create Form on Web Service.

  2. On Web Service Reference and Operation:

    1. For Web Service Reference, select XMethods Delayed Stock Quotes.

    2. For Operation, select getQuote.

    3. Click Next.

  3. For Identify Page and Region Attributes accept the defaults and click Next.

    1. In Region Title, enter Get Stock Quote.

    2. Accept the other defaults.

    3. Click Next.

  4. For Items for Input Parameters, accept the defaults and click Next.

  5. For Items for Output Parameters:

    1. For Item Label, enter Stock Price.

    2. Accept the other defaults.

    3. Click Finish.

  6. Click Run Page to view the form.

  7. On the Log in page, enter the User Name and Password for your workspace and click Login.

    A form resembling Figure 6-1 appears.

    Figure 6-1 Get Stock Quote Form

    Description of web_stock.gif follows
    Description of the illustration web_stock.gif

  8. Test the form. In Symbol, enter a stock symbol (such as ORCL) and click Submit.

    The associated stock price displays in the Stock Price field.

  9. Select Edit Application from the Developer toolbar to return to the Application Builder home page.

Searching a UDDI Registry for a Service Name

Next, you will create a form that displays market futures. In this exercise you will create a Web service reference by search a UDDI registry for a service name. Then, you will create a form and report.

To create a new Web service by searching for a service name:

  1. Navigate to the Application Builder home page.

  2. Click Shared Components.

    The Shared Components page appears.

  3. Under Logic, select Web Service References.

    The Web Service References page appears.

  4. Click Create.

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

  6. For UDDI Location, select XMethods UDDI and click Next.

  7. On Search for Services:

    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.

  8. Review your selection and click Next to continue.

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

  9. 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 Web Service Reference Added page, select Create Form and Report on Web Service.

  2. On Web Service Reference and Operation:

    1. For Web Service Reference, select XigniteFutures.

    2. For Operation, select ListFuturesByExchange.

    3. Click Next.

  3. On Identify Page and Region Attributes:

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

    2. Accept the other defaults and click Next.

  4. For Items for Input Parameters:

    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. On Base Node:

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

    2. 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 to view the form.

  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 6-2 appears. 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 6-2 List Futures by Exchange Form and Report without Data

    Description of web_name.gif follows
    Description of the illustration web_name.gif

  9. Test the form. In Exchange, enter NYMEX and click Submit.

    The report at the bottom of the page should resemble Figure 6-3. The report lists the symbol, name, month, and year of futures from the New York Mercantile Exchange (NYMEX).

    Figure 6-3 List Futures by Exchange Form and Report with Data

    Description of web_name_2.gif follows
    Description of the illustration web_name_2.gif