ServiceMix ships with a JBI compliant HTTP/SOAP or JMS/SOAP binding component named servicemix-cxf-bc which use Apache CXF internally.
Here are the main features:
This archetype creates a CXF BC Service Unit, including consumer and provider sample:
mvn archetype:create \ -DarchetypeGroupId=org.apache.servicemix.tooling \ -DarchetypeArtifactId=servicemix-cxf-bc-service-unit -DarchetypeVersion=2010.01 \ -DgroupId=your.group.id \ -DartifactId=your.artifact.id \ -Dversion=your-version |
Once you've customized the service unit, simply install the SU:
mvn install |
|
Remember that to be deployable in ServiceMix, the ServiceUnit has to be embedded in a Service Assembly: only the Service Assembly zip file can be deployed in ServiceMix.
|
A consumer endpoint is a server-side CXF endpoint that will consume plain HTTP+SOAP requests and send them into the NMR to a given JBI endpoint, which is called the proxied endpoint.
Following is an example of an HTTP consumer endpoint:
<cxfbc:consumer wsdl="/wsdl/calculator.wsdl"
service="calculator:CalculatorService"
endpoint="CalculatorPort"
targetEndpoint="CalculatorPortProxy"
targetService="calculator:CalculatorService"
targetInterface="calculator:CalculatorPortType">
</cxfbc:consumer>
|
|
The targetService, targetEndpoint and targetInterfaceName attributes can be used to specify the routing method to use (routing by interface, service or endpoint) and is also useful to allow several proxy endpoints to be created for the same JBI endpoint.
|
We leverage all ws-* features from apache cxf by means of putting configuration into busCfg which is used for cxf bus initialization |
A provider endpoint is a client-side JBI endpoint which can receive requests from the NMR and send them to a given url where the service is provided.
Here is an example of an http provider endpoint:
<cxfbc:provider wsdl="/wsdl/calculator.wsdl"
locationURI="http://localhost:9001/bridgetest"
service="calculator:CalculatorService"
endpoint="CalculatorPortProxy"
interfaceName="calculator:CalculatorPortType">
</cxfbc:provider>
|
|
When used on a SOAP consumer endpoint, servicemix-http handles the WS-Adressing Action and To headers.
The wsa:Action header can be used to specify the target interface name and operation to use for the JBI exchange.
The header uses the following syntax:
[target namespace][delimiter][interface name][delimiter][operation name] |
where:
For example, the following header
<wsa:Action>http://example.com/stockquote/StockQuoteInterface/GetLastTradePrice</wsa:Action> |
will be used to address the JBI exchange with the following properties:
The wsa:To header specifies the target JBI service name and endpoint name.
The header uses the following syntax:
[target namespace][delimiter][service name][delimiter][endpoint name] |
where:
For example, the following header
<wsa:To>urn:example:stockquote:StockQuoteService:JBIEndpoint</wsa:To> |
will be used to address the JBI exchange with the following properties:
Since cxfbc is using Apache CXF internally, so you can configure cxf bc endpoint with inteceptors which follow cxf inteceptor api.
example per as below
<cxfbc:consumer wsdl="...">
<cxfbc:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
</cxfbc:inInterceptors>
<cxfbc:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
</cxfbc:outInterceptors>
<cxfbc:inFaultInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
</cxfbc:inFaultInterceptors>
<cxfbc:outFaultInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
</cxfbc:outFaultInterceptors>
</cxfbc:consumer>
|
Can find document for CXF interceptors here
You can also configure CXF features directly on CXF BC endpoint. Example per as below:
<cxfbc:consumer wsdl="...">
<cxfbc:features>
<bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
<property name="jmsConfig">
<bean class="org.apache.cxf.transport.jms.JMSConfiguration">
<property name="concurrentConsumers">
<value>5</value>
</property>
<property name="connectionFactory">
<ref bean="myConnectionFactory" />
</property>
<property name="targetDestination">
<value>test.jmstransport.text</value>
</property>
<property name="useJms11">
<value>false</value>
</property>
</bean>
</property>
</bean>
</cxfbc:features>
</cxfbc:consumer>
|