Ways to find out if a particular service exists?

I am trying to write a flow that checks the Trading Network configuration before a business document is passed to TN. This would include a check on the existence of the B2B service to be executed, that is configured in the processing rule. So far I do not succeed in this.
An appropriate service would seem wm.server.services:serviceInfo. How is this used from another service?
I appreciate any hint or tip.

Huub Houet

Here is a way.

I wrote the following java service that solves this problem:

Service name: Exists

Inputs: String FolderName, String ServiceName
Outputs: String Result (“True” or “False”)

Paste this into the Imports section of the Shared section.
com.wm.lang.ns.NSName
com.wm.app.b2b.server.ns.Namespace

Paste this into the source section:

// ---- Start code ----
IDataCursor pc = pipeline.getCursor();

String strFolderName = “”;
String strServiceName = “”;

if(pc.first(“FolderName”))
strFolderName = (String)pc.getValue();

if(pc.first(“ServiceName”))
strServiceName = (String)pc.getValue();

String strResult = “False”;

NSName nsname = NSName.create(strFolderName,strServiceName);
Namespace namesp = Namespace.current();

if( namesp.nodeExists(nsname))
strResult = “True”;

pc.insertAfter(“Result”,strResult);
pc.destroy();

// ---- End code ----

This should do it. Let me know if this workst or if you have more problems.

This is exactly what I needed.
It works ok for me.
Thank you very much!!