FAQ
Using:
Apache Camel: 2.8.1
Apache CXF: 2.4.1


The Follwing codes invoke the remote REST service through a proxy, here we
had specified the operation name in the message header and parameters in
the message body.

Exchange exchange = template.send("direct://proxy", new Processor() {

public void process(Exchange exchange) throws Exception {
exchange.setPattern(ExchangePattern.InOut);
Message inMessage = exchange.getIn();
setupDestinationURL(inMessage);
// set the operation name
inMessage.setHeader(CxfConstants.OPERATION_NAME,
"/rest/getCities/");
// using the proxy client API
inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
Boolean.FALSE);
// set the parameters , if you just have one parameter
// camel will put this object into an Object[] itself
inMessage.setBody("in");
}
})

The above code works fine, but here i have to pass the operation name and
parameters,

We have already coded some proxy client interface so we do want to use them,
which means that
we want to integrate the CXF RS proxy interface with the above code

like my cxfrs interrface is


@Produces(value = "text/plain")
@Consumes(value = "text/plain")
public interface CityService {

@POST
@Path(value = "/rest/getCities/)
public String getCitiesForCountry(@QueryParam("countrycode") String
countryCode);

}


and the code to call the remote service is

*CityService cityService = (CityService) getBean("serviceClient")
cityService.getCitiesForCountry("in");*

i want to use the above code instead of passing the operation and body param
in the message


Thanks







--
View this message in context: http://camel.465427.n5.nabble.com/REST-service-through-camel-cxfrs-producer-using-CXFRS-dispatch-Interface-tp4975583p4975583.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedNov 9, '11 at 6:21a
activeNov 9, '11 at 6:21a
posts1
users1
websitecamel.apache.org

1 user in discussion

Santoshjoshi: 1 post

People

Translate

site design / logo © 2022 Grokbase