Previous
Previous
 
Next
Next

Example: Creating a Web Service Reference on a RESTful Style Web Service

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:

In this example, you create a Web reference to a RESTful Web service. RESTful style Web service references are created by examining the documentation for the services and supplying that information when running the Create Web Reference wizard. You then create a form and report to interact with the service and display the results.

Topics included in this section:


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.

Create a Web Service Reference for a RESTfull Style Web Service

To create a new Web reference on a RESTful style Web service:

  1. Enter the following in your web browser to open the documentation for the Web service:

    https://developer.yahoo.com/maps/rest/V1/

  2. Follow the instructions to get an application ID.

  3. On your Application home page, click Shared Components.

  4. Under Logic, click Web Service References.

  5. Select REST and click Next.

  6. For REST Details, make these changes:

    1. Name - Enter Yahoo Map.

    2. URL - Enter the following: http://local.yahooapis.com/MapsService/V1/mapImage

    3. Accept all other defaults and click Next.

  7. For REST Inputs, make these changes:

    1. Name - Enter appid.

    2. Click Add Parameter.

    3. Name - Enter location.

    4. Click Next.

  8. For REST Outputs, make these changes:

    1. XPath to Output Parameters - Enter /Result

    2. Name - Enter URL

    3. Path - Enter /text()

  9. Click Create.

    The Create Web Service Reference Success page appears. The Web service reference for Yahoo Map is added to the Web Service References Repository.

Create a Form and Report of Web Service Results

Next, you create a page that contains a form and a report to interact with the Web service described by the Web Service Reference you created in the previous steps.

To create a form and report after creating a Web Service Reference:

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

  2. For Choose Service and Operation, make these changes:

    1. Web Service Reference - Select Yahoo Map.

    2. Operation - Select doREST.

    3. Click Next.

  3. For Page and Region Attributes, make these changes:

    1. Form Region Title - Enter Address.

    2. Report Region Title - Enter Map.

    3. Accept all other defaults and click Next.

  4. For Input Items, accept all defaults and click Next.

  5. For Report Parameters, make these changes:

    1. Select URL.

    2. Click Finish.

  6. Click Run Page.

  7. If prompted to log in, enter the username and password for your workspace and click login.

    A form and report resembling Figure: Yahoo Map Form and Report without Data appear. Notice that the Address Form at the top of the page contains data entry fields and a submit button, but the Map report does not contain any data.

    Yahoo Map Form and Report without Data

    Description of this figure follows
    Description of "Yahoo Map Form and Report without Data"

  8. To test the form, enter the following:

    1. Appid - Enter your Yahoo! application ID you requested in previous steps.

    2. Location - Enter 500 Oracle Parkway, Redwood Shores, CA 94065.

    3. Click Submit.

      The Map report displays a long URL to an image. Next you edit the Map Report region to display the image instead of the URL.

  9. On the developer bar, click Edit Page 4.

  10. On the Edit Page for page 4, in Tree View, do the following:

    1. Under Page Rendering, right click on Regions and select Expand All.

    2. Double click URL.

    3. Under Column Formatting, for HTML Expression enter:

      <img src="#URL#" />

    4. Click Apply Changes.

  11. Click Run Page.

    The map appears in the report region as shown in Figure: Yahoo Map Form and Report with Data.

    Yahoo Map Form and Report with Data

    Description of this figure follows
    Description of "Yahoo Map Form and Report with Data "