Java CAPS Sample Documentation


<font color="red">Working with the Oracle Java CAPS JBI Samples for Oracle SOA Suite</font>

Working with the Oracle Java CAPS JBI Samples for Oracle SOA Suite


The following procedures provide general instructions for working with the Oracle SOA Suite sample projects and performing tasks using Oracle JDeveloper. For more detailed instructions on using JDeveloper, see the Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite.

Note that all procedures in this document are based on Java CAPS 6.3 and Oracle SOA Suite 11.1.1.4. Some steps might vary if you are using an earlier version of Oracle SOA Suite.

Overview

The purpose of the sample projects provided for Oracle SOA Suite and Java CAPS JBI is to illustrate how to call Oracle SOA Suite web services from a Java CAPS JBI project. The sample includes the following projects:

  1. OFMHelloService - A SOA Suite project that generates a web service

  2. JBIServiceCallingSOA - A Java CAPS project that uses the BPEL Service Engine to call the web service

  3. JBIServiceCallingSOAComposite - A JBI Composite Application project for the BPEL project.

This tutorial takes you through the steps of creating and deploying all of the above projects. The sample download file also includes a second set of sample projects in OFMSOACallingJbi.zip (OFMSOACallingJBIService, JbiBpelService, and JbiBpelServiceCA), that illustrate how to call a Java CAPS JBI web service from a SOA Suite project. These projects are not covered in this tutorial.

This tutorial covers the following procedures:

You can also simply install the sample projects, modify the WSDL and BPEL files with the correct target namespaces and web service URLs, and then deploy the projects. You can download the sample projects from JBI_SOA.zip.


Creating the Oracle SOA Suite Server Project

  1. Launch Oracle JDeveloper.

  2. From the Application menu, select New.

    The Create Project wizard appears.

  3. On the Name Your Application page, enter OFMHelloService for the name, and specify the directory to store the project in (or accept the default).

    Name Your Application

  4. Click Next.

    The Name Your Project page appears.

  5. Enter HelloService for the name.

    Name Your Project

  6. Click Next.

    The Configure SOA Settings page appears.

  7. Select Empty Composite, and then click Finish.

    A file named composite.xml is automatically opened in the JDeveloper canvas.


Adding and Configuring the Oracle SOA Suite BPEL Process

  1. With composite.xml from the previous procedure open, drag a BPEL Process from the Components Palette to the Components section of the canvas.

    The Create BPEL Process wizard appears.

  2. Name the process HelloProcess, select BPEL 2.0 Specification, and change the Template field to Synchronous BPEL Process.

    Create BPEL Process wizard

  3. Click OK.

    The BPEL process and service appear on the Composite canvas.

  4. Double-click BPELProcess1 in the Components section of the canvas.

    The BPEL process opens in the BPEL Designer.

  5. From the Component Palette, drag an Assign activity to the BPEL Designer between the receiveInput and replyOutput activities.

    BPEL Process with Assign activity

  6. Double-click the new Assign activity.

    The Edit Assign window appears with the Copy Rules tab visible.

  7. In the tree on the left side, expand Variables > Process > Variables > inputVariable > payload > client:process.

    The client:input node should be visible.

  8. In the tree on the right side, expand Variables > Process > Variables > outputVariable > payload> client:processResponse.

    The client:result node should be visible.

  9. Drag a link between the client:input node and the client:result node.

  10. In the BPELProcess1 tree on the left side, expand Invoke_1_merge_OutputVariable > Body.

    The ns3:MergeName node should be visible.

  11. In the BPELProcess1 tree on the right side, expand outputVariable > payload.

    The ns3:MergeName node should be visible.

  12. Drag a link between the Invoke output ns3:MergeName node and the BPEL output ns3:MergeName node.

  13. Click OK.

  14. Save the Project.


Deploying and Testing the Oracle SOA Suite Server Project

This process deploys the BPEL Project to the WebLogic server. Before you begin, make sure your WebLogic server is running and that your JDeveloper instance is connected to the server.

  1. Right-click the HelloService Project and select Deploy > HelloService.

    A deployment wizard appears.

  2. Select Deploy to Application Server, and then click Next.

  3. Accept the default deployment configuration and click Next.

    The Select Server page appears.

  4. Select the application server to which to deploy the project, and then click Next.

    The SOA Servers page appears.

    Note: If there are no application server connections defined, you can add a connection to your server by clicking the plus sign above the application server list.

  5. Select the SOA Server to which to deploy, select the partition name, and then click Next.

  6. Review the details on the Summary page, and then click Finish.

  7. If prompted, enter the user name and password.

  8. Once the project is deployed, you can test the project from Oracle Enterprise Manager. To access the test page, go to the HelloService project in the soa-infra tree and click Test. In the image below, the text entered for the input value is "Test".

    Testing the HelloService project


Creating and Configuring the Java CAPS BPEL Client Project

Creating and configuring the client project includes the following steps:

Creating the Java CAPS BPEL Client Project

  1. Launch the Java CAPS NetBeans IDE.

  2. Right-click in the Projects window, and select New Project.

    The New Project Wizard appears.

  3. Under Categories, expand CAPS and select ESB.

  4. Under Projects, select BPEL Module and then click Next.

    The Name and Location window appears.

  5. For the project name, enter JBIServiceCallingSOA, and then click Finish.

    The project framework is generated, and the BPEL process appears in the BPEL Editor.


Importing the WSDL File and Schema Definition From the HelloService Project

  1. In the Netbeans Projects window, right-click the Process Files folder in the JBIServiceCallingSOA project, point to New, and then select Other.

    The New File Wizard appears.

  2. Under Categories, select XML; under File Types, select External WSDL Document(s).

  3. Click Next.

    The Specify Resource Location window appears.

  4. Either enter the URL for the WSDL, or select From Local File System to browse to and select the WSDL file on your local machine.

    The URL for the WSDL file should be similar to http://hostname:port/soa-infra/services/default/Helloservice/helloprocess_client_ed?WSDL.

    Importing the HelloService WSDL file

  5. Click Finish.

    The folder structure of the WSDL and XSD files should be created in the JBIServiceCallingSOA project. If you do not see the folder structure, right-click the project and select Build.

    Note: If you had selected BPEL 1.1 Specification when you created the SOA Suite business process instead of BPEL 2.0 Specification, you would need to modify the WSDL file after you import it. For more information, see the Oracle Java CAPS BPEL Service Engine User's Guide.


Creating the Trigger WSDL File

  1. In the NetBeans Projects window, right-click JBIServiceCallingSOA, point to New, and then select Other.

    The New File Wizard appears.

  2. Under Categories, select XML; under File Types, select XML Document.

  3. Click Next.

    The Name and Location window appears.

  4. For the file name, enter TriggerWS, and then click Finish.

    The XSD file appears in the Project tree, and the file is opened in the XML Editor.

  5. Using the Schema view, create a complex type named InputMsg and create an element named inElem of that type.

  6. Create a complex type named OutputMsg and create an element named outElem of that type.

    The XSD file should look like the following. You can also copy and paste this text into your XSD file instead of manually creating the elements.

    		<?xml version="1.0" encoding="UTF-8"?>
    
    		<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    		    targetNamespace="http://xml.netbeans.org/schema/TriggerWS"
    		    xmlns:tns="http://xml.netbeans.org/schema/TriggerWS"
    		    elementFormDefault="qualified">
    		    <xsd:complexType name="InputMsg">
    		        <xsd:sequence>
    		            <xsd:element name="input" type="xsd:string"></xsd:element>
    		        </xsd:sequence>
    		    </xsd:complexType>
    		    <xsd:complexType name="OutputMsg">
    		        <xsd:sequence>
    		            <xsd:element name="output" type="xsd:string"></xsd:element>
    		        </xsd:sequence>
    		    </xsd:complexType>
    		    <xsd:element name="inElem" type="tns:InputMsg"></xsd:element>
    		    <xsd:element name="outElem" type="tns:OutputMsg"></xsd:element>
    		</xsd:schema>
    		
  7. In the NetBeans Projects window, right-click JBIServiceCallingSOA, point to New, and then select WSDL Document.

    The New WSDL Document Wizard appears.

  8. Enter TriggerWS for the name and change "newWSDL" in the Target Namespace to "TriggerWS".

  9. Select Concrete WSDL Document.

  10. In the Binding field that appears, select SOAP.

  11. In the Type field, select Document Literal.

    Creating the Trigger WSDL file

  12. Click Next.

    The Abstract Configuration window appears.

  13. In the Input box, click the ellipsis button next to part1 under Element or Type.

  14. On the Select Element or Type dialog box, expand By File > JBIServiceCallingSOA > src/TriggerWS.xsd > Elements, and select inElem.

  15. Repeat the previous two steps for part1 in the Output box, selecting outElem for the type.

    Trigger WSDL file abstract configuration

  16. Click Next.

    The Concrete Configuration window appears.

  17. Accept the default values and then click Finish.

    The WSDL document appears in the project tree and is opened in the WSDL Editor.


Creating the Java CAPS Business Process

  1. If it is not already open in the BPEL Editor, double click JBIServiceCallingSOA.bpel.

  2. Do the following to add and configure the trigger partner link:

    1. Drag TriggerWS.wsdl from the project tree to the left side of the canvas and drop it in the orange circle.

    2. Double click the partner link box that appears.

      The Partner Link Property Editor appears.

    3. Accept the default values and click OK.

  3. Do the following to add and configure the HelloProcess partner link:

    1. Drag helloprocess_client_ep.wsdl from the project tree to the right side of the canvas and drop it in the orange circle.

      This is the WSDL file that was generated by the SOA Suite project and that you imported into this project earlier.

    2. Double click the parter link box that appears.

      The Partner Link Property Editor appears.

    3. Accept the default name and WSDL file, and select Use a Newly Created Partner Link Type.

    4. In the Partner Link Type Name field, enter HelloProcessLinkType.

    5. Select Partner Service Will Implement (Partner Role).

    6. In the Role Name field, enter HelloProcessRole.

    7. Accept the default Port Type value of HelloProcess, and click OK.

  4. From the BPEL Palette, drag the following activities to the canvas in the order given: Receive, Assign, Invoke, Assign, and Reply.

    The process should look similar to the following:

    Java CAPS BPEL Process with activities

  5. Do the following to configure the Receive activity:

    1. Double click the Receive1 activity.

      The Property Editor appears.

    2. In the Partner Link field, select PartnerLink1.

    3. Next to the Input Variable field, select Create. Accept the default values on the New Input Variable dialog box, and click OK.

      Receive activity configuration

    4. Click OK on the Property Editor.

  6. Do the following to configure the Invoke activity:

    1. Double click the Invoke1 activity.

      The Property Editor appears.

    2. In the Partner Link field, select PartnerLink2.

    3. Next to the Input Variable field, select Create. Accept the default values on the New Input Variable dialog box, and click OK.

    4. Next to the Output Variable field, select Create. Accept the default values on the New Output Variable dialog box, and click OK.

      Invoke activity configuration

    5. Click OK on the Property Editor.

  7. Do the following to configure the first Assign activity:

    1. Double click the Assign1 activity.

      The Mapper appears.

    2. In the left variables tree, expand Variables > TriggerWSOperationIn > part1.

    3. In the right variables tree, expand Variables > ProcessIn > payload.

    4. Map the input on the left to the input on the right by dragging a connection between the two fields as show in the following image.

      Assign activity configuration

    5. Save the changes, and click Design to return to the BPEL Editor.

  8. Do the following to configure the Reply activity:

    1. Double click the Reply1 activity.

      The Property Editor appears.

    2. In the Partner Link field, select PartnerLink1.

    3. Select Normal Response, and click Create next to the Output Variable field.

    4. On the New Output Variable dialog box, accept the default values and click OK.

      Assign activity configuration

    5. Click OK on the Property Editor.

  9. Do the following to configure the second Assign activity:

    1. Double click the Assign2 activity.

      The Mapper appears.

    2. In the left variables tree, expand Variables > ProcessOut > payload.

    3. In the right variables tree, expand Variables > TriggerWSOperationOut > part1.

    4. Map the result on the left to the output on the right by dragging a connection between the two fields as show in the following image.

      Assign activity configuration

    5. Save all changes, and click Design to return to the BPEL Editor.

      The business process should look like the following image.

      Final Business Process

  10. In the NetBeans Projects window, right-click JBIServiceCallingSOA and select Clean and Build.


Deploying the Java CAPS BPEL Client Project

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. Right-click in the Netbeans Projects window, and select New Project.

    The New File Project appears.

  2. Under Categories, expand CAPS and select ESB; under Projects, select Composite Application.

  3. Click Next.

    The Name and Location window appears.

  4. Name the project JBIServiceCallingSOAComposite and click Finish.

    The Service Assembly appears in the CASA Editor.

  5. From the NetBeans Projects window, drag the project JBIServiceCallingSOA to the CASA Editor under JBI Modules.

  6. In the CASA Editor toolbar, click Build Project.

    The project builds and the WSDL ports appear in the Service Assembly.

    Built Composite Application

  7. In the CASA Editor toolbar, click Deploy Project.

    Note: If the target server has not been set, a dialog box appears where you can select the GlassFish server to which the application will be deployed.


Testing the Java CAPS BPEL Client Project

You can test the project using the NetBeans test framework. The test will access the web service deployed on the WebLogic server. Make sure the WebLogic server that you deployed the Oracle SOA Suite project to earlier is running and accessible.

  1. In the NetBeans Projects window, right-click the Test node under JBIServerCallingSOAComposite, and select New Test Case.

    The New Test Case Wizard appears.

  2. Enter a name for the test case, and then click Next.

    The Select the WSDL Document window appears.

  3. Expand JBIServiceCallingSOA - Process Files, and select TriggerWS.wsdl.

    New Test Case Wizard, Select the WSDL Doc ument page

  4. Click Next.

    The Select the Operation to Test window appears.

  5. Select TriggerWSOperation, and click Finish.

    The test case input file appears in the XML Editor.

  6. In the input file, replace ?string? with any text for the test input.

  7. In the NetBeans Projects window, right-click the test case you created, and select Run.

    The test case runs and generates an output file. The output element should contain the same text you entered for the input. You might receive a status of Failed the first time you run the test because there is no existing output file to compare the results against. This is expected, and the test should pass if you save the output and run the test again.