You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by sri ram <pi...@yahoo.co.in> on 2009/02/02 09:25:42 UTC

HTTP status

Hi all,
I am using Axis 2.1.4 and XMLBeans as my databinding.
I have extended AxisServlet .If I get the proper response 
with no exceptions I am getting HTTP status as 200, which is completely
fine but when I get any fault message its sets the status to 500 automatically.
So I have added  the code to set the staus to 200 everytime even if there is an exception
but its not working .Does the Axis 2 apis prevent it from setting .

response.setContentType("text/xml; charset=UTF-8");        
response.setStatus(200);

Do help me on this its urgent

Thanks ,
Sriram





      Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

Re: HTTP status

Posted by Guo Tianchong <gu...@nec-as.nec.com.cn>.
hi, Sriram:

I think I met the same problem as yours.

My application asks the webservice to return the http 204 status.

My solution is to put the following code snippet in my ServiceClass's method.

HttpServletResponse resp = 
(HttpServletResponse)MessageContext.getCurrentMessageContext().getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
resp.setStatus(204);


Using a kind of Http Monitor (ex: Live HTTP headers in Firefox), I could find the Http Response header's status is 204.


>All

But I put the following code snippet in my outflow's handler,

public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
    ......
    HttpServletResponse response = (HttpServletResponse)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
    response.setStatus(204);
    ......
}

It always throw the NullPointerException for "response.setStatus(204);" statement.

Does the handler can not get HttpServletResponse?
Any ideas?

Thanks
Guo.



  ----- Original Message ----- 
  From: sri ram
  To: axis-user@ws.apache.org
  Sent: Monday, February 02, 2009 6:32 PM
  Subject: Re: HTTP status


        Can someone give some insight on this

        --- On Mon, 2/2/09, sri ram <pi...@yahoo.co.in> wrote:

          From: sri ram <pi...@yahoo.co.in>
          Subject: HTTP status
          To: axis-user@ws.apache.org
          Date: Monday, 2 February, 2009, 1:55 PM


                Hi all,
                I am using Axis 2.1.4 and XMLBeans as my databinding.
                I have extended AxisServlet .If I get the proper response
                with no exceptions I am getting HTTP status as 200, which is completely
                fine but when I get any fault message its sets the status to 500 automatically.
                So I have added  the code to set the staus to 200 everytime even if there is an exception
                but its not working .Does the Axis 2 apis prevent it from setting .

                response.setContentType("text/xml; charset=UTF-8");
                response.setStatus(200);

                Do help me on this its urgent

                Thanks ,
                Sriram





----------------------------------------------------------------------
          Add more friends to your messenger and enjoy! Invite them now.


------------------------------------------------------------------------------
  Unlimited freedom, unlimited storage. Get it now 

Re: HTTP status

Posted by sri ram <pi...@yahoo.co.in>.
Can someone give some insight on this

--- On Mon, 2/2/09, sri ram <pi...@yahoo.co.in> wrote:
From: sri ram <pi...@yahoo.co.in>
Subject: HTTP status
To: axis-user@ws.apache.org
Date: Monday, 2 February, 2009, 1:55 PM

Hi all,
I am using Axis 2.1.4 and XMLBeans as my databinding.
I have extended AxisServlet .If I get the proper response 
with no exceptions I am getting HTTP status as 200, which is completely
fine but when I get any fault message its sets the status to 500 automatically.
So I have added  the code to set the staus to 200 everytime even if there is an exception
but its not working .Does the Axis 2 apis prevent it from setting .

response.setContentType("text/xml; charset=UTF-8");        
response.setStatus(200);

Do help me on this its urgent

Thanks ,
Sriram




       Add more friends to your messenger and enjoy!  Invite them now.


      Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/