http session handling Vs Context handling

Product Installed : webMethods 6.0.1 with SP1, SP2

We have a webMethods service, which is called by an external client(written in C Sharp), which sends SOAP request over HTTP.
Whenever the webMethods service is called using the client, a new Session is created on the webMethods server(seen in webMethods Administrator–>Statistics–>Total Sessions), which will timeout after the Session Timeout interval specified in the webMethods Administrator–>Resources console–>Session Timeout, which is currently 10 minutes.

But, when we generate a Java client for the same webMethods service and run it, it does not create a new session. webMethods generated Java client uses Context object to invoke the webMethods service, which internally handles Session in a different way.

Hence, we see that for webMethods generated client(using Context class), session is not generated but for non-webMethods clients, it creates a session for each request.

We have a project, which uses non-webMethods client. It is creating a new session for each request which times out only after 10 minutes. We want to know whether there is any way (apart from reducing the session timeout value and using Context object) to close these sessions immediately after each request.


Set the service being invoked to stateless. This can be done in Developer using the Service “Properties” tab - DeveloperUsersGuide.pdf version 6.1 page 133.

If setting your service to stateless does not work, you can call the service wm.server:disconnect with the session id from your previous call. This will log the session out.

Thanks for the replies. Here is what I found out.
a) If I make the service stateless, it is still creating a session! The stateless checkbox is not working! What I feel is that all the internal services called by the service need to be stateless for this to work. In my case, the service which I expose to the outside world, calls many other services like soapHTTP, which are stateful. I feel that is the reason why the stateless tab in the toplevel service is not working.
b) The call to the service “wm.server:disconnect” seems to work! It does disconnect the session as soon as this service is called. But for me, it is a bad solution as this involves 2 SOAP http calls, one to invoke the actual service and another to close the session.
Is there any document which explains how the session/context is handled?

Has anyone come up with a good solution to this problem?