Previous Next vertical dots separating previous/next from contents/index/pdf

Tutorial: Advanced Web Services

This tutorial demonstrates how to create a web service and insert code to access an existing control. The tutorial then demonstrates how to generate a new web service control from a WSDL and how to access that control from another control.

Note: This tutorial requests that you create a new workspace; if you already have a workspace open, this will restart the IDE. Before beginning, you might want to launch help in standalone mode to avoid an interruption the restart could cause, then locate this topic in the new browser. See Using Help in a Standalone Mode for more information.

The steps in the tutorial are:

1. Create a LoanApplication web service that calls the existing loan approval control.

2. Create a new credit scoring web service control that accesses the CreditScore web service; then modify the loan approval control to use the new credit scoring control.

Control Basics

A control is simply a Java Bean that provides standardized access to a resource or to encapsulated business logic. Controls use Java 5 metadata annotations for more convenient configuration. Workshop for WebLogic automatically generates code and annotations to create controls and access them. Workshop for WebLogic implements many types of controls. The easiest way to access a web service is to create a web service control, as this tutorial will demonstrate.

A control is implemented as annotated class and interface definitions that look something like the following (note that the annotation line precedes the class declaration line):

In the control's interface file:

@ControlInterface
public interface LoanApprovalControl
{
  // method declarations
}

In the control's implementation file:

@ControlImplementation
public class LoanApprovalControlImpl implements LoanApprovalControl
{
  // object body (methods, etc.)
}

To access a control, you declare the control like this:

@Control
private LoanApprovalControl loanApprovalControl;

The declaration causes an object to be instantiated before your code runs and the control's methods can then be called like regular object methods:

abc = loanApprovalControl.getLoanApproval(ssn, amount);

For more detailed information on controls, consult the Beehive documentation at Working with Beehive Controls. For more information on Java 5 annotation consult http://sun.com.

Related Topics

For a discussion of how to build a custom control that accesses other controls and then access that custom control through a web service refer to Tutorial: Web Service.

Click the arrow to navigate through the tutorial:

 

Skip navigation bar   Back to Top