Title: RE: Stateful Web Services

As usual it is always a little bit more complicated than that .....

There is not a lot of "standard" API interface to Web Services.
Sun has a standard API called JAXRPC which can be used as a standard web service client API, where the notion of session is defined, but it is left to the person implementing this API to decide how to implement the session support.

What is "well" defined in the web services area is the protocol/encoding used for exchanging request/response between the client and the server. The most used and well known encoding is SOAP (encode the response/request in XML a specific way) and the most used and well known protocol is HTTP.

So, if you consider a web service using SOAP over HTTP, most of the reasonable web service package (server and/or client) supporting such web service will also support the handling of HTTP cookies and then support session handling.

But everybody is trying to get away from this kind of solution as the session rely on a specific transport feature (HTTP cookie in that case). What happen if tomorrow you want to have your web service available over JMS or SMTP?

The "right" way to do session handling in SOAP Web Services is to use SOAP headers. You define your own header and you take care of making sure that your client and server are both handling the session through this header. Automatic support of SOAP header is getting better and better in the current SOAP packages (for example, with Axis as the SOAP server and .NET C# as the client application, you can have a stateful web service with very little extra code compare to your regular client and server implementation if you configure all that properly).

From your web service implementation, if you use a java based SOAP server engine, for sure you can connect to an EJB, regular Java Bean or JDBC session. After that, according to the SOAP engine you will use you will have to write a different amount of code to plug all that together and maintain the session. In general, it should be very similar (or sometimes even easier) to doing the same thing with a regular servlet.

Thomas

-----Original Message-----
From: David Peterson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 14, 2003 9:36 PM
To: [EMAIL PROTECTED]
Subject: Re: Stateful Web Services



Anne,

Thanks for the link and info.

Do you know, can I still use an approach such as connecting a web
service to a EJB, or regular Java Bean, or a JDBC session?

It surprises me that the concept of a stateful web service has not been
tackled by various web services standards bodies (e.g. OASIS for example)!

Regards,

David


Anne Thomas Manes wrote:

>It depends on the SOAP implementation you're using. Most products don't
>support stateful services. Some do: Systinet WASP, Oracle SOAP, Apache
>SOAP, maybe a few others. Interoperability is a big issue, though. BEA
>published a proposed SOAP extension called SOAP Conversation
>(http://dev2dev.bea.com/techtrack/SOAPConversation.jsp), but I don't
>think it's getting much traction.
>
>Anne
>

>
>>-----Original Message-----
>>From: David Peterson [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, January 14, 2003 5:25 PM
>>To: [EMAIL PROTECTED]
>>Subject: Stateful Web Services
>>
>>
>>
>>Hi All,
>>
>>I have a bit of a newbie question in relation to web services:
>>
>>Do SOAP-based web services support the concept of state and
>>persistence? That is, can I easily create a web service where state is
>>preserved between invocations?
>>
>>For example, can I create a "bank account" web service, which supports
>>deposit(), withdrawl() and getBalance() operations, and have that web
>>service preserve the current account balance between separate
>>invocations?
>>
>>I imagine that I could achieve this with web services by using an
>>external persistence component, eg an EJB, or a JDBC call to a
>>database. What I want to know is whether I can preserve state
>>internally (inside a web service component) by simply declaring an
>>instance variable appopriately (e.g. "static" - though this might not
>>be the right approach).
>>
>>On the other hand, is my only "stateful web service" option to use an
>>external persistence layer (JDBC or EJB?)
>>
>>Thanks.
>>
>>David Peterson
>>
>>
>>
>>   
>>
>
>
>

>


Reply via email to