Samples Tutorial

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Accessing Data Services Through Web Services

A Data Service Control can be used to access data through a page flow, Web service, or business logic. In the previous lesson, you created a Data Service Control and used it within a Web application's page flow. In this lesson, you will use that same Data Service Control to generate a .wsdl for a Web service that can invoke data service functions.

 


Objectives

After completing this lesson, you will be able to:

 


Overview

A Web service is a set of functions packaged into a single entity that is available to other systems on a network. The network can be a corporate intranet or the Internet. Other systems can call these functions to request data or perform an operation.

Web services are a useful way to provide data to an array of consumers over the Internet, like stock quotes and weather reports. But they take on a new power in the enterprise, where they offer a flexible solution for integrating distributed systems, whether legacy systems or new technology.

 


9.1 Generating a Web Service from a Data Service Control

In the previous lesson, you created a Data Service Control, which enabled WebLogic Workshop to generate a Java Control Extension (.jcx) file. This file contains the underlying data service's method calls. In this exercise, you will use that Data Service Control to generate a Web service.

Objectives

In this exercise, you will:

Instructions

  1. Expand the CustomerManagementWebApp and controls folders.
  2. Right-click the CustomerData.jcx control.
  3. Choose Generate Test JWS (Stateless). A new file, CustomerDataTest.jws, is generated. With this Java Web Service (.jws) file, the Data Service Control methods are now available through a Web service interface.
  4. Figure 9-1 Java Web Service File


    Java Web Service File

  5. Open the CustomerDataTest.jws file in Source View.
  6. Click the Start icon (or press Ctrl+F5). Workshop Test Browser opens.
  7. Enter CUSTOMER3 in the string CUSTOMER ID field.
  8. Figure 9-2 Workshop Test Browser: Web Service


    Workshop Test Browser: Web Service

  9. Click getCustomerProfile. The customer profile and order information for Customer 3 is retrieved.
  10. View both the "Returned from" and "Service Response" results, which should be similar to that displayed in Figure 9-3.
  11. Figure 9-3 Web Service Test Results


    Web Service Test Results

  12. Close Workshop Test Browser.

 


9.2 Using a Data Service Control to Generate a WSDL for a Web Service

You can use the Java Web Service file to generate a WSDL. A WSDL file contains all of the information necessary for a client to invoke the methods of a Web service:

Objectives

In this exercise, you will:

Instructions

  1. Right-click the CustomerDataTest.jws control.
  2. Choose Generate WSDL File. The CustomerDataTestContract.wsdl is generated, which can be used by other Web service clients.
  3. Figure 9-4 New WSDL File


    New WSDL File

  4. (Optional) Open the CustomerDataTestContract.wsdl file and explore the document structure and source code.
  5. Figure 9-5 Document Structure


    Document Structure

 


Lesson Summary

In this lesson, you learned how to:


  Back to Top       Previous  Next