Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Name

Description

Example

Required?

default value

cxfBeanBinding

CXF bean binding specified by the "#" notation. The referenced object must be an instance of org.apache.camel.component.cxf.cxfbean.CxfBeanBinding.

cxfBinding=#bindingName

No

An instance of org.apache.camel.component.cxf.cxfbean.DefaultCxfBeanBinding

bus

CXF bus reference specified by the "#" notation. The referenced object must be an instance of org.apache.cxf.Bus.

bus=#busName

No

Default bus created by CXF Bus Factory

headerFilterStrategy

Header filter strategy specified by the "#" notation. The referenced object must be an instance of org.apache.camel.spi.HeaderFilterStrategy.

headerFilterStrategy=#strategyName

No

An instance of org.apache.camel.component.cxf.CxfHeaderFilterStrategy

setDefaultBus

Will set the default bus when CXF endpoint create a bus by itself

true, false

No

false

...

Headers

Name

Description

type

Required?

Default value

in/out

Examples

CamelCxfBeanCharacterEncoding

Character encoding

String

no

none

in

ISO-8859-1

CamelCxfBeanContentType

Content type

String

no

*/*

in

text/xml

CamelCxfBeanRequestBasePath

The value of this header will be set in the CXF message as the Message.BASE_PATH property. It is needed by CXF JAXRS processing. Basically, it is the scheme, host and port portion of the request URI.

String

yes

the Endpoint URI of the source endpoint in the Camel exchange

in

http://localhost:9000Image Added

CamelCxfBeanRequestPath

Request URI's path

String

yes

none

in

consumer/123

CamelCxfBeanVerb

RESTful request verb

String

yes

none

in

GET, PUT, POST, DELETE

Note: Currently, CXF Bean component has (only) been tested with Jetty HTTP component it can understand headers from Jetty HTTP component without requiring conversion.

Include Page
CAMEL:Endpoint See Also
CAMEL:Endpoint See Also

A Working Sample

This sample shows how to create a route that starts a Jetty HTTP server. The route sends requests to a CXF Bean and invokes a JAXRS annotated service.

First, create a route as the following. The "from" endpoint is a Jetty HTTP endpoint that is listening on port 9000. Notice that the matchOnUriPrefix option must be set to true because RESTful request URI will not match the endpoint's URI "http://localhost:9000" exactly.

Wiki Markup
{snippet:id=routeDefinition|lang=java|url=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java}

The "to" endpoint is a CXF Bean with bean name "customerServiceBean". The name will be looked up from the registry. Next, we make sure our service bean is available in Spring registry. We create a bean definition in the Spring configuration. In this example, we create a List of service beans (of one element). We could have created just a single bean without a List.

Wiki Markup
{snippet:id=beanDefinition|lang=xml|url=camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.java}

That's it. Once the route is started, the web service is ready for business. A HTTP client can make a request and receive response.

Wiki Markup
{snippet:id=clientInvocation|lang=java|url=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java}

...