camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: Camel cxfrs proxy response
Date Tue, 08 Dec 2015 16:13:50 GMT
Hi

May be following this thread:

http://camel.465427.n5.nabble.com/How-to-access-payload-from-REST-404-reply-in-cxfrs-td5773325.html

can help ?

Cheers, Sergey

On 07/12/15 07:31, hoomanb wrote:
> Hi,
>
> I have exposed a cxfrs endpoint as my proxy rest service, once getting the
> request I'm calling two soap web services and getting the respond back from
> those service, in this process I'm using camel aggregator to aggregate the
> response results coming back from the soap calls, now up to here everything
> works as expected, the issue I'm facing is I have problem returning the
> response back to the rest client, so here's my route config:
>
> <cxf:rsServer id="rsServer" address="http://localhost:9002/route"
> 		serviceClass="com.MyController"
> 		loggingFeatureEnabled="true" loggingSizeLimit="20">
> 		<cxf:providers>
> 			<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />
> 		</cxf:providers>
> 	</cxf:rsServer>
>
> <bean id="requestProcessing" class="com.RequestProcessing" />
>
> <camelContext trace="true" xmlns="http://camel.apache.org/schema/blueprint">
>           <routeBuilder ref="requestProcessing" />
> </camelContext>
>
> Here's com.MyController:
>
> @GET
> 	@Path("/{objectId}")
> 	@Produces(MediaType.APPLICATION_JSON)
> 	public List<MyObjectList> getMyObject(@PathParam("objectId") String
> objectId) {
> 		return null;
>
> 	}
>
> and here's the RequestProcessing class:
>
> from(Constants.REST_ENDPOINT)
> 		.routeId(getClass().getName())
> 		.log("Entering the route...")
> 		.process(new EndpointProcessorManager())
> 		.removeHeaders("CamelHttp*")
> 		.multicast()
> 		.parallelProcessing()
> 		.to(Constants.DIRECT_ENDPOINT_ONE)
> 		.to(Constants.DIRECT_ENDPOINT_TWO);
>
> from(Constants.DIRECT_ENDPOINT_ONE).process(new
> SupplierEnricherProcessor()).to(FIRST_SOAP_ENDPOINT).to(Constants.DIRECT_AGGREGATE_ENDPOINT);
> from(Constants.DIRECT_ENDPOINT_TWO).process(new
> GenericNAICSEnricherProcessor()).to(SECOND_SOAP_ENDPOINT).to(Constants.DIRECT_AGGREGATE_ENDPOINT);
>
> from(Constants.DIRECT_AGGREGATE_ENDPOINT)
> 		.aggregate(constant(true), new GroupedExchangeAggregationStrategy())
> 		.completionSize(2)
>                   setBody(exchangeProperty(Exchange.GROUPED_EXCHANGE))
> 		.process(new FinalTestProcessor())
> [1]
> 		.bean(new ProcessJsonResponse(), "processBody")
> [2]
> 		.marshal(new JsonDataFormat(JsonLibrary.Jackson));
>
> so in line [1] FinalTestProcessor processes the results from the web service
> calls to extract the desired result as a list of objects say for example:
> exchange.getIn().setBody(MyObjectList) .
> in line [2] I'm basically returning this result list as follows:
>
> return Response.status(Status.OK).entity(MyObjectList).build();
>
> With this config all the calls and everything works but I can't seem to get
> the json respond that I need back to the REST caller.
>
> Any help would be appreciated on this.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-cxfrs-proxy-response-tp5774775.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Mime
View raw message