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

Seven 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

Seven 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

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.