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 Sathish Kumar <Sa...@infravio.com> on 2005/03/21 08:30:16 UTC

Changing response status code

Hi all,

How can i change the Response status code in Axis handlers?
When there is an error, the response contains the soap fault. But, the response header shows status code as 500 (internal server error).
I wanted to change the status code to 403(forbidden).
How could i do it ?

Regards,
Sathish 

Re: Changing response status code

Posted by Anne Thomas Manes <at...@gmail.com>.
Sathish,

The SOAP spec requires that all SOAP Fault responses show a status
code of 500. You should not try to make this change.

Anne


On Mon, 21 Mar 2005 13:00:16 +0530, Sathish Kumar <Sa...@infravio.com> wrote:
>  
> Hi all, 
>   
> How can i change the Response status code in Axis handlers? 
> When there is an error, the response contains the soap fault. But, the
> response header shows status code as 500 (internal server error). 
> I wanted to change the status code to 403(forbidden). 
> How could i do it ? 
> 
> Regards,
> Sathish

Re: Changing response status code

Posted by Sathish Kumar <Sa...@infravio.com>.
Hello Carter,

I tried to do a ldap authentication from one of my handlers, and when the 
authentication fails, the http response header contains a 500 (internal 
server error) status code.

We thought 403(forbidden) error code would be appropriate. Or even 200(OK) 
might be enough since we have a soap fault constructed and contains the 
details of authentication failure.

So, we were searching whether axis would allow us to set a different 
response error code.

Thanks,
Sathish

----- Original Message ----- 
From: "Gregory G Carter" <gc...@aesgi.com>
To: <ax...@ws.apache.org>
Sent: Tuesday, March 22, 2005 1:09 AM
Subject: Re: Changing response status code


> Err.....no.
>
> Not to be totally unpleasant or anything but, the status codes exist for a 
> reason.
>
> 500 means internal server error which means your WS has a problem or the 
> server has.
>
> More than likely your WS framework is not constructed properly.
>
> Perhaps if you could explain the problem a bit more we can discuss a 
> solution within a software engineering context that makes sense for your 
> WS.
>
> However, just a note.  You don't break the framework/api to correct 
> application design errors.
>
> :-)
>
> -gc
>
> Sathish Kumar wrote:
>
>> Hi all,
>>  How can i change the Response status code in Axis handlers?
>> When there is an error, the response contains the soap fault. But, the 
>> response header shows status code as 500 (internal server error).
>> I wanted to change the status code to 403(forbidden).
>> How could i do it ?
>>
>> Regards,
>> Sathish
>
> 


Re: Changing response status code

Posted by Anne Thomas Manes <at...@gmail.com>.
If you are returning a SOAP Fault, you are required to return a 500
Status code, even if the error is related to security. From the WS-I
BP:

 R1126   An INSTANCE MUST return a "500 Internal Server Error" HTTP
status code if the response envelope is a Fault.



On Mon, 21 Mar 2005 13:39:21 -0600, Gregory G Carter <gc...@aesgi.com> wrote:
> Err.....no.
> 
> Not to be totally unpleasant or anything but, the status codes exist for
> a reason.
> 
> 500 means internal server error which means your WS has a problem or the
> server has.
> 
> More than likely your WS framework is not constructed properly.
> 
> Perhaps if you could explain the problem a bit more we can discuss a
> solution within a software engineering context that makes sense for your WS.
> 
> However, just a note.  You don't break the framework/api to correct
> application design errors.
> 
> :-)
> 
> -gc
> 
> Sathish Kumar wrote:
> 
> > Hi all,
> >
> > How can i change the Response status code in Axis handlers?
> > When there is an error, the response contains the soap fault. But, the
> > response header shows status code as 500 (internal server error).
> > I wanted to change the status code to 403(forbidden).
> > How could i do it ?
> >
> > Regards,
> > Sathish
> 
>

Re: Changing response status code

Posted by Gregory G Carter <gc...@aesgi.com>.
Err.....no.

Not to be totally unpleasant or anything but, the status codes exist for 
a reason.

500 means internal server error which means your WS has a problem or the 
server has.

More than likely your WS framework is not constructed properly.

Perhaps if you could explain the problem a bit more we can discuss a 
solution within a software engineering context that makes sense for your WS.

However, just a note.  You don't break the framework/api to correct 
application design errors.

:-)

-gc

Sathish Kumar wrote:

> Hi all,
>  
> How can i change the Response status code in Axis handlers?
> When there is an error, the response contains the soap fault. But, the 
> response header shows status code as 500 (internal server error).
> I wanted to change the status code to 403(forbidden).
> How could i do it ?
>
> Regards,
> Sathish