Name

CXF Bean — allows other Apache CXF endpoints to send exchanges and invoke Web service bean objects

Overview

The CXF Bean component allows other Apache Camel endpoints to send exchanges and invoke JAX-WS or JAXRS annotated service beans.

[Note]Note

The CXF Bean component works similarly to the Bean component.

URI format

The URI format for a CXF Bean endpoint is:

cxfbean:serviceBeanRef[?options]
[Note]Note

If serviceBeanRef references a List object, the elements of the List are the service bean objects accepted by the endpoint.

Dependencies

Maven users will need to add a dependency on camel-cxf to their poms as shown in Example 2, “Apache CXF dependency”.

Example 2. Apache CXF dependency

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-cxf</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

If you want to learn about Apache CXF dependencies, see the WHICH-JARS text file.

Options

Table 3, “CXF Bean options” lists the options for a CXF Bean endpoint.

Table 3. CXF Bean options

NameDefault ValueDescription
cxfBeanBinding Specifies a CXF bean binding using the # notation. The referenced object must be an instance of org.apache.camel.component.cxf.cxfbean.CxfBeanBinding.
bus Specifies a reference to a bus object in the registry using the # notation. The referenced bus is used in place of the default bus.
headerFilterStrategy Specifies a reference to an instance of org.apache.camel.spi.HeaderFilterStrategy in the registry using the # notation. The referenced instance is used in place of the default header filter strategy.
setDefaultBusfalseSpecifies whether to use the default Apache CXF bus for this endpoint.
populateFromClasstrueSpecifies if the wsdlLocation annotation on the POJO is ignored.
providers Sets the providers for a CXFRS endpoint.

Headers

Table 4, “CXF Bean headers” lists the headers used by a CXF Bean endpoint.

Table 4. CXF Bean headers

NameRequiredTypeDefault ValueIn/OutDescription
CamelHttpCharacterEncodingNoString InSpecifies the character encoding of the message.
Content-TypeNoString\**/*\*InSpecifies the content type of the message.
CamelHttpBaseUriYesStringThe Endpoint URI of the source endpoint in the Camel exchangeInSpecifies the scheme, host and port portion of the request URI. The value of this header will be set in the CXF message as the Message.BASE_PATH property. It is needed by Apache CXF JAX-RS processing.
CamelHttpPathYesString InSpecifies the request URI's path.
CamelHttpMethodYesString InSpecifies the RESTful request verb.
CamelHttpResponseCodeNoInteger OutSpecifies the HTTP response code.

Related topics

Bean
Apache CXF
Apache CXF Documentation