We need to invoke some service dynamically. But I have no idea about the thread usage. In other words, when I call a ServiceB in ServiceA with the, will the ServiceB run in the same thread with ServiceA, or will it trigger a new thread? And is it safe to use some many doInvode() on IS? Thanks in advance.

In general,

  • doInvoke() uses same thread and is synchronous.
  • doThreadedInvoke() uses new thread and is asynch.

See API docs and several wMUsers posts for details.


There is no additional downside to using too many doInvokes. It is the same as writing a flow services with that many steps. In fact, you are guaranteed to get better performance from doInvoke calls than making an invoke call in a flow step.

Which is not to say that one should start using doInvoke in a wholesale fashion in an attempt to improve performance. IMO, the only reasonable reason to use doInvoke within IS is for dynamic service invocation (e.g. the name of the service to invoke isn’t known until runtime).

Agree, the only time I have written java services that used doInvoke was to create utilities that could dynamically invoke a service based on business rules. The IS 6.x era custom soap processors I created all used this approach to invoke different authentication routines based on web services meta-data.

I’ve used doThreadedInvoke only when needing to spawn multiple threads for work that could be performed in parallel.