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

Advanced Web Services Tutorial: Step 1: Import the Tutorial Workspace

In this step, you will import an existing set of projects that contains the initial components of your application.

The tasks in this step are:

To Start Workshop and Create the Tutorial Workspace

If you haven't started Workshop for WebLogic yet, use these steps to do so

...on Microsoft Windows

If you are using a Windows operating system, follow these instructions.

  1. From the Start menu, click Programs > BEA Products > Workshop for WebLogic Platform 10.0
  2. When prompted for the name of your workspace, click the Browse button and create a new (empty) workspace for this tutorial.
  3. When the Workshop for WebLogic window opens, check that you are in the J2EE perspective (indicated just below the toolbar at the top of the window. If you are not in J2EE perspective, set that perspective by clicking Window > Open Perspective > Other, then selecting J2EE and clicking OK.
  4. If the Package Explorer is not displayed, display it by clicking File > Show View > Other, then selecting Java > Package Explorer and clicking OK.

...on Linux

If you are using a Linux operating system, follow these instructions.

To Import the Tutorial Projects into Your Workspace

Workshop for WebLogic keeps track internally of the project structure within a workspace. Simply copying folders into the workspace directory does not cause them to appear as projects inside Workshop for WebLogic. The tutorial projects are stored in a ZIP archive file. There is no need to unzip the files, the IDE will import the ZIP file directly.

To import these projects and their files:

  1. Click File > Import.
  2. In the Import dialog, expand General, click Existing Projects into Workspace, then click Next.

  3. Select the Select archive file option, then click that option's Browse button.

  4. Navigate to the location of the tutorial sample files, packaged as a ZIP file. This should be:
  5. BEA_HOME/workshop_10.0/ workshop4WP/eclipse/plugins/com.bea.workshop.product.wl.samples_1.0.0/tutorials/resources/AdvancedWSTutorial/

  6. Click Open.

  7. Click Finish to continue. The import process will take few moments, because several projects and their contents must be imported.

To Review the Contents of Your Workspace

The import process brought two applications into your workspace:

The LoanApprovalEAR application contains the project LoanApp. That project contains controls to provide loan approvals. Inside of the LoanApp project, there are two controls (inside LoanApp/src/controls/):

Inspect the code for these controls by double clicking on their names in the src folder of the LoanApp project. The source will appear in the editor window.

Note the simple logic used for loan approval: if the person (identified by SSN) does not have a loan in the database, return true (approval) and store the SSN and loan amount. If the person already has a loan, return false (decline).

You cannot test the code for the control yet because there is no web service or page flow that instantiates and invokes it.

The CreditScoreEAR application contains the single project CreditScoreWS. Open the web service at CreditScoreWS/src/services/ by double-clicking on the Java file.

When you open a web service in Workshop for WebLogic, it is displayed in Design View by default. Design View gives a graphical view of a web service. The Design View for the web service shows that it has a single method called getCreditScore.

Click the link text Source View at the bottom of Design View to view the source code for the web service.

The getCreditScore method checks credit ratings for the individual, based on their Social Security Number (SSN), the most common identification number used in the United States. The SSN is a 9-digit number. The credit scoring system used in this example assigns a 3-digit valuation to individuals where higher values are better (for example, 700 is a good credit rating and 500 is not as good).

Test the Web Service

  1. If this is your second time through the tutorial, you should remove previous versions of the CreditScoreEAR and LoanApprovalEAR projects from the server before deploying the current versions. For instructions on removing previous deployed projects see Adding and Removing Projects from the Server.
  2. Test the web service by right-clicking on the file name in the Package Explorer view and clicking Run As > Run on Server.

  3. Click Next.

  4. In the Run On Server dialog, in the Domain home dropdown, select the default samples domain (BEA_HOME/wlserver_10.0/samples/domains/workshop).

  5. Click Finish. Wait for the server to start and the application to deploy.

    A window will open displaying the Test Client, a special application that allows you to interact with your web service.

  6. You can enter values into the ssn parameter field and click on the getCreditScore button to send a value to the web service and get a response. For example, entering the value 123456789 returns a credit score of 500 as shown below.

Click one of the following arrows to navigate through the tutorial:


Skip navigation bar   Back to Top