Web Service design with gSOAP

I am developing a Web Service application using gSOAP. The application is transaction based - I know, not recommended for Web Services, just following orders. The client supports an RF network of PDAs. Typically, a handful (6?) PDAs running a query to a host DB, each PDA transmitting a request evey 3 seconds. Traffic could be considerably higher, depending on customer - out of our control.

Question I have is this, should I treat each WS query as an independent query (open gSOAP, send/receive query, close gSOAP) or should I open a session and not close gSOAP until the user logs out. ie open gSOAP, run several queries, close gSOAP. Not sure what the SOA says about this. How much overhead is involved in opening and closing a SOAP transaction?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
I don't consider myself an expert on this but from a common sense point of view I would say is close the connection after each call.

What you could do is have 3 service calls.

The first when a user logs on - this returns a sessionID to the PDA. In subsequent calls this session ID is used for each transaction (the second). In this way you give the semblance of being permantly connected without having to be permanently connected.

When the user logs off the third service is called with the sessionID which invalidates the ID (closes it). Additionally you can have a timeout on the server where a sessionID is valid for a given time period unless it is refresshed with call number 2.

You could combine these into a single webservice and control the types (logon, refersh and logoff) with parameters.

Just my thoughts on the matter - can'ts say the thought of keeping the session open for that long appeals to me.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I think a global gsoap connection is more efficient than creating connection each time. The overhead of opening SOAP transaction is the same as TCP socket connection.
Another problem is about CLOSE_WAIT state of socket, ie, even if a socket is closed, but the socket is not released immediately by OS, it is in CLOSE_WAIT state for a few minutes (you can observe this by "netstat" command). If there are too many sockets in "CLOSE_WAIT" state, you may not able to create new socket.
You may use keep alive mode : SOAP_IO_KEEPALIVE
softechnicsAuthor Commented:
I agree with splitting the points, even though the answers were totally opposite. It appears there is no hard and fast answer - just opinions. I went with the open/close for each query. Makes for a simpler design.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.