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 Nige White <ni...@forward-comp.co.uk> on 2004/12/01 18:34:54 UTC

Changing the endpoint by sending redirects from the server?

Will the Axis HTTP client classes follow redirects?

I write my own server (because it has to be in this proprietary language 
we use for the business system). Each client needs a new process (They 
use loads of global data - it's all hideous!), so I want the first 
request from a client to be redirected to a newly spawned server on 
another port.

I'm planning to spawn the new server, and send an HTTP 301 response to 
point the client at that new server.

Will this work?

_____________________________________________________________________
This message has been checked for all known viruses. Virus scanning
powered by Messagelabs http://www.messagelabs.com For more information
e-mail : hostmaster@forward-comp.co.uk



Re: Changing the endpoint by sending redirects from the server?

Posted by TMG <tm...@nc.rr.com>.
Nige,

UDDIs are there own topic, so I don't want to clutter this list.

To get started, take a look at:
http://www.uddi.org/
http://ws.apache.org/juddi

The Apache jUDDI project has its own mailing list, etc... if you go down 
that path.

Tom Gordon

Nige White wrote:

> TMG wrote:
>
>> Nige,
>>
>> As an FYI ...
>>
>> Another way to accomplish dynamic endpoints would be to use a UDDI 
>> (e.g. jUDDI), and have the client locate services using a standard 
>> interface.
>>
> Woah!! I've just mastered the complexities of a Soap envelope and soap 
> encoding serialization/deserialization. I'm just beginning with WSDL, 
> and schemas now.
>
> I'm translating the Synergy DBL proprietary interface description into 
> WSDL to be able to expose our system as a web service. And I'm wanting 
> to write a generator that will generate Synergy DBL client code from 
> WSDL so that we can access other web services in Synergy DBL. I've got 
> a lot on my plate. UDDI could be the next thing for me... what *is* it?
>
>
> _____________________________________________________________________
> This message has been checked for all known viruses. Virus scanning
> powered by Messagelabs http://www.messagelabs.com For more information
> e-mail : hostmaster@forward-comp.co.uk
>
>
>


Re: Changing the endpoint by sending redirects from the server?

Posted by Nige White <ni...@forward-comp.co.uk>.
TMG wrote:

> Nige,
>
> As an FYI ...
>
> Another way to accomplish dynamic endpoints would be to use a UDDI 
> (e.g. jUDDI), and have the client locate services using a standard 
> interface.
>
Woah!! I've just mastered the complexities of a Soap envelope and soap 
encoding serialization/deserialization. I'm just beginning with WSDL, 
and schemas now.

I'm translating the Synergy DBL proprietary interface description into 
WSDL to be able to expose our system as a web service. And I'm wanting 
to write a generator that will generate Synergy DBL client code from 
WSDL so that we can access other web services in Synergy DBL. I've got a 
lot on my plate. UDDI could be the next thing for me... what *is* it?


_____________________________________________________________________
This message has been checked for all known viruses. Virus scanning
powered by Messagelabs http://www.messagelabs.com For more information
e-mail : hostmaster@forward-comp.co.uk



Re: Changing the endpoint by sending redirects from the server?

Posted by TMG <tm...@nc.rr.com>.
Nige,

As an FYI ...

Another way to accomplish dynamic endpoints would be to use a UDDI (e.g. 
jUDDI), and have the client locate services using a standard interface.

Tom Gordon

Nige White wrote:

> tony.q.weddle@gsk.com wrote:
>
>>
>> Have you thought about SOAP headers? The first response could include 
>> a header giving a new URL for subsequent calls. On the client, a 
>> handler could check for the header and, if present, store the value 
>> as the endpoint address. You could probably work out how to then 
>> modify the Service object or update the URL in the message context 
>> for each call. I'm sure there is a way to handle this without 
>> modifying the stub or doing any TCP/IP programming.
>>
>>
> So I'd have to write an implementation of some kind of plugable 
> interface that Axis offers to change its functionality, and provide 
> this along with the WSDL of our service so that the programmers on the 
> client side can plug it in?
>
> Any idea what interface would do this? I could just extend the Axis 
> default implementation if I knew what it was.
>
> Apache Soap follows the redirect, but it does it for every request 
> instead of seeing that 301 means moved *permanently* and changing its 
> endpoint accordingly! So it's getting a brand new server for each 
> call, which obviously isn't logged in and initialized.
>
> _____________________________________________________________________
> This message has been checked for all known viruses. Virus scanning
> powered by Messagelabs http://www.messagelabs.com For more information
> e-mail : hostmaster@forward-comp.co.uk
>
>


Re: Changing the endpoint by sending redirects from the server?

Posted by to...@gsk.com.
Nige,

Axis supports handlers that can get at the SOAP request and response on 
the way out and on the way back. It supports this on the client and server 
sides. You just have to configure the client and server side WSDD files 
and supply classes for the handlers. Axis calls the invoke method of each 
handler and passes the message context. Most or all of the information 
related to a single request/response is accessible from the message 
context. Handlers are often used to add and process SOAP headers, though 
they don't have to.

If the first call results in a hand-off of the request, to another URL, a 
handler, in the response chain of the server side, can add that URL (it 
can be obtained from the HTTP request object, if you don't have it any 
other way) in a SOAP header (that you define) to the SOAP response. A 
client side handler, in the response chain, can remove the information 
from the header and store the information somewhere. If you're using a 
single Call object, you may be able to update the endpoint in that object, 
in which case all subsequent requests should go to the new endpoint. 
Alternatively, I believe that the endpoint is ultimately stored in the 
message context and retrieved from there by the HTTP sender, so a request 
chain handler could pick up the previously stored endpoint (if there is 
one) and update the one stored in the message context.

This is all off the top of my head and I've never tried any of this but it 
doesn't seem like too much work and may be optimized if you can determine 
whether a call is the first call for a client (to avoid creating and 
sending the header with each response). The client handler class could be 
combined with the client jar file, along with a client-config.wsdd file.

You might also be able to change the HTTP transport chain, I think, and so 
extend the Axis HTTPSender class to perhaps respond to a 301, adding the 
new URL to a mapping of logical and actual URLs, using the real URL for 
each outward request.

Tony

"Nige White" <ni...@forward-comp.co.uk> wrote on 02/12/2004 15:22:10:

> tony.q.weddle@gsk.com wrote:
> 
> Have you thought about SOAP headers? The first response could 
> include a header giving a new URL for subsequent calls. On the 
> client, a handler could check for the header and, if present, store 
> the value as the endpoint address. You could probably work out how 
> to then modify the Service object or update the URL in the message 
> context for each call. I'm sure there is a way to handle this 
> without modifying the stub or doing any TCP/IP programming.
> 

> So I'd have to write an implementation of some kind of plugable 
> interface that Axis offers to change its functionality, and provide 
> this along with the WSDL of our service so that the programmers on 
> the client side can plug it in?
> 
> Any idea what interface would do this? I could just extend the Axis 
> default implementation if I knew what it was.
> 
> Apache Soap follows the redirect, but it does it for every request 
> instead of seeing that 301 means moved *permanently* and changing 
> its endpoint accordingly! So it's getting a brand new server for 
> each call, which obviously isn't logged in and initialized.
> 
> _____________________________________________________________________
> This message has been checked for all known viruses. Virus scanning
> powered by Messagelabs http://www.messagelabs.com For more information
> e-mail : hostmaster@forward-comp.co.uk
> 

Re: Changing the endpoint by sending redirects from the server?

Posted by Nige White <ni...@forward-comp.co.uk>.
tony.q.weddle@gsk.com wrote:

>
> Have you thought about SOAP headers? The first response could include 
> a header giving a new URL for subsequent calls. On the client, a 
> handler could check for the header and, if present, store the value as 
> the endpoint address. You could probably work out how to then modify 
> the Service object or update the URL in the message context for each 
> call. I'm sure there is a way to handle this without modifying the 
> stub or doing any TCP/IP programming.
>
>
So I'd have to write an implementation of some kind of plugable 
interface that Axis offers to change its functionality, and provide this 
along with the WSDL of our service so that the programmers on the client 
side can plug it in?

Any idea what interface would do this? I could just extend the Axis 
default implementation if I knew what it was.

Apache Soap follows the redirect, but it does it for every request 
instead of seeing that 301 means moved *permanently* and changing its 
endpoint accordingly! So it's getting a brand new server for each call, 
which obviously isn't logged in and initialized.


_____________________________________________________________________
This message has been checked for all known viruses. Virus scanning
powered by Messagelabs http://www.messagelabs.com For more information
e-mail : hostmaster@forward-comp.co.uk


Re: Changing the endpoint by sending redirects from the server?

Posted by to...@gsk.com.
Have you thought about SOAP headers? The first response could include a 
header giving a new URL for subsequent calls. On the client, a handler 
could check for the header and, if present, store the value as the 
endpoint address. You could probably work out how to then modify the 
Service object or update the URL in the message context for each call. I'm 
sure there is a way to handle this without modifying the stub or doing any 
TCP/IP programming.

Tony

"Nige White" <ni...@forward-comp.co.uk> wrote on 02/12/2004 14:22:51:

> Nige White wrote:
> 
> > Will the Axis HTTP client classes follow redirects?
> >
> No it doesn't! It just throws a "(301)Moved Permanently" error.
> 
> This means standard, generated Axis clients won't be able to use our 
> Soap server. The programmers of the client will have to modify the 
> BindingStub class do the extra step of talking straight TCP/IP on a 
> known port to the host to access my manager service which spawns a new 
> server process, and sends back the port on which that server is 
> listening, and creating the endpoint URL from that. BAH! :-(
> 
> _____________________________________________________________________
> This message has been checked for all known viruses. Virus scanning
> powered by Messagelabs http://www.messagelabs.com For more information
> e-mail : hostmaster@forward-comp.co.uk
> 
> 
> 

Re: Changing the endpoint by sending redirects from the server?

Posted by Nige White <ni...@forward-comp.co.uk>.
Nige White wrote:

> Will the Axis HTTP client classes follow redirects?
>
No it doesn't! It just throws a "(301)Moved Permanently" error.

This means standard, generated Axis clients won't be able to use our 
Soap server. The programmers of the client will have to modify the 
BindingStub class do the extra step of talking straight TCP/IP on a 
known port to the host to access my manager service which spawns a new 
server process, and sends back the port on which that server is 
listening, and creating the endpoint URL from that. BAH! :-(

_____________________________________________________________________
This message has been checked for all known viruses. Virus scanning
powered by Messagelabs http://www.messagelabs.com For more information
e-mail : hostmaster@forward-comp.co.uk