Transformers vs Invoke Service

In a map, we had several field-maps from input to output. This included 2 conditional mappings, 2 transformer mapping and several direct mappings.

It was experienced that these values were not getting mapped correctly when several threads tries to access that service. Map was not mapping one or more values sometime. But most of the time it was correct. Also, if only one thread is used, it was always correct.

One map is now broken into 2 maps, one for direct mapping and one for conditional mapping, and two invoke steps, replacing transformers. Now, it is always correct, not skipping any value. I suspect that transformers are not synchronized in webMethods. Is my assumption correct? How call to a invoke step and call to a transformer is different in webMethods?

Working with Transformers section of Developer Guide suggests transformers as a series of Invoke steps embedded in a Map. So, does that mean there is no difference in a call to invoke step and call to a transformer? What is happening in background?

Thanks in advance.

Mitual,

I always prefer calling service as invoke setup but not as transformer in a map step, sometimes there are other problems associated with transformers inside the loop steps(error will be transformers cannot loop)this happens due to unspecified index when you map any recordlist to transformer input and error goes aways if you specify index when you explicitly map.

You have put a good question here,some one will definetly share their experiences/comments on transformer vs invoke step in a map.

HTH,
RMG

I agree with RMG about the possibility of transformers causing problems inside a loop, in absence of specified index… and we must be careful while using them that way. However, another difference between calling a service and using a transformer in a map is that where as the called service gets the entire pipeline of the calling service, the transformers work only on the mapped inputs. This is why in some cases it is preferable to use transformers.

Another scenario where transformers may be useful is - lets say you have a document with 30 string fields in it, each of which needs to be trimmed. Now using transformers, this can be achieved in a single map step, as compared to 30 calls to the trim service. Of course, this can also be achieved in a simple java service that takes in the document as input, trims all the fields and returns it. But some people might not be comfortable using a java service, besides, the service will get complicated if out of 30 fields let’s say only 25 are to be trimmed - selectively.

Of course none of the above is a difference in context of the problem that Mitul faced. I have never seen such a problem… sounds interesting… will try to reproduce it and post if I find something.

~R

Thanks Rohit for jumping in this thread.your example scenario is absolutely right…

RMG, Rohit,
Nice insight. Thank you for your comments.

Hi,

You told that we can trim entire document at a time. Now it is necessary to use this in my service. Could you please send that service if you have time.

Thanks…
prasad G Sai