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 Andrew Vardeman <an...@iastate.edu> on 2002/05/07 20:14:38 UTC

stateful service example (no cookies)

Thanks to everyone for the tips and good advice in the thread, "how to 
implement sessions, persistent objects, etc. ?".  I've got an example 
message-based stateful service that I figured might be of interest to 
people.  It's application scoped and keeps track of session data via SOAP 
headers rather than via cookies.  You can download the source at 
http://www.public.iastate.edu/~andrewv/axis.zip, or browse at 
http://www.public.iastate.edu/~andrewv/axis/

It takes some configuration (detailed in readme.html), and the 
Oracle-specific stuff may not be useful to you, but I left some database 
code in so it's a somewhat relevant example.  (Hopefully I got all the 
sensitive info filtered out.)

And no, it's not elegant, robust, or well documented, but it works, and 
I'll probably update it when my real project is farther along.

Andrew



Re: stateful service example (no cookies)

Posted by Stan Jordan <sk...@worldnet.att.net>.
Andrew...
Thanks much.  Sounds good.
Stan

----- Original Message -----
From: "Andrew Vardeman" <an...@iastate.edu>
To: <ax...@xml.apache.org>
Sent: Tuesday, May 07, 2002 2:08 PM
Subject: Re: stateful service example (no cookies)


> Stan,
>
> As of yet I haven't written a .NET client, but here's my thinking: since
> some of the communications we'll be doing require more than simple RPC
> (i.e. sometimes we're passing large XML documents as part of the request
or
> response), the .NET client will need to be a messaging client anyway.  If
> it's a messaging client, I presume there are methods in .NET for getting
at
> all the guts of a SOAP envelope, including the header.  So we'll have to
do
> the session stuff manually on both ends, but since we're already doing
> everything else manually, that's no biggie.  So, it's "interoperable" in
> that you could write a working client with any toolkit that supports the
> SOAP HTTP binding, but you probably couldn't, for instance, use .NET's
> equivalent of WSDL2Java to automagically generate a fully functional
client.
>
> Yes, there will be a number of .NET clients communicating with this
> service, identifying themselves with their sessionIds.  Essentially we are
> SOAP-ifying an old communications protocol, which has these commands:
>
> init
> query
> store
> commit
> rollback
> quit
>
> init opens a database connection that remains open for the duration of the
> session and starts logging.  query requests a data template from the
> database.  store returns collected data to the database. commit and
> rollback have their associated database meanings.  quit closes the log and
> the database handle.
>
> We could have kept the old method, but using SOAP abstracts us somewhat
> from the nuts and bolts of TCP and lets us send data as XML, the native
> format for the new data collection software.  In addition, the whole
system
> is less fragile since we can change the format of the XML document we pass

> back and forth without breaking the communications software.
>
> Andrew
>
> At 01:02 PM 5/7/2002 -0600, you wrote:
> >Andrew...
> >Bravo!  Thanks for providing this link.  But I am a little confused about
> >interop.  Does this service interop with a buncha .NET clients, keeping
> >track of each session?  Have you written a .NET client?  Or is this
service
> >aimed exclusively at Java clients?  I apologize if this question was
already
> >answered in the prior thread.  Do .NET web services offer a similar
facility
> >for maintaining session in the header?  Thanks.
> >Stan
> >
> >----- Original Message -----
> >From: "Andrew Vardeman" <an...@iastate.edu>
> >To: <ax...@xml.apache.org>
> >Sent: Tuesday, May 07, 2002 12:14 PM
> >Subject: stateful service example (no cookies)
> >
> >
> > > Thanks to everyone for the tips and good advice in the thread, "how to
> > > implement sessions, persistent objects, etc. ?".  I've got an example
> > > message-based stateful service that I figured might be of interest to
> > > people.  It's application scoped and keeps track of session data via
SOAP
> > > headers rather than via cookies.  You can download the source at
> > > http://www.public.iastate.edu/~andrewv/axis.zip, or browse at
> > > http://www.public.iastate.edu/~andrewv/axis/
> > >
> > > It takes some configuration (detailed in readme.html), and the
> > > Oracle-specific stuff may not be useful to you, but I left some
database
> > > code in so it's a somewhat relevant example.  (Hopefully I got all the
> > > sensitive info filtered out.)
> > >
> > > And no, it's not elegant, robust, or well documented, but it works,
and
> > > I'll probably update it when my real project is farther along.
> > >
> > > Andrew
> > >
> > >
>
>
>


Re: stateful service example (no cookies)

Posted by Andrew Vardeman <an...@iastate.edu>.
Stan,

As of yet I haven't written a .NET client, but here's my thinking: since 
some of the communications we'll be doing require more than simple RPC 
(i.e. sometimes we're passing large XML documents as part of the request or 
response), the .NET client will need to be a messaging client anyway.  If 
it's a messaging client, I presume there are methods in .NET for getting at 
all the guts of a SOAP envelope, including the header.  So we'll have to do 
the session stuff manually on both ends, but since we're already doing 
everything else manually, that's no biggie.  So, it's "interoperable" in 
that you could write a working client with any toolkit that supports the 
SOAP HTTP binding, but you probably couldn't, for instance, use .NET's 
equivalent of WSDL2Java to automagically generate a fully functional client.

Yes, there will be a number of .NET clients communicating with this 
service, identifying themselves with their sessionIds.  Essentially we are 
SOAP-ifying an old communications protocol, which has these commands:

init
query
store
commit
rollback
quit

init opens a database connection that remains open for the duration of the 
session and starts logging.  query requests a data template from the 
database.  store returns collected data to the database. commit and 
rollback have their associated database meanings.  quit closes the log and 
the database handle.

We could have kept the old method, but using SOAP abstracts us somewhat 
from the nuts and bolts of TCP and lets us send data as XML, the native 
format for the new data collection software.  In addition, the whole system 
is less fragile since we can change the format of the XML document we pass 
back and forth without breaking the communications software.

Andrew

At 01:02 PM 5/7/2002 -0600, you wrote:
>Andrew...
>Bravo!  Thanks for providing this link.  But I am a little confused about
>interop.  Does this service interop with a buncha .NET clients, keeping
>track of each session?  Have you written a .NET client?  Or is this service
>aimed exclusively at Java clients?  I apologize if this question was already
>answered in the prior thread.  Do .NET web services offer a similar facility
>for maintaining session in the header?  Thanks.
>Stan
>
>----- Original Message -----
>From: "Andrew Vardeman" <an...@iastate.edu>
>To: <ax...@xml.apache.org>
>Sent: Tuesday, May 07, 2002 12:14 PM
>Subject: stateful service example (no cookies)
>
>
> > Thanks to everyone for the tips and good advice in the thread, "how to
> > implement sessions, persistent objects, etc. ?".  I've got an example
> > message-based stateful service that I figured might be of interest to
> > people.  It's application scoped and keeps track of session data via SOAP
> > headers rather than via cookies.  You can download the source at
> > http://www.public.iastate.edu/~andrewv/axis.zip, or browse at
> > http://www.public.iastate.edu/~andrewv/axis/
> >
> > It takes some configuration (detailed in readme.html), and the
> > Oracle-specific stuff may not be useful to you, but I left some database
> > code in so it's a somewhat relevant example.  (Hopefully I got all the
> > sensitive info filtered out.)
> >
> > And no, it's not elegant, robust, or well documented, but it works, and
> > I'll probably update it when my real project is farther along.
> >
> > Andrew
> >
> >




Re: stateful service example (no cookies)

Posted by Stan Jordan <sk...@worldnet.att.net>.
Andrew...
Bravo!  Thanks for providing this link.  But I am a little confused about
interop.  Does this service interop with a buncha .NET clients, keeping
track of each session?  Have you written a .NET client?  Or is this service
aimed exclusively at Java clients?  I apologize if this question was already
answered in the prior thread.  Do .NET web services offer a similar facility
for maintaining session in the header?  Thanks.
Stan

----- Original Message -----
From: "Andrew Vardeman" <an...@iastate.edu>
To: <ax...@xml.apache.org>
Sent: Tuesday, May 07, 2002 12:14 PM
Subject: stateful service example (no cookies)


> Thanks to everyone for the tips and good advice in the thread, "how to
> implement sessions, persistent objects, etc. ?".  I've got an example
> message-based stateful service that I figured might be of interest to
> people.  It's application scoped and keeps track of session data via SOAP
> headers rather than via cookies.  You can download the source at
> http://www.public.iastate.edu/~andrewv/axis.zip, or browse at
> http://www.public.iastate.edu/~andrewv/axis/
>
> It takes some configuration (detailed in readme.html), and the
> Oracle-specific stuff may not be useful to you, but I left some database
> code in so it's a somewhat relevant example.  (Hopefully I got all the
> sensitive info filtered out.)
>
> And no, it's not elegant, robust, or well documented, but it works, and
> I'll probably update it when my real project is farther along.
>
> Andrew
>
>