Check if service follows an IS specification

Here’s what I have-

  • A java service that takes ‘svcName’ as input and then invokes that service using Service.doInvoke
  • Parent service that performs a lookup against a table to get ‘svcName’ and then calls the java service with ‘svcName’ as input.

Here’s what I am looking for -
Since ‘svcName’ is read from a db table (without going into details of why it is in a table and how it gets there), I want to check - whether or not service exists and if does, whether or not it follows an IS specification. If the service ‘svcName’ does not follow the specification - the flow needs to fail. Is there a straight forward way to do this? I couldn’t find a built-in service that does this - is there one?

Thanks, R

Here’s a Java service to check service existence:

Please Note: This sample code uses classes that are not documented and use by wM customers is not supported by wM. Future release may break this code.

public static final void serviceExists(IData pipeline)
throws ServiceException
IDataCursor idc = pipeline.getCursor();
String nsNameStr = IDataUtil.getString(idc, “nsname”);
com.wm.lang.ns.NSName nsname = com.wm.lang.ns.NSName.create(nsNameStr); namesp =;
IDataUtil.put(idc, “exists”, “”+namesp.nodeExists(nsname));

This can verify the existence of any namespace node, not just services.

Thanks for your reply Rob and the java service… Actually a Service.doInvoke would itself return an error if the service does not exist - it is the latter part that I am more importantly looking for, ie whether the service complies to the IS specification in question.


Yeah, I’m researching that part as it sounds like an interesting thing to implement. Will post what I find.

Well I haven’t found anything that wouldn’t be more work than I want to invest right now. :slight_smile: Plus, the scheme used to verify compliance should depend a little bit on how strict the verification should be. For example, do you want the names and types to match? Or just the names? Check just the top-level fields or enforce record structures too?

A high-level approach might be:

  1. A service that accepts the service name to invoke and the service specification to check against.

  2. Retrieve the NSService object from the namespace. Get the assigned specification (NSSpecification), if it has one. If the name of the specification configured for the service matches the input spec name, then it complies.

  3. If the service doesn’t have a spec, retrieve its signature (NSSignature). Retrieve the signature of the specified service spec too.

  4. Get the input record (NSRecord) for both signatures. Compare them in a way that makes sense for what you want to verify (names of all the fields match, types of all the fields match, recursively check, etc.). Do the same for the output records.

That last step will be the most work. I haven’t found a class/method/service that will compare the structure of two NSRecords. It might exist somewhere but I’ve had no luck finding it so far.

Hope this helps!


I appreciate the time you invested to dig out those helpful hints - I was wondering if anyone has implemented such a thing already - apparently not. The direction which you have pointed me in, is where I intend to explore further myself.


It may be worth asking wM tech support if something like this exists. Perhaps it has just been overlooked?

I recommend you to use this service as regression test against DB values instead of checking all the time at runtime, but if you see as a need (DB values changes frequent) you can use it as runtime:

// ---  <<IS-START-IMPORTS>> ---
 import  com.wm.lang.ns.NSName;
 import  com.wm.lang.ns.NSNode;
 import  com.wm.lang.ns.NSService;
 // ---  <<IS-END-IMPORTS>> ---
 publicfinalclass  ServiceUtil
 publicstaticfinalvoid  getServiceSpec (IData pipeline)
 throws  ServiceException
 // ---  <<IS-START(getServiceSpec)>> ---
 // @subtype  unknown
 // @sigtype  java 3.5
 // [i]  field:0:required nsService
 // [o]  field:0:required nsSpecName
 // [o]  field:0:required status
              IDataCursor cursor = pipeline.getCursor();
              String nsService = IDataUtil.getString(cursor,"nsService");
              Namespace namespace = Namespace.current();
              NSName nsServiceName = NSName.create(nsService);
              NSNode nsNode = namespace.getNode(nsServiceName);
 if (  null != nsNode  && nsNode instanceof NSService )  {
                    NSService serviceNode = (NSService)nsNode;
                    NSName nsSpecName = serviceNode.getSpecification();
 if ( nsSpecName  != null )  {
                          IDataUtil.put(cursor, "nsSpecName",  nsSpecName.toString() );
                          IDataUtil.put(cursor, "status", "FOUND"  );
                    } else {
                          IDataUtil.put(cursor, "status", "SPEC_NOT_FOUND"  );
             }  else {
                    IDataUtil.put(cursor, "status", "SERVICE_NOT_FOUND"  );
 // ---  <<IS-END>> ---