Wednesday, July 18, 2012

Oracle SOA Suite - BPEL to JMS JDeveloper Project


Sharing my quick notes on steps to create and test a JMS Project. Thought it might be useful for someone who is starting on Oracle SOA Product, part of Fusion Middle-ware. We will create a synchronous bpel process that exposes soap endpoint and then writes (invoke) the input message to a queue in the middle of business process and echoes the input message back the client using reply activity.
We will use Oracle JDeveloper and Weblogic server for the runtime. Before we create the process in jdeveloper, we will first configure the JMS Queue in Weblogic server. Here are the steps.
  1. Create JMS Queue and ConnectionFactory 

    1. Start Weblogic server and log on to the console (http://localhost:7001/console/) 
    2. In the Domain Structure tree on left, expand Service then click ‘JMS Modules’ (Figure 1) 
    3. Click SOAJMSModule (for development purposes, you can also create a new Module also) and then click ‘New’ button. 
    4. On the opened page, select ‘Queue’ radio button and click ‘Next’ 
    5. Specify queue name (say queueout) and JNDI Name (say, jms/queuein) and click ‘Next’ 
    6. Optional – for Sub-deployment, select ‘SOA Subdeployment’ and target keep the default. Click ‘Finish’ (Figure 2) 
    7. Follow above steps and create Connection Factory (select Connection Factory for step d and specify jndi name, say jms/jmstest-cf) 
  2. Create Connection Pool 

    1. Click ‘Deployments’ from the Domain Structure and then click JmsAdapter (Figure 3) 
    2. Select ‘Configuration’ tab and ‘Outbound’ sub-tab and then click ‘New’ (Figure 4) 
    3. Select existing ‘oracle.tip.adapter.jms.IJmsConnectionFactory’ radio button and click ‘Next’ (Figure 5) 
    4. Specify JNDI Name, say jmstest/jmstest-cp and click ‘Finish’. 
    5. Expand ‘oracle.tip.adapter.jms.IJmsConnectionFactory’ to verify and configure the newly created connection pool. 
    6. Click the Property Value column for ConnectionFactoryLocation row and enter the connection factory value. Press enter to accept the value. Click ‘Save’ to save the value. (Figure 6) 
  3. Create JDev Project 

    1. Open JDev and create a SOA Project. Select ‘Composite with BPEL Process’ Option. 
    2. For BPEL Process, select Synchronous Project. 
    3. Double click the composite and drag and drop JMS Adapter to the right swim lane (External Reference) 
    4. Configure the JMS Wizard – enter name, select Oracle Weblogic JMS, specify app server connection, specify operation type (Produce Message, in our case), browse the queue and specify the connection factory jndi. (Figure 7) 
    5. For the Step 8 of JMS Adapter Configration wizard, click the browse button to point to the xsd for the schema for the message to the queue (Figure 8).
    6. Upon completion of wizard, you will see JMS Outbound reference on composite. Also, JCA configuration file (_jms.jca) will with adapter configuration will be created.
    7. Connection the BPEL Process to the outbound reference created in above step. (Figure 9).
    8. Go to BPEL Process and drop assign, invoke and another assign activity between receive and reply activity. Double click invoke and browse partnerlink and pick the outbound_jms partnerlink. Create new variable for the invoke activity. Configure the first assign to copy the input to invoke variable. Also configure the second assign to copy the input to output variable.
    9. Build and deploy the application.
  4. Testing the Application 

    1. Open the Enterprise Manager (http://localhost:7001/em) 
    2. Expand SOA Node from left tree and click the deployed project. On the main page click ‘Tab’  
    3. Enter input message and click ‘Test Web Service’ (Figure 10). Click respose tab to verify the response. 
    4. To view the message to the queue, go back to the weblogic console ((http://localhost:7001/console/). Navigate to Services -> Messaging -> JMS Modules -> SOAJMSModule -> queueout. Click on Monitoring tab and select the queue and press ‘Show Messages’.


Figure 1
 Figure 2
 Figure 3
 Figure 4
 Figure 5
 Figure 6
 Figure 7
 Figure 8
 Figure 9
Figure 10

No comments: