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 ba...@wingfoot.com on 2002/11/05 21:32:13 UTC

handling 302

Is Axis client set up to handle redirection(302 http code)?  My application 
makes a web service call to a particular url, which sends back a 302 http code 
along with the url to redirect to.  

Does anyone have any experience with this scenario.  Should I write a custom 
client handler to take care of this.

Thanks in advance
Baldwin

RE: handling 302

Posted by Felix Knecht <fe...@payserv.ch>.
Hi all

From
http://www.w3.org/2000/xp/Group/1/10/11/2001-10-11_Framework_HTTP_Binding
...

<snip>
The requested resource has moved and the HTTP request SHOULD be retried
using the URI carried in the associated Location header as the request-URI
for the POST request.

RFC2616 states that these response codes SHOULD NOT be handled automatically
except when the request method is GET or HEAD (which is not the case for
this binding). Otherwise it suggests that the user should be involved in
handling the redirection. Certainly looks like 301, 302, 303, 305  and 307
may be amenable to automatic processing - in which case I think that the
entity body of the HTTP response should be discarded and the HTTP request
message resend with a Request-URI taken from the Location header of this
response
</snip>

Meaning: In case of a 3xx using the POST-Method there is the need for a user
(client) interaction. At the moment I can't find anything like this in axis.

Using as http-client the commons-httpclient from apache you have the
possibility to set a property 'followredirects'. This works for 'normal'
http request (get). For the POST method the poroperty is set by default (and
unchangeable) to false, meaning it won't do a redirect because of RFC2616
(user interaction needed).

Felix

PS:
I solved the problem for me by patching the public int execute(HttpState
state, HttpConnection conn) from HttpMethodBase.java from the
commons-httpclient. To get use of it, you need to build axis with the
commons-httpclient in the classpath.




> -----Original Message-----
> From: baldwin@wingfoot.com [mailto:baldwin@wingfoot.com]
> Sent: Tuesday, November 05, 2002 9:32 PM
> To: axis-user@xml.apache.org
> Subject: handling 302
>
>
> Is Axis client set up to handle redirection(302 http code)?
> My application
> makes a web service call to a particular url, which sends
> back a 302 http code
> along with the url to redirect to.
>
> Does anyone have any experience with this scenario.  Should I
> write a custom
> client handler to take care of this.
>
> Thanks in advance
> Baldwin
>