How to find service name in webmethods which are invoked in a transformer

Am trying to print the names of services invoked in a FlowService using a java program. Am able to print the names of services using below code:

import com.wm.app.b2b.server.InvokeState;
...
...
...

InvokeState invkState = InvokeState.getCurrentState();
//below line prints all service names which are invoked in a flow service
System.out.println(invkState.getCallStack()); 

However, when am using transformers and trying to invoke a custom service (which I created), the above code doesn’t print the services which are invoked via transformer. And if, I happened to use a pub service, then it displays service name but not in the case of custom service.

Have attached image for better understanding.

Any inputs would be highly appreciated.
transformer.png

Hi Mohammed,

please note that Transformers are only being invoked when they have mapped outputs to the outoging pipeline of the step.

If no output is mapped it might be that your code snippet is not recognizing the transformer.
Can you check this?

Regards,
Holger

1 Like

Yes, you were right. I tried mapping my output to the pipeline after which my code starting display service name which was invoked using transformer.
Really appreciate your answer. Thanks a ton.

But there comes another question. What if the service which am invoking via transformer does not have any output i.e. pub.file:readerToFile or pub.file:StringToFile are used in transformer which does not have any output in which case I cannot map these services output to Pipeline of the step.

Under these situations, how do I get my transformer service executed?

Hi Mohammed,

you will have to use regular INVOKE step then instead of MAP Step with transformer.

You can just drag & drop the service from the package navigator into your flow service.

See Service_Development_Help for further informations.
Chapter 12 contains a sub-chapter “Working with Transformers”.

Regards,
Holger

1 Like

Hey Holger,

Transformers get executed via multi threads on the go, which will let me invoke multiple services at once. Using invoke for my project consumes more time and hence, I was in need of transformers.

But now, I realized that my transformer only works if its output is mapped with the Pipeline out.

However, as posted in one of my previous comments, was wondering if we can get to invoke services via transformer which does not return any output such as pub.file:StringToFile etc.

Thanks

Hi Mohammed,

in this case you can create a wrapper flow service for “invoking” the service you want and provide an output as i.e. “success” being set in the wrapper service.

You can then call this service as a transformer by mapping the success output to your pipeline and drop it afterwards.

Regards,
Holger

I really appreciate all your responses, time and knowledge for sharing. Was of great help.
Thanks a ton.

Hi Mohammed,

please remember that multiple transformers in one map step are executed in no specific order.

Did you try to measure the time for execution via Transformer and via Invoke?

Not all services should be executed as a Transformer.

Regards,
Holger

My custom services such as write to file, delete file and few other services have consumed less time when used these in transformers compared to the usage in flow service. And all these services input & output are independent of one another.
Considering your advice, am creating a wrapper flow service with an output and invoking my custom services via transformers.