After a web service request, we do this:
, to extract the Http response code, but we noticed that this only works in our case with 200 response codes from the server.
From what I could gather, it seems that the response context is not populated in cases where a 200 is not given. Example:
As you can see only two instances of SCOPES are in the response context. When we receive a 200 from the web service, the response context contains this:
, which although you can't see it in the screenshot, it contains the HTTP_RESPONSE_CODE value, which it's the only thing we need, because we need to do some additional steps depending on that response code afterwards.
Right now, we're using a finicky way to obtain such http response code... the exception is a WebServiceException which contains a HTTPException which has the response code given by the server. We'd like to have a more reliable way since those exception signatures could just change over time if we update libraries / java versions we guess.
Here's the CXF dependencies in our project:
Let us know if you need to know about anything else.