Dears,
On API Gateway 10.3, I am using a request processing, over REST Virtual Service, that invokes a java service, in order to apply some validations. Whenever the validations are not succeeded one exception is raised (to stop the execution) and the http status code and messages are adapted.
To execute a manipulation of the http status code and message I am applying:
[size=9]private static void setStatusCode(int statusCode, String statusMessage, RestMessageContext msgCtx) throws ServiceException{
HTTPResponse response = (HTTPResponse) msgCtx.getHttpResponse();
response.getHeader().setResponse(statusCode, statusMessage);
msgCtx.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE, statusCode);
throw new ServiceException(statusMessage);
}[/size]
However, it seems the values set on “setResponse” and “setProperty” are totally ignored, since it always returns HTTP Status Code “500” and Message “Internal Server Error”.
Any idea what is missing here?
Thanks and regards.