Using the killsession service in webmethod

More recently apps running on webmethod servers have lot of unclosed sessions, which at a certain threshold causes the services to hangup. A server reboot is required to clear this sessions. I have been looking at the wmRoot package of webmethod and there is getSessionList and killSession services. I dont see any input and output parameters when i call the service in the flow, have anyone used these services and if yes please let me know. Any help will be very useful as i am stuck.
Harsh Uchariya


You are on the right track. I built a small service that calls getSessionList. I loop over the session data and I evaluate if the session expiration is a negative number, if so, I pass the session ID into the killSession service.

One word of caution. Creating services in WmRoot is an unsupported activity so approach this carefully. That being said, I have had no issues with my service.

Also, you can set your services to run stateless. This is more optimal and will cut down drastically on the number of sessions. The only sessions I keep stated are web services.

Others may differ in their opinion or approach, but this is what works for me.



Thanks for the info! Can you also give me some example on how you were able to use getSessionList in your flow, i dont see any parameters (in the input/ouput window) when i call the service. Although when i run getSessionList alone it gets all the current sessions in a array. Do i need to create variables in getSessionList and killSession service to pass into the pipeline?.
Thanks again!

Harsh Uchariya


I have included some sample code. I highly recommend that you test this code prior to putting it into any production facility. It works as I described in my prior post.


Ray Package (4.0 k)


I forgot: You will want to create a reoccurring scheduler to run every five minutes or at a set interval to wipe out these sessions.


Hiya Ray - long time!

You had written “The only sessions I keep stated are web services.”

Why do web services need to run stateless?


You confuse me? Web Services CAN run stateless if all they do is return a value like the get() method of a bean. Then there is no need to persist the session data. I have worked on a couple of .NET projects where the integration point into our system was a web service and we had to run those interfaces stated to mainstain session.

I do not like to run anything stated due to the overhead.

I have not had very many opportunities to run web services because most of my customers have security issues with the “open” architecture of a web service. This includes “secure” internal networks where financial or confidential data could be put at risk of disclosure, inadvertent or otherwise.

Strange world we live in. Then you have Mavericks like Mark Carlson… he is the McGiver of webMethods… he can make a web service from a popsickle stick!

How is the land down under? I kinda miss it, but at least I have my wife to remind me of there… Take care Sonam my friend.


Sorry for the confusion Ray. I really meant to ask:
“why do web services need to run STATEFUL” (not “stateless”)

You’re right about the overhead of stated services. I guess you run the web services stateful to avoid the expense of reauthentication on each request (possible by the client re-using the IS-issued cookie), right?

Australia is doing well my friend - it’s a nice place. I just got back here from a vacation in India. Even though I lived most of my life in India, I felt a wierd “disconnection” going back - as if I was a stranger. Just as I was getting comfortable, I got back and felt the same disconnection here. I guess that’s how it really is - we’re really just passing through.

Take care Ray!


If you are expose popsicle sticks as document literal web services, you will need duct tape. SoapRPC web services do not require the duct tape soap interface.

Those not steeped in late-80s TV pop culture you can learn about MacGyver here


Hi Ray,

I am having a problem with your description of killSession. I am unable to branch on %sessions/expires%<1 because the value is returned as an object (java.lang.long).

It always evaluates this value as null.

Please help.

  • Piara

there is a service in the WmTransformationServices package (available on advantage in Utilities and Samples) called LongToString

Thanks Roger. That worked!! Cool package.

Thank you.

  • Piara

Can you let me know where i can find WmTransformationServices?.

go to webMethods advantage site, go to Best Practices, then Utilities and Samples, then WmTransformation Services Package

or click here: WmTransformation Services Package

How can I map the object to the input of LongToString service. I can’t able to see input and output from wm.server.query:getSessionList service but only in the results.

Close to the top of this thread is the recommendation that WmRoot services be wrapped in your own service. You just ran into another reason to do this.

  1. Since WmRoot services can change you want to isolate your exposure.
  2. You can follow your own input and output signature naming conventions and map them within your wrapper service.

The way I create a wrapper for a service that doesn’t have a signature (or correct signature) defined, is to:

  1. create the wrapper service.
  2. put in the single invoke to the WmRoot service.
  3. run the wrapper service.
  4. copy the output pipeline from the Developer Results window into the output signature window of the wrapper service. This paste will put in the ‘schema’ definition of the pipeline data, not the actual data values.