servicemix-jsr181
ServiceMix jsr181 component is a JBI Service Engine exposing (annotated) POJO as services on the JBI Bus.
It uses xfire internally to perform service invocations and xml marshaling.
Features:
- no annotations
- jsr181 annotations
- commons-attributes annotations
- aegis binding
- jaxb2 binding
- xmlbeans binding
Installation
Installing the servicemix-http component can be done in several ways:
- drop the installer zip in an hotdeploy directory monitored by ServiceMix
- using ant tasks
Note that when using ant tasks, the component is not started, you will have to start it manually using ant tasks or a console.
Configuration
Several parameters can be configured using a JMX console.
Configuration
Name |
Type |
Description |
Default |
---|---|---|---|
printStackTraceInFaults |
boolean |
print the full stack trace in faults when an exception occurs |
false |
Deployment
You can deploy Service Units containing a file named xbean.xml for activating consumer and provider endpoints.
This xml file should respect the given syntax, though this is a spring based xml configuration file from where all beans of class Jsr181Endpoint are retrieved.
See a full example here. Note that you have to define the http namespace with
<beans xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"> ... </beans>
Any numbers of endpoints can be specified in the xbean.xml file.
As the main purpose is to expose a POJO, you will have to include the needed class files / jars in the service unit and reference them using the following tags in your xbean.xml configuration file:
<classpath> <location>.</location> </classpath>
This will add the content of the location tags (relative to the unzipped service unit) to the classpath. The previous configuration will just add the class files contained in the service unit, as if it is a plain jar.
If you want to embed jars, just use something like
<classpath> <location>lib/foo.jar</location> </classpath>
Endpoint
Endpoint attributes
Name |
Type |
Description |
Required |
---|---|---|---|
annotations |
String |
The annotations used to configure the service. Can be "none", "java5", "jsr181", "commons". If not specified, the annotations type will be discovered by looking at the class. |
no |
pojo |
Object |
the instanciated POJO to service requests |
one of pojo or pojoClass |
pojoClass |
String |
the class name of the POJO to service requests |
one of pojo or pojoClass |
serviceInterface |
String |
the class name of the interface to expose as a service |
no |
typeMapping |
String |
Can be "default", "xmlbeans", "jaxb2". Defaults to "default" (Aegis) if no annotations used, else defaults to "jaxb2" |
no |