...
For this example, let's suppose that we're creating a consumer SU. A consumer SU contains a configuration that tells the servicemix-http component to expose an endpoint via HTTP for some service that is already deployed to the JBI container. Below is the command to create the consumer SU Maven project for the servicemix-http component:
Panelcode |
---|
$ mvn archetype:create \ -DarchetypeGroupId=org.apache.servicemix.tooling \ -DarchetypeArtifactId=servicemix-http-consumer-service-unit \ -DarchetypeVersion=3.1-incubating \ -DgroupId=com.mycompany \ -DartifactId=my-consumer-su \ -DremoteRepositories=http://people.apache.org/repo/m2-incubating-repository ![]()
|
The command above utilizes the servicemix-http-consumer-service-unit Maven archetype to create a Maven project named my-consumer-su. This command creates a directory named my-consumer-su
that contains a Maven project skeleton meaning all the necessary files are in place, you simply need to enter the correct values for the configuration. Below is the directory structure created by this archetype:
Panelcode |
---|
./pom.xml ./src ./src/main ./src/main/resources ./src/main/resources/xbean.xml |
The only file that will need to be edited in this case is the src/main/resources/xbean.xml
. This is the configuration for the JBI component. By default it looks like this:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns:http="http://servicemix.apache.org/http/1.0" xmlns:replaceMe="http://servicemix.apache.org/replaceMe"> <http:endpoint service="replaceMe:withYourService" endpoint="soap" role="consumer" locationURI="http://localhost:8192/example/" defaultMep="http://www.w3.org/2004/08/wsdl/in-out" soap="true" /> </beans> |
Notice the replaceMe
namespace and the withYourService
service name. These values need to be replaced to accurately reflect your situation. You can also change the locationURI
to add a custom port or path. In addition, all of the Consumer endpoint attributes listed on the servicemix-http page are available to further customize this configuration.
Once the SU is fully configured, it must be packaged. This is easy to do because the project skeleton provides all the necessary project configuration and use of the Maven JBI plugin for you via the pom.xml
file. Simply run the following command while sitting in the my-consumer-su
directory:
Panelcode |
---|
$ mvn install |
You will need to have Maven 2.0.4 or higher installed in order to run this command. This packages up the SU and places the build artifact in the target directory.
...