Example 5- Calling an Outbound Web Service using XML/JMS

This section describes:

Aims of the Example
Looking at the iProcess BANKXML Procedure
Looking at the Bank_XML Process
How to Run the Example

Aims of the Example

The aim of this example is for a BANKXML procedure on the iProcess Engine to take some customer details and send them to a Web Service on BusinessWorks. BusinessWorks then sends an account balance back to the iProcess Engine, which displays it in a form. Communications in both directions uses XML over JMS as the transport. Specifically, it does the following:

1. The iProcess Engine Procedure BANKXML prompts you to enter the customer details in a form.
2. When the form is released, the iProcess Engine sends an XML message to BusinessWorks using JMS.
3. BusinessWorks sends the hardcoded customer balance to the iProcess Engine in an XML message using JMS.
4. The iProcess Engine receives the balance information and displays it in a form.

Looking at the iProcess BANKXML Procedure

  1. In the iProcess Workspace, open the iProcess BANKXML procedure:

  1. The INPUT step contains a form in which you enter values for the two required iProcess fields, USERNAME (NAME) and USERID (ID):

  1. Open the JMSBANK iProcess Web Services step and click EAI Call-Out Definition. You can see that the step is configured to use the XML/JMS data transport mechanism (JMS target Bank), with the Asynchronous with reply Invocation Style.

Click Next.

  1. The Define the Input XSLT dialog shows the XSLT that maps the iProcess fields to the target schema.

For example:

   <ns:UserId>
      <xsl:value-of
      select="ns0:Web_Services_Tibco_Fields/ns0:Tibco_Field
      [ns  0:Name='USERID']/ns0:Value"/>
   </ns:UserId>

Click Next.

  1. The Define the Output XSLT dialog shows how balance information returned from BusinessWorks is mapped to iProcess Fields:

For example:

   <ns:Web_Services_Tibco_Fields>
         <ns:Tibco_Field>
              <ns:Name>ACCTNUM</ns:Name>
              <ns:Value>
                   <xsl:value-of
                   select="ns0:AccountBalance/ns0:AccountNumber"/>
              </ns:Value>
         </ns:Tibco_Field>
         <ns:Tibco_Field>
              <ns:Name>BALANCE</ns:Name>
              <ns:Value>
                   <xsl:value-of
                   select="ns0:AccountBalance/ns0:CheckingBalance"/>
              </ns:Value>
         </ns:Tibco_Field>
         </ns:Web_Services_Tibco_Fields>

Click Next.

  1. Note that the ACCTNUM, BALANCE, USENAME, and USERID fields are both selected for export.

Click Cancel.

  1. The OUTPUT step displays the ACCTNUM and BALANCE fields that are returned from the JMSBANK step.

Looking at the Bank_XML Process

  1. Start BusinessWorks Designer and open the Bank_XML process:

  1. Look at the JMS Queue Receiver activity. This receives the JMS message from the iProcess Engine on the Bank queue.

  2. Next, examine the Reply to JMS Message activity. This sends the XML message to the iProcess Engine with a hardcoded value for CheckingBalance. This is configured on the Input tab:

  1. The Log activity writes the username that was entered in the Input iProcess form to the BusinessWorks console log.

How to Run the Example

To run this example, do the following:

  1. Start TIBCO Designer.

  2. Start Jetty.

  3. On the Project Panel, select the Tester tab.

  4. Press F9 to display the Select Processes to Load dialog.

  5. Select Bank_XML and click Load Selected

  6. Start a case of the Bank procedure and in the form that is generated, enter a NAME and ID. Release the step.

  7. The iProcess Web Services step sends the customer information to the bank application and returns a balance. The balance is displayed in a form:

  1. Use the Case Administrator to view the audit trail. This should show the Web Services call-out and the messages associated with the processing of the case:

  1. View the console log in BusinessWorks to see that the username entered in the iProcess form is displayed.

2007 Jul 02 15:24:08:769 GMT +1 BW.WebServices_Examples Info [BW-Core] BWENGINE-300002 Engine WebServices_Examples started 
2007 Jul 02 15:24:48:628 GMT +1 BW.WebServices_Examples User [BW-User] - Job-39000 [DEMO/Bank_XML.process/Log]: username: T. Smith