camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bitter geek <>
Subject How to handle http status code
Date Mon, 23 Jul 2012 15:43:18 GMT
Hi All,

I have a router builder for a rest service with configure override
like the following:
	public void configure() throws Exception {
		.setHeader("Content-Type", constant("application/x-www-form-urlencoded"))
		.setHeader(Exchange.HTTP_METHOD, constant("GET"))
		.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, constant(Boolean.TRUE))
		.setHeader(Exchange.HTTP_PATH, simple("${header.httpPath}"))

The rest service returns an xml document. I don't have the xsd for it
so would like to set the type of the response to String via

But once I do this, producerTemplate.requestBodyAndHeaders(null,
headers) returns a String object. So I lose the status code.

Noting converting it to string will let me access the status code but
then I no longer have the text body available.

Any idea how to get both the status code and the text body properly?

Thanks a lot for the help!


View raw message