Possible, although I would think this problem would have surfaced much earlier if that were the case.

Our JAX-RS specialist won't be in for another few hours. In the meantime, you might wish to use Wireshark[1] to confirm that the server is indeed returning 200 to the client, and not the client somehow changing that 500 into a 200 (if you're not already certain of that fact). A 200 can be indicative of an exception being fully handled service-side (and erroneously not propagated) such that the client gets that "success" response. Do you have any JAX-RS Exception Mappers service-side which might be changing the status code to 200? I'm trying to rule out anything obvious, but more than that, hopefully someone else can help on this list.

Glen

[1] http://www.jroller.com/gmazza/entry/soap_calls_over_wireshark


On 02/27/2012 02:50 PM, Benji Shults wrote:
My suspicion is that it is due to JAXRSOutInterceptor being in the
MARSHAL phase at which point it may be too late to change the
response-code.  But I don't know the interceptor chain well enough to be
sure of that.

Benji

-----Original Message-----
From: Benji Shults [mailto:[email protected]]
Sent: Monday, February 27, 2012 1:47 PM
To: [email protected]
Subject: RE: response_code 500 ignored when set in
JAXRSOutInterceptor.handleWriteException

Glen,

I'm using CXF 2.5.2.  I haven't made any changes to JAXRSOutInterceptor.
The only interceptors I've added are the built-in
LoggingIn/OutInterceptors.

When JAXRSOutInterceptor calls writer.writeTo, that writer writes to the
message's outputStream then throws an exception.  Looking at the code in
JAXRSOutInterceptor, I see that it does this:

    message.put(Message.RESPONSE_CODE, 500) // line 362

However, my HTTP client sees a response code of 200.

The writer I wrote myself and introduced it using the following:

<jaxrs:providers>
   <bean

class="com.ecologic.sdc.webservice.JsonUsageResponseValidatingProvider"
/>
</jaxrs:providers>

Benji

-----Original Message-----
From: Glen Mazza [mailto:[email protected]]
Sent: Monday, February 27, 2012 1:39 PM
To: [email protected]
Subject: Re: response_code 500 ignored when set in
JAXRSOutInterceptor.handleWriteException

Can you give a very generic version of that interceptor that would
duplicate/demonstrate the problem?

Glen

On 02/27/2012 02:36 PM, Benji Shults wrote:
I have a scenario where the call to writer.writeTo in
JAXRSOutInterceptor.serializeMessage throws an exception.

Before throwing the exception, the writer writes to the message's
outputStream.

When write.writeTo throws the exception, handleWriteException calls
message.put(Message.RESPONSE_CODE, 500).

However, my HTTP client is seeing the response come back with HTTP
response code 200.

The following is appended to the response that the writer put into the
message's outputStream:

Error serializing the response, please check the server logs, response
class : UsageResponse.

Benji




--
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza

Reply via email to