servicemix-cxf-bc has been edited by Freeman Fang (Mar 04, 2008).

(View changes)

Content:

servicemix-cxf-bc

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:

  • JBI compliant Binding Component
  • Usable in a lightweight mode in servicemix.xml configuration files
  • SOAP 1.1 and 1.2 support
  • MIME attachments
  • Support for all MEPs as consumers or providers
  • SSL support
  • WS-Security support
  • WS-Policy support
  • WS-RM support
  • WS-Addressing support

Installation

Installing the servicemix-cxf-bc 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.

XBean 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
See a full example here.  Note that you have to define the http namespace with

<beans xmlns:http="http://servicemix.apache.org/cxfbc/1.0">
    ...
</beans>

Any numbers of endpoints can be specified in the xbean.xml file.

Consumer endpoint

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>
Consumer endpoint attributes
Name Type Description Required
service QName the service name of the proxied endpoint yes
endpoint String the endpoint name of the proxied endpoint yes
interfaceName QName the interface name of the proxied endpoint  
targetService QName the service name of the target endpoint no (defaults to the service attribute)
targetEndpoint String the endpoint name of the target endpoint no (defaults to the endpoint attribute)
targetInterfaceName QName the interface name of the target endpoint  
wsdl String the wsdl will be retrieved from the given location yes}
busCfg String the spring configuration file used for cxf bus initialization no
mtomEnabled boolean Enable MTOM / attachment support no (defaults to false)

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

Provider endpoint

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>
Provider endpoint attributes
Name Type Description Required
service QName the service name of the exposed jbi endpoint yes
endpoint String the endpoint name of the exposed jbi endpoint yes
interfaceName QName the interface name of the exposed jbi endpoint no
locationURI URI the http url of the target service yes
wsdl String the wsdl will be retrieved from the given location yes}
busCfg String the spring configuration file used for cxf bus initialization no
mtomEnabled boolean Enable MTOM / attachment support no (defaults to false)

It is important to note that you need to include the classpath element in your xbean.xml if you are deploying the Cxf Provider in a service unit so that the wsdl can correctly find the classpath element.  Also you need to ensure that the service name and endpoint match the service and port elements of the WSDL that you wish to use to correctly return WSDL for the endpoint,  remembering that the service name will use the targetNamespace for the WSDL.

Lightweight mode

The servicemix-cxf-bc component can also be configured in a spring/xbean configuration file, for use in an embedded ServiceMix.
Here is an example of such a configuration:

<sm:activationSpec>
  <sm:component>
    <cxfbc:component>
      <cxfbc:consumer wsdl="/wsdl/calculator.wsdl"
                      service="calculator:CalculatorService"
                      endpoint="CalculatorPort"
                      targetEndpoint="CalculatorPortProxy"
                      targetService="calculator:CalculatorService"
                      targetInterface="calculator:CalculatorPortType">
          
      </cxfbc:consumer>
<cxfbc:provider wsdl="/wsdl/calculator.wsdl"
                      locationURI="http://localhost:9001/bridgetest"
                      service="calculator:CalculatorService"
                      endpoint="CalculatorPortProxy"
                      interfaceName="calculator:CalculatorPortType"
                     >
      </cxfbc:provider>
    </cxfbc:component>
  </sm:component>
</sm:activationSpec>
Classpath issues when embedding servicemix-cxf-bc component

When using the servicemix.xml configuration file to create cxfbc endpoints, you must include the servicemix-cxf-bc-xxx.jar in your classpath.
You will find this file inside the component installer (./components/servicemix-cxf-bc-xxx.zip).
Failing this, an IllegalArgumentException will be thrown with the following message:
Component name: xxxxxx is bound to an object which is not a JBI component, it is of type: javax.xml.namespace.QName

WS-Addressing

When used on a SOAP consumer endpoint, servicemix-http handles the WS-Adressing Action and To headers.

wsa:Action

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:

  • [delimiter] is ":" when the [target namespace] is a URN, otherwise "/".
  • [target namespace] is the namespace of the interface.
  • [interface name] is the name of the interface.
  • [operation name] is the name of the operation.

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:

  • interface name: {http://example.com/stockquote\}StockQuoteInterface
  • operation name: {http://example.com/stockquote\}GetLastTradePrice

wsa:To

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:

  • [delimiter] is ":" when the [target namespace] is a URN, otherwise "/".
  • [target namespace] is the namespace of the interface.
  • [service name] is the name of the service.
  • [endpoint name] is the name of the endpoint.

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:

  • service name: {urn:example:stockquote}StockQuoteService
  • endpoint name: JBIEndpoint

    You can find a WS-Addressing test case here

    More about Cxf WS-Addressing implementation

WS-Policy

You can find a WS-Policy test case

here

More about Cxf WS-Policy implementation

WS-Security

You can find a WS-Security test case

here

More about Cxf WS-Security implementation

WS-RM

You can find a WS-RM test case

here

More about Cxf WS-RM implementation

Powered by Atlassian Confluence (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request

Unsubscribe or edit your notifications preferences