Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview of the ServiceMix 1.x

...

WSIF Example

This document describes the components that integrate with the Apache Web Service Invocation Framework (WSIF) to perform web service invocations using a number of different implementation protocols such as Axis, local Java, EJB, JMS, JCA and CCI.

The WSIF how to run ServiceMix's BPEL example and provides details about what it does. For information on the business use case, please refer to: Use Case for BPEL.The BPEL example illustrates the following:

  • an example of declarative programming
  • how to perform BPEL integration with ServiceMix
  • how to use JmsTemplate for publishing and subscribing to ActiveMQ topics

The XML code for the BPEL example is located in the ServiceMix installation directory under the examples\bpel directory in the servicemix.xml file. It is recommended that you refer to the servicemix.xml file while reading this document.

This example has a client application, JMSClient, which sends a SOAP message to a ServiceMix binding component called myComponent. myComponent forwards the request to the PXE BPEL engine and waits for a response. In other words, JMSClient places a book order and myComponent receives the order and then sends it to the Webservice that takes orders. The client, JMSClient, and the binding component, myComponent, communicate via JMS; this communication is external to the ServiceMix JBI. myComponent and the PXE BPEL service engine communicate internally over the Normalized Message Router (NMR).

Prerequisites to Run the BPEL Example

The following must be installed to run this example:

...

Warning
titleWarning

NOTE: ServiceMix works on any Java SE 1.4 or later environment; however to use PXE a Java SE 5 or later platform is required. Before running this example, use Java 1.5 to start up ServiceMix.

  • enable a service to be exposed over a JMS queue through WSIF

The following example shows how to bind a WSDL file for a web service, which is adorned with WSIF additional metadata to configure the service implementation.

Code Block

<component id="checkAvailability" service="foo:checkAvailability" class="org.servicemix.components.wsif.WSIFBinding">
  <property name="definitionResource" value="classpath:org/servicemix/components/wsif/service.wsdl"/>
</component>

Running the BPEL Example

Before running this example, the following setup must be done. PXE has a JBI component and deployment unit, which can be auto-deployed in any JBI compliant container, in this case ServiceMix. To use PXE with ServiceMix, the PXE deployment unit must be placed in the install directory so it will be auto-deployed in ServiceMix. NOTE: The PXE deployment unit has already been placed into the install directory for you - take a look at the servicemix_install_dir\examples\bpel\install directory to see the PXE jar file.

Perform the following steps to run the BPEL example:

...

Code Block

cd [servicemix_install_dir]\examples\bpel

...

Code Block

[servicemix_install_dir]\bin\servicemix servicemix.xml

OR

..\..\bin\servicemix servicemix.xml

...

Code Block

ant

...

Stopping the BPEL Example

...


How it Works

The diagram below illustrates the logical flow of the program through the BPEL WSIF components:



Panel
borderColor#ccc
titleBPEL Logical Flow Diagram
borderStylesolid

Image RemovedImage Added



The logical flow of the program is:

  1. The JMSClient, through ActiveMQConnectionFactory, connects to the topic named "demo.org.servicemix.source" and sends a text message containing the message.soap file.
  2. myComponent, being a subscriber of the topic "demo.org.servicemix.source," receives the message.
  3. The myComponent implementation class, JmsServiceComponent, sends the message over the ServiceMix bus to the PxeBpelEngine by executing its onMessage() method. The destinationService property defines the destination of the message. NOTE: the destinationService property is found in the servicemix.xml file.
  4. PxeBpelEngine sends a response back to myComponent through the ServiceMix bus, the NMR.
  5. myComponent uses the jmsTemplate bean to publish the message.
  6. jmsTemplate uses the jmsFactory bean to get a connection to the port associated with the JMS topic called "demo.org.servicemix.source." The message is published on the "demo.org.servicemix.source" topic.
  7. JMSClient, being a subscriber of topic "demo.org.servicemix.source," receives the message.
  8. The response is printed on the console.

Logging information is written to the console as files are transmitted. Typical output looks like the following:

...

  1. A user opens a web browser and access a web form with a "zipcode" input field and a submit button. The submit button sends the form and the zipcode typed in by the user to a Servicemix HTTP binding component.
  2. The HTTP binding component creates an InOut exchange message through the client API. The message is sent through the NMR to the checkAvailability component
  3. The checkAvailability component sends the request to the JMS queue.
  4. The webservice is implemented with a message driven EJB (MDB), who's "onMessage" method is listening for messages on the queue
  5. The MDB, processes the request and sends back a response to the checkAvailability component through a temporary queue.
  6. The checkAvailability component receives the response from the queue.
  7. The checkAvailability component responds to the HTTP client.
  8. The HTTP client sends the result back to the web form. The value of the result property is displayed and let's the user know whether or not DSL is available at the zipcode.

Details

The following table provides more details about the function of each component and bean in the servicemix.xml file:

...