cCXFRS: HTTP Response code

Nine Stars

cCXFRS: HTTP Response code

Hi,

 

How can we handle the HTTP Response Code in a webservice with cXFRS component (Mediation route) ?

 

Eric

Eight Stars

Re: cCXFRS: HTTP Response code

Hi Eric

I guess you can get it in the seeded Camel headers in the next component after your CXFRS.

I can't remember which one exactly but just use a Cprocessor to loop on exchange.getIn().getHeaders() and print their names/values

Nine Stars

Re: cCXFRS: HTTP Response code

Hi Loko,

 

Thanks for your answer.

 

But that doesn't answer my question. I will rephrase my question with an example:

I have a webservice (Server). I receive an incoming request, I process it in my route and for any reason consider there is something wrong. I want to send back an HTTP code 202. How can I do that ?

 

I tried to update HTTP_RESPONSE_CODE (See http://camel.apache.org/cxfrs.html). But it doesn't work...

 

Eric

Eight Stars

Re: cCXFRS: HTTP Response code

OK, you're talking about CXF server and not client.

 

HTTP_RESPONSE_CODE is a good point but you also have to set Fault on :

exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 202);
exchange.getOut().setFault(true);
Nine Stars

Re: cCXFRS: HTTP Response code

Hi,

 

It doesn't work. Did you test this piece of code ?

 

Eric

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read