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 Stephane Roy <st...@alcatel-lucent.fr> on 2007/06/14 17:20:00 UTC

[Axis2] redirection with Axis2 ?

Hi,

I have a web service deployed in Axis2.1.2/Tomcat5.5 at 
'http://localhost:8080/axis2/services/myService'

I have set the endpoint to 
'http://localhost:8080/axis2/services/myService' in my client and 
everything's working fine.


Now, I need to implement a redirection mechanism. For this, I first 
downloaded and installed a free URL rewrite module 
(http://tuckey.org/urlrewrite/), similar to mod_rewrite of Apache.

In this module, I configured a redirection rule with something like this:

from=http://localhost:8080/axis2/services/myNewService
to=http://localhost:8080/axis2/services/myService

I also changed the endpoint used by my client to 
'http://localhost:8080/axis2/services/myNewService'.

Note that the web service is still deployed at 
'http://localhost:8080/axis2/services/myService'.

I started the updated client and I received the following error when the 
client calls an operation of the web service:

Jun 14, 2007 5:07:27 PM org.apache.commons.httpclient.HttpMethodDirector 
isRedirectNeeded
INFO: Redirect requested but followRedirects is disabled
org.apache.axis2.AxisFault: Transport error: 302 Error: Moved Temporarily
         at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:221)
         at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452)
         at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
         at 
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
         at 
com.alcatel.lucent.awspt.sws.PhonebookServiceStub.addEntry(PhonebookServiceStub.java:173)
         at 
com.alcatel.lucent.awspt.sws.SwsClient.addEntryDeckard(SwsClient.java:109)
         at com.alcatel.lucent.awspt.sws.SwsClient.<init>(SwsClient.java:67)
         at com.alcatel.lucent.awspt.sws.SwsClient.main(SwsClient.java:194)
Caused by: org.apache.axis2.AxisFault: Transport error: 302 Error: Moved 
Temporarily
         at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:314)
         at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:201)
         ... 7 more
Caused by: org.apache.axis2.AxisFault: Transport error: 302 Error: Moved 
Temporarily
         at 
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:179)
         at 
org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:73)
         at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:305)
         ... 8 more
Caused by: org.apache.axis2.AxisFault: Transport error: 302 Error: Moved 
Temporarily
         at 
org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:320)
         at 
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:177)
         ... 10 more

In the traces of the URL rewrite module, the change of URL seems to be 
performed correctly.


I repeated the same test with TCPmon. The incoming request looks like this:

----------------------------------------------------------------------
POST /axis2/services/myNewService HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: "myOperation"
User-Agent: Axis2
Host: localhost:9090
Transfer-Encoding: chunked

2ae
<?xml version='1.0' encoding='UTF-8'?>
    <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Header>
          <wsa:To>http://localhost:9090/axis2/services/myNewService</wsa:To>
 
<wsa:MessageID>urn:uuid:6774F9EFDB67A1F15A1181830925356</wsa:MessageID>
          <wsa:Action>myOperation</wsa:Action>
       </soapenv:Header>
       <soapenv:Body>
          ...
       </soapenv:Body>
    </soapenv:Envelope>0
----------------------------------------------------------------------

... and the response looks like this

----------------------------------------------------------------------
HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Location: http://localhost:9090/axis2/services/myService
Content-Length: 0
Date: Thu, 14 Jun 2007 14:22:05 GMT
----------------------------------------------------------------------


I searched the mailing list archives for this kind of error but I didn't 
find any solution for it.

Can someone shed some light on how redirection works in Axis2 ? Did I 
foget to configure something in Axis2 ? Is my scenario doable with 
Axis2.1.2 in the first place ?

Thanks in advance.

Stephane Roy
Alcatel-Lucent


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [Axis2] redirection with Axis2 ?

Posted by Paul Fremantle <pz...@gmail.com>.
Stephane

Please log a JIRA. It seems our client HTTP code is not following redirects.

If the service is still on the same machine and you want to have it
rerouted (say to a new version) then there might be other ways of
doing that - for example you could use Synapse or you could write a
really simple module for Axis2 that adjusts the To: address before you
start dispatching.

Paul

On 6/14/07, Stephane Roy <st...@alcatel-lucent.fr> wrote:
> Hi,
>
> I have a web service deployed in Axis2.1.2/Tomcat5.5 at
> 'http://localhost:8080/axis2/services/myService'
>
> I have set the endpoint to
> 'http://localhost:8080/axis2/services/myService' in my client and
> everything's working fine.
>
>
> Now, I need to implement a redirection mechanism. For this, I first
> downloaded and installed a free URL rewrite module
> (http://tuckey.org/urlrewrite/), similar to mod_rewrite of Apache.
>
> In this module, I configured a redirection rule with something like this:
>
> from=http://localhost:8080/axis2/services/myNewService
> to=http://localhost:8080/axis2/services/myService
>
> I also changed the endpoint used by my client to
> 'http://localhost:8080/axis2/services/myNewService'.
>
> Note that the web service is still deployed at
> 'http://localhost:8080/axis2/services/myService'.
>
> I started the updated client and I received the following error when the
> client calls an operation of the web service:
>
> Jun 14, 2007 5:07:27 PM org.apache.commons.httpclient.HttpMethodDirector
> isRedirectNeeded
> INFO: Redirect requested but followRedirects is disabled
> org.apache.axis2.AxisFault: Transport error: 302 Error: Moved Temporarily
>          at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:221)
>          at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452)
>          at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
>          at
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
>          at
> com.alcatel.lucent.awspt.sws.PhonebookServiceStub.addEntry(PhonebookServiceStub.java:173)
>          at
> com.alcatel.lucent.awspt.sws.SwsClient.addEntryDeckard(SwsClient.java:109)
>          at com.alcatel.lucent.awspt.sws.SwsClient.<init>(SwsClient.java:67)
>          at com.alcatel.lucent.awspt.sws.SwsClient.main(SwsClient.java:194)
> Caused by: org.apache.axis2.AxisFault: Transport error: 302 Error: Moved
> Temporarily
>          at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:314)
>          at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:201)
>          ... 7 more
> Caused by: org.apache.axis2.AxisFault: Transport error: 302 Error: Moved
> Temporarily
>          at
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:179)
>          at
> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:73)
>          at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:305)
>          ... 8 more
> Caused by: org.apache.axis2.AxisFault: Transport error: 302 Error: Moved
> Temporarily
>          at
> org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:320)
>          at
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:177)
>          ... 10 more
>
> In the traces of the URL rewrite module, the change of URL seems to be
> performed correctly.
>
>
> I repeated the same test with TCPmon. The incoming request looks like this:
>
> ----------------------------------------------------------------------
> POST /axis2/services/myNewService HTTP/1.1
> Content-Type: text/xml; charset=UTF-8
> SOAPAction: "myOperation"
> User-Agent: Axis2
> Host: localhost:9090
> Transfer-Encoding: chunked
>
> 2ae
> <?xml version='1.0' encoding='UTF-8'?>
>     <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing"
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>        <soapenv:Header>
>           <wsa:To>http://localhost:9090/axis2/services/myNewService</wsa:To>
>
> <wsa:MessageID>urn:uuid:6774F9EFDB67A1F15A1181830925356</wsa:MessageID>
>           <wsa:Action>myOperation</wsa:Action>
>        </soapenv:Header>
>        <soapenv:Body>
>           ...
>        </soapenv:Body>
>     </soapenv:Envelope>0
> ----------------------------------------------------------------------
>
> ... and the response looks like this
>
> ----------------------------------------------------------------------
> HTTP/1.1 302 Moved Temporarily
> Server: Apache-Coyote/1.1
> Location: http://localhost:9090/axis2/services/myService
> Content-Length: 0
> Date: Thu, 14 Jun 2007 14:22:05 GMT
> ----------------------------------------------------------------------
>
>
> I searched the mailing list archives for this kind of error but I didn't
> find any solution for it.
>
> Can someone shed some light on how redirection works in Axis2 ? Did I
> foget to configure something in Axis2 ? Is my scenario doable with
> Axis2.1.2 in the first place ?
>
> Thanks in advance.
>
> Stephane Roy
> Alcatel-Lucent
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org