Threaded invoke how to validate service to be invoked

I’m working on a java service that uses com.wm.app.b2b.server.Service
doThreadInvoke(com.wm.app.b2b.server.NSName svc, IData input).

I want to add error handling to ensure that the requested service exists before I attempt to invoke it.

The NSName class does not seem to be documented in the API docs. Does anyone have ideas on how to tell if an NSName (folder:serviceName) is valid? Is there a way to look it up in the service registry?

Mark

Try this:

NSName nsname = NSName.create(folderName, serviceName); 
Namespace namesp = Namepace.current(); 
if(namesp.nodeExists(nsname)) 
  // service exists

Rob,

Thanks! Makes sense. I’ll give it a shot.

Where did you find the docs on nodeExists()?

Mark

Follow up.

This worked great, but I did have to import com.wm.app.b2b.server.ns.Namespace rather than com.wm.lang.ns.Namespace to get access to the current() method.

Mark

Two years went by, and I forgot I had this solution (thanks to Rob). The attached java fragment works on IS 6.1

Mark

Code fragment for isValidService java service
isValidService_frag.java (1.3 k)