axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Walker, Jeff" <>
Subject RE: Modify servers HTTP response from "202 Accepted" to "200 OK"
Date Thu, 16 Aug 2007 15:44:50 GMT
I don't know Axis2, so I can't help you much. I use Axis 1.3.
My basic thought was that you could try to either change the http
header, or create a new response object and set that in the message
context, in the handler. Not sure if this is possible in Axis2.

I think you should look again at
argMsgContext.setProperty(HTTPConstants.RESPONSE_CODE) little more
closely. It 'feels' like the correct way to do it, don't you think?
Perhaps you can call it in a different place than where you do now?

Anyway, in Axis1, you can register handlers in a client-config.wsdd
file, or do it programmatically, using code like this: 
private static void registerClientHandlers(PaGWebService_ServiceLocator
locator) {
  try {
   //Register Clientside Handler
   //PaGWebService_ServiceLocator locator = new
   javax.xml.namespace.QName portName = new
javax.xml.namespace.QName("sessions", "PaGWebService");

   javax.xml.rpc.handler.HandlerRegistry hr =
   java.util.List handlerChain = hr.getHandlerChain(portName);
   javax.xml.rpc.handler.HandlerInfo hInfo = new
  catch (Exception e) {
    System.out.println("Caught an exception when registering the
clientside handler: " + e.getMessage());
Obviously, you need to supply the correct locator object and get the
QName correct. I don't know if this is the exact way to do it in Axis2,
Sorry I couldn't help more,


-----Original Message-----
From: Guido Wischrop [] 
Sent: Thursday, August 16, 2007 5:24 AM
Subject: Re: Modify servers HTTP response from "202 Accepted" to "200

Hi Jeff,
thanks for the quick reply. Your suggestion raised some more questions:
1) At which phase do we have to register the handler? We tried it after
the PostDispatch phase, but we are not sure if this is correct, because
we don't know at which point the HTTP response code is set. If it is
set in a flowComplete() method, it might be the wrong phase.

2) How do we get the HTTP headers? We tried
argMsgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE) and
argMsgContext.getProperty(HTTPConstants.RESPONSE_CODE) - but both do
return null. Also directly setting the response code in the
HttpServletResponse does not work.

Thanks for your help,

On 8/15/07, Walker, Jeff <> wrote:
> You might try writing a handler class that gets called on the outgoing
> response. If you correctly register the handler class, it will get
> called after the web service has formulated the response and sent it
> out.
> You can get the HTTP headers of the response from the MessageContext
> passed to your invoke() in the handler class, I think, and then you
> could try editing the appropriate http header. Once you do that,
> true from invoke() and hopefully the adjusted http header with '200
> will go back to your client.
> Just a suggestion,
> -jeff
> -----Original Message-----
> From: Guido Wischrop []
> Sent: Wednesday, August 15, 2007 12:08 PM
> To:
> Subject: Modify servers HTTP response from "202 Accepted" to "200 OK"
> Hello,
> we are providing a service for an old external client. This client
> expects a 200 OK HTTP response for a successful delivered message. We
> implemented the service by using axis2 1.2 and unfortunately it
> answers with a "202 Accepted".
> We tried to set the response code in our MessageReceiver like this:
> HttpServletResponse response = (HttpServletResponse)
> if (response !=null ) {
>     response.setStatus(HttpServletResponse.SC_OK);
> }
> But this doesn't work. Is it possible to change the response code in
> some other way?
> Thanks for any help,
> Guido
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message