Web Service design with gSOAP

Posted on 2006-03-31
Last Modified: 2008-07-16
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?
Question by:softechnics
    LVL 50

    Accepted Solution

    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.
    LVL 12

    Assisted Solution

    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

    Author Comment

    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.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
    Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
    The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now