LibraryLink ToToggle FramesPrintFeedback

Chapter 4. Creating a Service Unit to Deploy a Service

All endpoints deployed into FUSE ESB must be packaged in a JBI service unit. The service unit configures the FUSE Services Framework service engine to load the jars that implements your service. It also determines if the service can handle MTOM attachments.

A service unit that configures the FUSE Services Framework service engine will contain at least three things:

The service unit may also contain a WSDL document describing the service.

The elements used to configure FUSE Services Framework service engine endpoints are defined in the http://servicemix.apache.org/cxfse/1.0 namespace. You will need to add a namespace declaration similar to the one in Example 4.2 to your xbeans.xml file's beans element.


The configuration that tells the service engine to load a service's implementation and expose it as an endpoint is specified in the service unit's xbean.xml file. It will contain one endpoint element for each service implementation being exposed.

The endpoint element requires the use of the pojo attribute. The pojo attribute's value is a reference to a bean element configuring the service's implementation class. Example 4.3 shows a simple FUSE Services Framework configuration.


[Note]Note

You can also configure the endpoint's implementation class using a pojo child element. The pojo element wraps the bean element configuring the service's implementation class.

By default, the service, endpoint, and interface names are determined from the service implementation. The endpoint element also has optional attributes that allow you to override the determined names. Table 4.1 describe these attributes.


There are instances when a JBI component cannot consume a native SOAP message. For instance, SOAP headers pose difficulty for JBI components. The JBI specification defines a JBI wrapper that can be used to make SOAP messages, or any message defined in WSDL 1.1, conform to the expectations of a JBI component.

By default FUSE Services Framework endpoints are configured to expect all messages to include the JBI wrapper. If you are sure your endpoint will not receive messages using the JBI wrapper you can set its useJbiWrapper attribute to false.

Example 4.4 shows a configuration fragment for configuring an endpoint that does not process the JBI wrapper.


You can include the implementation of your service in one of two ways: plain class files or bundled into jar files.

If you chose to use class files, the root folder of your hierarchy is the root of the exploded service unit. All of the class files must be placed into a folder hierarchy that matches the package structure of your code. For example the class file for the class com.widgetVendor.demo.GreenWidgetServiceImpl would be stored in /com/widgetVendor/demo/GreenWidgetServiceImpl.class.

If you chose to use jar files, you will need to add the jars to the classpath used by the service unit. This is done by adding a classpath element to the service unit's configuration file. The classpath element contains one or more location elements. The location elements specify the jars to be added to the classpath. Example 4.5 shows an example that adds foo/lib.jar to the service unit's classpath.