Check via code if a service input is a document

Hi everyone!

What product do you use and which version?

I’m using the webMethods Designer version 10.11

What are trying to achieve?

I’m creating a code reviewer and one of the features I’m trying to implement is checking the service’s input type (EG: String, Document, etc.). I tried to use wm.server.services:serviceInfo, but it doesn’t have any information about the service input. Is there any functionality that could return this information to me?
I would also like to know if there is a service that provides information about fields inside a document or adapter.

Thanks in advance for the replies, have a nice day!

Hi

This can be achieved using Java snipped below.

NSName nsSvc = NSName.create(serviceName);
					BaseService baseService = Namespace.getService(nsSvc);
					NSSignature sig = baseService.getSignature();
for(NSField nsField: sig.getInput().getFields()){
if(nsField.getRecordTypeString().equals("IData")){
   // this would be your block for document field
}
}
1 Like

We use these classes/methods too, for other purposes. They are very useful.

Just be aware that this uses classes that are not intended to be used by customers. If there are issues or you have problems, you’re on your own.

Hi Prathipati

During the implementation of the java code, we came across the error shown in the screenshot. Apparently, the getService method doesn’t exist in the imported class. Would it be possible to use another method or class?

@Joao_Guilherme_Raminelli , please make sure that you use Namespace from com.wm.app.b2b.server.ns package.

Regards,
-Kalpesh

2 Likes