views:

157

answers:

0

Hello,

Is there a way to modify the HTTP response code when using apache axis 1.4 for java?

This would be useful for testing purposes, for example simulating server side errors.

I've already tried the following:

Set the HTTP code directly in the http servlet Request:

  MessageContext context = MessageContext.getCurrentContext();

  HttpServletResponse response = (HttpServletResponse) context.getProperty(
      HTTPConstants.MC_HTTP_SERVLETRESPONSE);
  response.setStatus(e.getErrorCode()); // no effect

Set the HTTP code as axis message context property:

MessageContext context = MessageContext.getCurrentContext();
context.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE, e.getErrorCode());

But this didn't seem to work, the actual HTTP code always was 200.

Any ideas would be greatly appreciated :-)

Greetings,

Achim Bitzer