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 Alberto Gori <A....@siaspa.com> on 2014/07/02 10:19:13 UTC

Weird client webservice behavior after redirect

I am using the default implementation of JAX-WS provided by Websphere 7, that is Axis2.
My problem arises when a ws client receives a redirect (HTTP code 302) because the network team implemented a rule (that I can't change) that redirects to an HTML error page in case of an application error (HTTP code 500).

At this point Axis client tries to follow the redirect, obviously failing: org.apache.axis2.AxisFault: WSWS7093W: The HTTP response redirected the target resource to a new location: http://agori:7070/jmil/BaseServices.

This is ok for me. The problem  is that every Axis client (at least the ones created on that endpoint) from that moment on continues to follow the error page.
At this point I have to restart the whole application if I want that my ws client does not point to the error page.

This is weird because:


1.       302 is not a permanent redirect

2.       I could understand if the redirect becomes permanent  for the client that performed the failing request, but why this happens also for ws client created after the fail?

I found a solution that is forcing the initial endpoint before every request. That is calling this line of code every time I attempt to invoke a ws method:

((BindingProvider) myService).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, startingEndpoint);

Is there a better solution, maybe passing some setting that disable redirect?

Thank you

Alberto Gori.

Re: Weird client webservice behavior after redirect

Posted by Andreas Veithen <an...@gmail.com>.
"I am using the default implementation of JAX-WS provided by Websphere
7, that is Axis2."

That statement is not correct. WebSphere's JAX-WS implementation is
based on Axis2, but it is not Axis2. In particular, the HTTP transport
used in WebSphere is proprietary. You should submit that issue to IBM.

Andreas

On Wed, Jul 2, 2014 at 9:19 AM, Alberto Gori <A....@siaspa.com> wrote:
> I am using the default implementation of JAX-WS provided by Websphere 7,
> that is Axis2.
>
> My problem arises when a ws client receives a redirect (HTTP code 302)
> because the network team implemented a rule (that I can’t change) that
> redirects to an HTML error page in case of an application error (HTTP code
> 500).
>
>
>
> At this point Axis client tries to follow the redirect, obviously failing:
> org.apache.axis2.AxisFault: WSWS7093W: The HTTP response redirected the
> target resource to a new location: http://agori:7070/jmil/BaseServices.
>
>
>
> This is ok for me. The problem  is that every Axis client (at least the ones
> created on that endpoint) from that moment on continues to follow the error
> page.
>
> At this point I have to restart the whole application if I want that my ws
> client does not point to the error page.
>
>
>
> This is weird because:
>
>
>
> 1.       302 is not a permanent redirect
>
> 2.       I could understand if the redirect becomes permanent  for the
> client that performed the failing request, but why this happens also for ws
> client created after the fail?
>
>
>
> I found a solution that is forcing the initial endpoint before every
> request. That is calling this line of code every time I attempt to invoke a
> ws method:
>
>
>
> ((BindingProvider)
> myService).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
> startingEndpoint);
>
>
>
> Is there a better solution, maybe passing some setting that disable
> redirect?
>
>
>
> Thank you
>
>
>
> Alberto Gori.

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