I still don’t see why this is a “blocker” kind of issue: the behaviour of the pipeline is a known thing, and if you are really encountering that many problems due to dumping everything in a “vars” document then what you’re doing is essentially shifting the pipeline “up one level” which is the cause of your problems. You need to change your process for writing services to avoid this (just like if you’re constantly writing java code that doesn’t handle nulls you need to start putting in code to check for that sort of thing, rather than relying on the caller to catch random exceptions…)
I’ve found that using the local variable document holder pattern (which is relatively easy to do and doesn’t require messing around with scope) and/or simply cleaning up the pipeline as you go will avoid any problems. Even when people don’t use the local variable pipeline holder, so long as they clean up the pipeline before exiting the service it’s not usually a problem. A simple change of the name of your tidy-up document to something that will be unique for each service that holds the variables will achieve this…
The only time I have really needed to use scope:
- messy services that are beyond my control to prevent from returning undeclared outputs
- recursion (though this is just an issue with the hacky private projects I’ve done on webMethods, I’ve never had a reason to use it on a commercial project).
- when I’ve had to invoke things that return the same named variable as one I’ve got as an input for the current service (and this could be overcome by renaming and renaming back if necessary).
It would perhaps be a useful future feature to have transformer-like invoke of services, but existing functionality would need to be maintained and would need to be able to turn it off, as there are definitely occasions when you need to access things in the pipeline that aren’t inputs… I’d also wonder how you’d get around the problem of mutation of documents, as aside from doing a deep clone of everything in the pipeline, the problem will still occur… And doing a deep clone of every document will be a tad expensive in terms of memory and CPU. In fact imagine the memory requirements of doing a deep clone where you have an entry point service which calls A which calls B and passes in the same document down through each service:
invoke of entry point service ( memory contains 1 x the structure)
– invoke A, passing in the doc ( deep clone of doc = memory contains 2x the structure)
------ invoke B, passing in the doc ( another deep clone of the doc = 3 x the structure)
Of course the actual memory requirements might be a lot lower due to the way strings are held in a common pool in the JVM, but all the other associated structures will be taking up memory, all the IDocs with their internal hash tables and cursors and the like…
Having this feature ON by default would indicate to me that webMethods had struck a deal with the RAM manufacturers 
just a few thoughts, (interesting thread though)
regards,
Nathan
#Integration-Server-and-ESB#webMethods-General#webMethods