...
Name | Description | Example | Required? | default value | ||
---|---|---|---|---|---|---|
| The resource classes which you want to export as REST service | | Yes | None | No | None |
| new to Camel 2.1 If it is true, the CxfRsProducer will use the HttpClientAPI to invoke the service | httpClientAPI=true | No | false |
You can also configure the CXF REST endpoint through the spring configuration. Since there are lots of difference between the CXF REST client and CXF REST Server, we provides different configuration for them.
Please check out the schema file and CXF REST user guide for more information.
...
CXF JAXRS front end implements a proxy based Client client API, with this API you can invoke the remote REST service through a proxy.
camel-cxfrs
producer is based on this proxy API.
So, you just need to specify the operation name in the message header and prepare the parameter in the message body, camel-cxfrs producer will generate right REST request for you.
Here is an example
Wiki Markup |
---|
{snippet:id=ProxyExample|lang=java|url=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java} |
CXF JAXRS front end also provides a http centric client API, You can also invoke this API from camel-cxfrs
producer. You need to specify the HTTP_PATH and Http method and let the the producer know to use the http centric client by using the URI option httpClientAPI or set the message header with CxfConstants.CAMEL_CXF_RS_USING_HTTP_API. You can turn the response object to the type class that you specify with CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS.
Wiki Markup |
---|
{snippet:id=HttpExample|lang=java|url=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java} |
From Camel 2.1, we also support to specify the query parameters from cxfrs URI for the CXFRS http centric client.
Wiki Markup |
---|
{snippet:id=QueryExample=example|lang=java|url=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java} |