I’ll try a different description.
As you’ve seen, calling a service indirectly presents a challenge. By indirectly I mean via a Java service, such as Chris appears to be doing, or via wm.b2b.edi.util:invoke as Ray suggests (there is also a service wm.marketplace.util:invokeService that does the same thing).
I don’t know how Chris’ service looks, but the marketplace.util:invokeService has this input/output signature:
input:
..$service -- string, the full name of the service to invoke
output:
..none
and edi.util:invoke looks like this:
input:
..interface -- string, the full folder name holding the service to call
..service -- string, the name of the service to call
..input -- record, a record holding the input parms for the service to call
output:
..output -- record, a record holding the output parms from the called service
Though these have different parms, these behave the same way and present the same “how do I get access to the output parms?” issue.
For both of these, you have to know what the inputs/outputs of the called service are. For example, you might invoke a service named utils:mapMe that has these inputs/outputs:
input:
..sourceRec -- record, the flat-file record to convert
output:
..targetRec -- record, sourceRec converted to an EDI record structure
..targetRecName -- string, the full name of the EDI record structure
For this service to work, there must be a pipeline var named sourceRec when the service is called. When the service is done, two new pipeline vars will exist–targetRec and targetRecName.
Okay, now we have the basics. Let’s look at the “main” flow that calls mapMe indirectly. It probably does some housekeeping first, setting things up and then does the call something like this:
... -- housekeeping calls
... -- derive or lookup from extended fields, the service to invoke
... -- assume "utils:mapMe" is the contents of serviceToInvoke
MAP vars to sourceRec
INVOKE wm.marketplace.util:invokeService
..serviceToInvoke --> $service
...-- Now what? The design-time pipeline doesn't show targetRec and targetRecName!
There are two approaches to get access to targetRec and targetRecName.
The first is add a MAP or INOVKE step, depending on what you need to do, after the invokeService call. Click the “Pipeline In” area on the left side of the pipeline pane. Add a Record or Record Reference named targetRec and a string named targetRecName and map from them just as you would any pipeline var. This is essentially “declaring” these variables in the pipeline and will access the vars returned by utils:mapMe.
The second is to not call invokeService directly, but write a wrapper service that explicitly shows the inputs and outputs for this type of service. For example:
service: invokeSourceToTargetService
inputs:
..service -- string, the full service name to invoke
..sourceRec -- record, the flat-file record to convert
output:
..targetRec -- record, sourceRec converted to an EDI record structure
..targetRecName -- string, the full name of the EDI record structure
There is only one step in this flow:
INVOKE wm.marketplace.util:invokeService
..service --> $service
The parms for invokeSourceToTargetService make the pipeline vars available to the caller. Our main service can now call this service instead of invokeService:
... -- housekeeping calls
... -- derive or lookup from extended fields, the service to invoke
... -- assume "utils:mapMe" is the contents of serviceToInvoke
INVOKE invokeSourceToTargetService
..serviceToInvok