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.

Reply via email to