Java CAPS Sample Documentation


<font color="red">Working with the Oracle Java CAPS Samples for Oracle Service Bus</font>

Working with the Oracle Java CAPS Samples for Oracle Service Bus


The following procedures provide general instructions for working with the OSB sample projects and performing tasks using the Oracle Service Bus Console. Documentation for Oracle Service Bus is available at http://www.oracle.com/technetwork/middleware/service-bus/documentation/index.html.

Overview

The purpose of the sample projects provided for Oracle Service Bus and Java CAPS is to show you how to use Java CAPS web services with Oracle Service Bus. The samples include one Java CAPS project with two sub-projects, BP_server and JCD_server, that illustrate using both BPM business processes and Java Collaboration Definitions to transform and route data. They also include two Environments, one for the BPM sub-project and one for the JCD sub-project.


Installing and Configuring the Sample Projects

Samples using BPM business processes and Java Collaboration Definitions are provided on the Java CAPS Sample Code page. The ZIP file includes one project and two environments.


Installing the Sample Projects

  1. Download projWS_OSB.zip.

    This file is also available from the Java CAPS sample code site under the Oracle Service Bus tab.

  2. Extract the downloaded file into a temporary directory.

  3. Launch NetBeans.

  4. From the NetBeans toolbar, select Tools, point to CAPS Repository, and then select Import Project.

  5. On the Import Project dialog box, click Yes to proceed, or click No to save any changes to the Repository and repeat the previous step.

  6. On the Import Manager, click Browse and navigate to the temporary directory where you downloaded projWS_OSB.zip.

  7. Select the ZIP file and click Open.

    One project, projWS_OSB appears in the selected projects list. Two environments, ENV_WS_BP and ENV_WS_JCD, appears in the list of environments to import.

  8. Make sure Destination Project is set to As Top-Level.

  9. Click Import.

  10. On the confirmation dialog box that appears, click OK.

    The Repository is refreshed, the project appears in the Projects window, and the environments appear in the Services window.


Configuring and Deploying the BPM Sample

This procedure includes deploying the Java CAPS project to the GlassFish server. Before you begin, make sure the GlassFish server is running. You can start the server by right-clicking GlassFish v2.x under the Servers node in the NetBeans Services window.

  1. In the NetBeans Services window, expand CAPS Environments.

  2. Right-click ENV_WS_BP, point to Version Control, and then select Checkout. On the Version Control - Check Out window, click Check Out.

  3. Do the following to configure the server:

    1. Under ENV_WS_BP, right-click WS_Server and select Properties.

      The Properties window appears.

    2. In the navigation tree on the left, select Web Service External System Configuration.

    3. Verify the Port and Host Name for the web service server and update if needed. Click OK.

  4. Do the following to configure the client:

    1. Under ENV_WS_BP, right-click WS_Client and select Properties.

      The Properties window appears.

    2. In the navigation tree on the left, select Web Service External System Configuration.

    3. Verify the Port and Host Name and update if needed. Click OK.

      This is the host name and port number for the WebLogic server.

  5. Do the following to configure the application server:

    1. Under ENV_WS_BP, expand LogicalHost1.

    2. Right-click SunJavaSystemApplicationServer1, point to Version Control, and then select Check Out. Click Check Out on the window that appears.

    3. Right-click SunJavaSystemApplicationServer1, and select Properties.

      The Properties window appears.

    4. In the navigation tree on the left, select Sun Java System Application Server Configuration.

    5. Verify the application server URL, user name, and password, and update if needed. Click OK.

  6. On the NetBeans Projects window, right-click BP_server, point to New, and then select Deployment Profile.

  7. Enter a name for the profile, and for the Environment select ENV_WS_BP.

  8. Click OK.

  9. On the Deployment Profile Editor, click Automap.

    The connectivity components are automatically moved into the Environment containers.

  10. In the Deployment Profile Editor toolbar, click Build.

    During the build process, a dialog appears so you can export the JAR file containing the WSDL file. Navigate to where you want to store the file, enter a name for the file, and click Export.

  11. After the build is complete, click Deploy.


Configuring and Deploying the JCD Sample

This procedure includes deploying the Java CAPS project to the GlassFish server. Before you begin, make sure the GlassFish server is running. You can start the server by right-clicking GlassFish v2.x under the Servers node in the NetBeans Services window.

  1. In the NetBeans Services window, expand CAPS Environments.

  2. Right-click ENV_WS_JCD, point to Version Control, and then select Checkout. On the Version Control - Check Out window, click Check Out.

  3. Do the following to configure the server:

    1. Under ENV_WS_JCD, right-click WS_Server and select Properties.

      The Properties window appears.

    2. In the navigation tree on the left, select Web Service External System Configuration.

    3. Verify the Port and Host Name and update if needed. Click OK.

      This is the host name and port number for the GlassFish server.

  4. Do the following to configure the client:

    1. Under ENV_WS_JCD, right-click WS_Client and select Properties.

      The Properties window appears.

    2. In the navigation tree on the left, select Web Service External System Configuration.

    3. Verify the Port and Host Name and update if needed. Click OK.

      This is the host name and port number for the WebLogic server.

  5. Do the following to configure the application server:

    1. Under ENV_WS_JCD, expand LogicalHost1.

    2. Right-click SunJavaSystemApplicationServer1, point to Version Control, and then select Check Out. Click Check Out on the window that appears.

    3. Right-click SunJavaSystemApplicationServer1, and select Properties.

      The Properties window appears.

    4. In the navigation tree on the left, select Sun Java System Application Server Configuration.

    5. Verify the application server URL, user name, and password, and update if needed. Click OK.

  6. On the NetBeans Projects window, right-click JCD_server, point to New, and then select Deployment Profile.

  7. Enter a name for the profile, and for the Environment select ENV_WS_JCD.

  8. Click OK.

  9. On the Deployment Profile Editor, click Automap.

    The connectivity components are automatically moved into the Environment containers.

  10. In the Deployment Profile Editor toolbar, click Build.

    During the build process, a dialog appears so you can export the JAR file containing the WSDL file. Navigate to where you want to store the file, enter a name for the file, and click Export.

  11. After the build is complete, click Deploy.


Configuring Oracle Service Bus for the Java Collaboration Definition Sub-Project

For this procedure, you will create and test a routing scenario for the Java CAPS web services implemented by the sample JCD project you deployed earlier. Use the Oracle Service Bus Console to perform the following tasks:

Creating the Oracle Service Bus Project for the JCD Project

  1. Log in to the OSB web console.

    The default URL is http://hostname:port/sbconsole. The default port number is 7001, the default user name is weblogic, and the default password is welcome1.

  2. In the Change Center in the upper left, click Create to start a new WebLogic session.

  3. In the lower left, click Project Explorer and create a new project named CAPS_JCD_Service.

  4. In the Project Explorer, select CAPS_JCD_Service.

    The associated project page appears.

  5. Do the following to create a WSDL resource:

    1. In the Create Resource field, select WSDL.

      Create Resource drop-down menu

      The Create a New WSDL Resource page appears.

    2. For the Resource Name, enter JCDServiceWSDL.

    3. In the WSDL field, browse to and select the WSDL file generated from the JCD_server sub-project from the sample.

      Note: The WSDL file is contained in the JAR file you generated while building your project. You need to extract the WSDL file from the JAR file in order to select it here.

  6. Do the following to create a new Proxy Service:

    1. In the Create Resource field, select Proxy Service.

      The Create a Proxy Service page appears.

    2. For the Resource Name, enter JCDServiceProxy.

    3. For the Service Type, select WSDL Web Service.

    4. In the field next to WSDL Web Service, browse to and select the JCDServiceWSDL resource file from the previous step.

    5. Accept the default settings for the remaining configuration pages, and then save the changes.

  7. Do the following to create a new Business Service:

    1. In the Create Resource field, select Business Service.

      The Create a Business Service page appears.

    2. For the Resource Name, enter JCDBusinessService.

    3. For the Service Type, select WSDL Web Service.

    4. In the field next to WSDL Web Service, browse to and select the JCDServiceWSDL resource file from the previous step.

    5. Accept the default settings for the remaining configuration pages, and then save the changes.

    The project should now look similar to the following image.

    OSB project information


Configuring the Proxy Service for the JCD Project

  1. In the Project Explorer, open the CAPS_JCD_Service project, and then select the JCDServiceProxy folder.

  2. In the Actions column associated with the JCDServiceProxy proxy service, click the Edit Message Flow icon on the right side.

  3. On the Edit Message Flow window, click JCDServiceProxy, and then select Add Route from the menu that appears.

    A new Route node, RouteNode1, is added to the flow.

  4. Click RouteNode1, and select Edit Route from the menu that appears.

  5. On the Edit State Configuration window, click Add an Action. On the menu that appears, select Communication and then select Routing.

  6. Click Service, and then select JCDBusinessService from the list.

  7. Next to Route to JCDBusinessService invoking, select merge.

  8. Save your changes and then click Activate in the Change Center in the upper left.


Testing the Proxy Service for the JCD Project

  1. In the left navigation panel, click Resource Browser and then click Proxy Services.

  2. In the Actions column for JCDServiceProxy, click Launch Test Console.

  3. Enter values for the input message and click Execute.

    The service is invoked, and the response appears below the request.

    Proxy test request and response

Tips:

You can export the WSDL file for the proxy service running on OSB from the Summary of Proxy Services window.

Exporting a WSDL file from OSB

You can also retrieve the WSDL file from it's URL: http://hostname:port/CAPS_JCD_Service/JCDServiceProxy?WSDL. The default port number is 7001.

Using the proxy WSDL file, the proxy service can be invoked from any other web service client such as SOAPUI, XMLSPY, or a Java CAPS web service client.

Configuring Oracle Service Bus for the BPM Business Process Sub-Project

For this procedure, you will create and test a routing scenario for the Java CAPS web services implemented by the sample BPEL project you deployed earlier. Use the Oracle Service Bus Console to perform the following tasks:

Creating the Oracle Service Bus Project for the BPM Project

  1. Log in to the OSB web console.

    The URL is http://hostname:port/sbconsole. The default port number is 7001, the default user name is weblogic, and the default password is welcome1.

  2. In the Change Center in the upper left, click Create to start a new WebLogic session.

  3. In the lower left, click Project Explorer and create a new project named CAPS_BP_Service.

  4. In the Project Explorer, select CAPS_BP_Service.

    The associated project page appears.

  5. Do the following to create a WSDL resource:

    1. In the Create Resource field, select WSDL.

      Create Resource drop-down menu

      The Create a New WSDL Resource page appears.

    2. For the Resource Name, enter BPServiceWSDL.

    3. In the WSDL field, browse to and select the WSDL file generated from the BP_server sub-project from the sample.

      Note: The WSDL file is contained in the JAR file you generated while building your project. You need to extract the WSDL file from the JAR file in order to select it here.

  6. Do the following to create a new Proxy Service:

    1. In the Create Resource field, select Proxy Service.

      The Create a Proxy Service page appears.

    2. For the Resource Name, enter BPServiceProxy.

    3. For the Service Type, select WSDL Web Service.

    4. In the field next to WSDL Web Service, browse to and select the BPServiceWSDL resource file from the previous step.

    5. Accept the default settings for the remaining configuration pages, and then save the changes.

  7. Do the following to create a new Business Service:

    1. In the Create Resource field, select Business Service.

      The Create a Business Service page appears.

    2. For the Resource Name, enter BPBusinessService.

    3. For the Service Type, select WSDL Web Service.

    4. In the field next to WSDL Web Service, browse to and select the BPServiceWSDL resource file from the previous step.

    5. Accept the default settings for the remaining configuration pages, and then save the changes.


Configuring the Proxy Service for the BPM Project

  1. In the Project Explorer, open the CAPS_BP_Service project, and then select the BPServiceProxy folder.

  2. In the Actions column associated with the BPServiceProxy proxy service, click the Edit Message Flow icon on the right side.

  3. On the Edit Message Flow window, click BPServiceProxy, and then select Add Route from the menu that appears.

    A new Route node, RouteNode1, is added to the flow.

  4. Click RouteNode1, and select Edit Route from the menu that appears.

  5. On the Edit State Configuration window, click Add an Action. On the menu that appears, select Communication and then select Routing.

  6. Click Service, and then select BPBusinessService from the list.

  7. Next to Route to BPBusinessService invoking, select merge.

  8. Save your changes and then click Activate in the Change Center in the upper left.


Testing the Proxy Service for the BPM Project

  1. In the left navigation panel, click Resource Browser and then click Proxy Services.

  2. In the Actions column for BPServiceProxy, click Launch Test Console.

  3. Enter values for the input message and click Execute.

    The service is invoked, and the response appears below the request.

Tips:

You can export the WSDL file for the proxy service running on OSB from the Summary of Proxy Services window.

You can also retrieve the WSDL file from it's URL: http://hostname:port/CAPS_JCD_Service/JCDServiceProxy?WSDL. The default port number is 7001.

Using the proxy WSDL file, the proxy service can be invoked from any other web service client such as SOAPUI, XMLSPY, or a Java CAPS web service client.