Orchestration with JSR181
This tutorial will explain how you can leverage the servicemix-jsr181 component to orchestrate web services. We will use two public web services:
We will call them in a simple way to provide an aggregate web service which will return the weather forecast for a given city / state and expose it through as an HTTP/SOAP service.
For this tutorial, you will need a 3.1-incubating-SNAPSHOT version of ServiceMix built from sources.
Project structure, SUs and SA
In this example, we will only use two components:
- servicemix-jsr181 for the orchestration part
- servicemix-http to expose and consume services through HTTP/SOAP
Thus we will have to create two service units and a service assembly.
First, we need to create the root maven project which will hold our SUs and SA. Launch the following commands:
mkdir weather cd weather
And create a file named pom.xml
with the following content:
<project> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.servicemix.samples</groupId> <artifactId>weather</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> </project>
Then, we can use maven archetypes to create the two SUs and the SA. In the weather
directory, launch the following commands:
mvn archetype:create \ -DarchetypeGroupId=org.apache.servicemix.tooling \ -DarchetypeArtifactId=servicemix-http-consumer-service-unit \ -DarchetypeVersion=3.1-incubating-SNAPSHOT \ -DgroupId=org.apache.servicemix.samples.weather \ -DartifactId=weather-http-su mvn archetype:create \ -DarchetypeGroupId=org.apache.servicemix.tooling \ -DarchetypeArtifactId=servicemix-jsr181-wsdl-first-service-unit \ -DarchetypeVersion=3.1-incubating-SNAPSHOT \ -DgroupId=org.apache.servicemix.samples.weather \ -DartifactId=bridge-http-su mvn archetype:create \ -DarchetypeGroupId=org.apache.servicemix.tooling \ -DarchetypeArtifactId=servicemix-service-assembly \ -DarchetypeVersion=3.1-incubating-SNAPSHOT \ -DgroupId=org.apache.servicemix.samples.weather \ -DartifactId=weather-sa
This will create the following directory structure:
bridge\ pom.xml weather-http-su\ ... weather-jsr181-su\ ... weather-sa\ ...