Tutorial: Your First Web Service

This tutorial provides a tour of the major features of WebLogic Workshop, a visual development environment for building web services. Through the tutorial, you build a web service called Investigate, which is designed to receive client requests for a credit report, perform the required research and calculation, and return the report. The tutorial takes a little over three hours to complete.

## Tutorial Goals

Through this tutorial, you will learn how to create and test a web service with WebLogic Workshop. Along the way, you will also learn how to create methods that expose a service's functionality, become acquainted with WebLogic Workshop's support for asynchronous communication and loose coupling, and learn about its controls to speed the design process.

## Tutorial Overview

The Investigate web service you will build with this tutorial is designed to collect credit-related information about the applicant, compute a credit worthiness score and rating, then return the combined information to the client.

There are six actors in this scenario:

- The client of your web service. Clients of Investigate are loan or credit application processing systems. An example might be a credit card application processing system at a department store. These systems will use your Investigate web service to determine the applicant's credit worthiness. They will supply you with the applicant's taxpayer ID, and your service will compute and return a credit score.

- Your Investigate web service. The service will receive a taxpayer ID as part of requests from clients and respond with information about the applicant's credit worthiness.

- A database containing bankruptcy information about the applicant.

- A credit card reporting web service with information about the applicant's credit history.

- A credit scoring application designed to calculate a credit score based on information you've collected.

- An Enterprise Java Bean (EJB) designed to provide a credit rating based on the score.

This tutorial guides you through the process of adding functionality in increments, and shows you how to test your web service as you build it.

## Steps in This Tutorial

Step 1: Begin the Investigate Web Service — 30 minutes

In this step you build and run your first WebLogic Workshop web service. You start WebLogic Workshop and WebLogic Server, then create a web service that has a single method.

Step 2: Add Support for Asynchronous Communication — 25 minutes

You will work around a problem inherent in communication across the web: the problem of network latency. Network latency refers to the time delays that often occur when transmitting data across a network.

Step 3: Add a Database Control — 20 minutes

You add a control for access to a database, then query the database for bankruptcy information.

Step 4: Add a Service Control — 15 minutes

You use a ServiceControl to invoke another web service, collecting credit card data on the applicant.

Step 5: Add a JMS and EJB Control — 20 minutes

You will take the data you have gathered and request help from an in-house application to retrieve a credit score. You will then send the credit score to an Enterprise Java Bean (EJB) that will use it to measure the applicant's credit risk.

Step 6: Add Script for Mapping — 15 minutes

You will apply an XML map to translate data stored within the Investigate service into a particular XML shape for delivery to the client.

Step 7: Add Support for Cancellation and Exception Handling — 15 minutes

You enhance the Investigate web service to better handle these possibilities such as the client's desire to cancel the request, an overly long wait for a response from the credit card service, and exceptions thrown from your service's methods.

Step 8: Client Application — 20 minutes

You will build a Java console client to invoke your web service. You also modify your web service to support a polling interface, an alternative to its current design.

Step 9: Deployment and Security — 10 minutes

You modify your web service for greater security, exposing it through HTTPS (Secure HTTP) instead of HTTP. You will also package the web service for deployment on a production server.

Summary: Your First Web Service — 15 minutes

You review the concepts and technologies covered in the tutorial. This step provides additional links for more information about each area covered.

To begin the tutorial, see Step 1: Begin the Investigate Web Service.

Click the arrow to navigate to the next step.