Null elements in output array when mapping EDI to output FF schema

I’m trying to make wM handle my company’s 850, 860, and 820 EDI transactions using wM. Here’s my wM version info:

Version 6.0.1
Updates IS_6-0-1_SP2

Build Number 425

The server is running on a Unix platform.

I’m having a fundamental problem while mapping the EDI 850 to another internal flat file schema. I do the usual thing: map the 850 header, loop over each line item detail /T850DT/ST/P01, and then map the summary. The internal flat file schema is VERY flat: the output array is /InternalFF/11.

In my mapping service I have a LOOP where the input array is /T850DT/ST/PO1 and the output array is /InternalFF/11. Under that I invoke a service called MapLineItemDetail that takes a document type PO1 as input and 11 output.

I’m sending in an EDI 850 document that has 3 PO1 children. When I run my service I get back my InternalFF with an array of 3 “11” documents, as it should, but all three are null.

When I step through the debugger, I can see that the LOOP is executed three times. The proper data for each PO1 element is visible in the Results tab, so I believe the input data is arriving as it should.

What did I miss in the mapping step, and why are the values null? I map four String values from the PO1 to the 11 document, so those are mapped by value. How can the output 11 document be null? How to best debug this? Please advise. Thanks - MOD


As a debug purpose what you do is before LOOP step just initialize this document InternalFF/11(Add a map step and do a setValue(empty) and use Test/Step thru the loop and inside the loop just disable the MapLineItemDetails service istead add a map step and map the individual fields to 11 document,so for testing purpose step each iteration of the PO1 and check the results whether data is extracted in the FF/11 document.Once you confirm then enable the MapLineItemDetails and test the same for each PO1 iteration.

This should work after debugging the problem.



I got past this problem by creating a MapAllLineItemDetails service that takes a PO1 document list as input and an 11 document list as output. This service simply LOOPs over the respective arrays and calls a MapLineItemDetail service that maps an individual PO1 document into an 11 document. When I use this trick I see the data moved into the output document as it should.

Now underneath each PO1 document I have a CTP document list that represents pricing information for this line item detail. This should map into a document list of type 12 in the output document. When I try to repeat this trick, by creating MapAllPricingInfo and MapPricingInfo services for pricing information, it fails me. I don’t see the /12 document list created under the /11 parent.

In the LOOP over pricing information, I have /CTP as the input array and /12 as the output array. There’s no mention of the /PO1 and /11 parents at this point.

I thought I’d corrected it on Friday, but that’s not the case this morning.

I think I have a fundamental misunderstanding of the operation of the pipeline. If anyone can spot the flaw in my logic I’d greatly appreciate it.



There is a work around for this parent/child mapping stuff and for this you may have to use different logic.

What you have to do is create a temporary /11 {arent documentReference which has /12 document is child(11/12).

So loop over PO1 and map the line data to 11parent document and under the same loop keep another loop PO1/CTP and map the pricing data to 12document and finally use the appendToDocumentList service(inputs map the temporary11 document to fromItem and map the original 11 documentlist to toList and output toList to origina /11documentlist and make sure you drop the fromItem(temporarydocument)at that point itself so that data is not overwritten and come of the loop and check the results.

So now this will have data the 11/12 documentlists using from PO1/CTP.

Sorry if my comments are confusing.



Thanks again for your attention and patience.

Should the top-level source and target documents remain in the pipeline all the way down when mapping deeply nested documents like this?

This is a fundamental criticism I have about the webMethods documentation. There’s plenty of it, but I’ve found few examples, and these are usually of a trivial nature. There’s no “patterns” or “common idioms” or “how to” or “hello world” that I’ve found to lay out how these things should be addressed.

Perhaps I’m just a slow, dull user, but I’ve read a great deal of the hundreds of pages of documentation and I’ve found it hard to pull together into a coherent approach.

Thanks for the venting opportunity.


Here’s a fundamental question:

“reference” is such a loaded term to a Java developer.

When should I choose a Document as my input/output type, and when should I prefer a Document Reference? What is the difference between the two, according to webMethods?

Thanks - %

ANOTHER fundamental question:

It seems to me that anytime I change input/output for a service I have to start again with defining the underlying pipeline. I have to delete everything that’s underneath and start all over. It’s as if the choice of input/output is so key that nothing else can go forward until that’s complete, and getting it wrong means losing all you’ve done. Does that agree with your experience?



Its always better to use DocumentReference so that this will give flexibility when adding any new fields in the documentStructure at one place and this change will effect in all the mapping services/maps where ever you used this document as a documentReference.This is like a Canonical document(generic structure).

If you just use service input/output then the document is dedicated to that service use only.

Since you are involved in EDI project mapping EDI document to FF,so start using the documentReference like example doc_850(X12_4060_850),if you create a temporary documents then you can make choice of using documentReference or just create a document/fields stimulating like original document.



Thanks again for looking in.

I appreciate the advice to always prefer DocumentReference to Document. Can you provide that last bit about the real difference between the two?

Thinking as a C++ developer (since Java is ALWAYS pass by value), it feels like the difference between “pass by reference” (DocumentReference) and “pass by value” (Document). I can change the values in a DocumentReference, but not a Document. Is that accurate?

(Java, of course, is always “pass by value”, but the thing that’s passed is a reference to the object itself. Objects aren’t passed, but their references are. You can take the reference and modify the object it points to, but not the reference itself.)

“If you just use service input/output then the document is dedicated to that service use only.” - so if I write services that deal only with the child Documents/DocumentLists, I need to write an additional step to map their output back into the parent document (e.g., your “appendToDocumentList” transformation). Correct?

Right, I am using the T850DT that’s supplied. The examples appear to have only one level deep nesting. The real thing has more than that. Hence my problem.

Thanks again - %


If you just use service input/output then the document is dedicated to that service use only." - so if I write services that deal only with the child Documents/DocumentLists, I need to write an additional step to map their output back into the parent document (e.g., your “appendToDocumentList” transformation). Correct?

–yes this assumption is correct.

And if you change the document Field(names)in the serviceI/P,O/P and as well documentReference then the workaround for this is you have to remap already existing maps which is hectic,some times this happens if functional stuff changes or due to communication gap in the integrations.

Regarding values you can change these in runtime(pipeline)



Thanks again for hanging in there with me.

“–yes this assumption is correct” - this is where I get confused. If I study the Tutorial.EDItoXML under WmEDIsamples I don’t see anyplace where the appendToDocumentList is used.

I’m not changing any names at any time. When I specify input/output Document, I cut & paste right out of the doc. That way I get the parent and all its children.

I thought I understood this last Friday afternoon, but I’ve wasted an entire day going in circles and making no progress. It’s been a frustrating day.


In trying to clean up my pipeline, I just tried dropping one of those intermediate input documents. It had an immediate negative impact on the output document - the array of line item details were all null as soon as I dropped the PO1 doc.

I’m still not understanding how your pipeline works. I’ve re-read the Developer Users Guide again, but I’m obviously not seeing it. Sorry.


I just ran one of my test input EDI 850 X12 V4010 that I received from our client in the Tutorial.EDItoXML:processEDI850_4010 service. I cut & pasted the raw EDI text into the input String using the “larger editor”.

I got an error message back: “Actual document count (1) doesn’t match GE01 (2)”

There’s only one GS in my input stream, so I edited the input so the first value following GE was 1. I got a correct looking XML stream back.

At least I know the sample works.

Does this error indicate that there’s something “wrong” with my input? This is data that I got directly from our client that’s been processed.



This service Tutorial.EDItoXML:processEDI850_4010 behaved correctly by throwing the error(Actually this is a warning message nice catch up isnt it?).

The raw edi text input string you got from the partner might have the only one GS segment but in the GE01 field count showing as (2),they must have copied only one GS segment data and send it to you and missed to update GE01 count(1).Anyways you have solved the problem by editing.

Regarding appendToDocumentList service the WmEDISamples services might not have used this at all.Its all depends on handling the logic in different easier ways,so WM provided us these utility buitin services keeping in mind for example that you are facing now with parent/child doclists creation(recursive structures).

When I specify input/output Document, I cut & paste right out of the doc. That way I get the parent and all its children.

—For avoiding this kind of manaul problems use the documentReference,so this will be used in the pipeline and you can map the elements directly instead of cut & Paste out of the doc.

Forgive me if i am not able to answer your questions as expected.just sharing my experiences as much as i can.


Just a thought. But when you’re mapping in the loop make sure you create the LOOP first and then link the elements inside the loop.
If you link the elements first when the definition is still a list and then push them under LOOP, they will look correct in Developer and when you step thru they will get executed but you will get a Null result.
Try unmapping the elements, save the service and then re map them under loop.

Hi Chris,

I’m doing exactly as you’re suggesting: I create the LOOP and then add a service that’s invoked underneath it that does the work. The input for the service is the Document type of the input array, and the output is the Document type of the output array (note: NOT DocumentReference).

Thanks - %


The exception that I got from the EDI sample troubles me. I agree that it makes perfect sense, based on the design of the EDI schema in wM.

But this is one of the EDI docs that I’ve already received from our supplier. If this is the way THEY send me documents, then I’ll have exceptions every day when I use wM to process them until I can persuade them to change what they send in their EDI transmissions.

It also makes me wonder about the s’ware we’re using to process EDI today. If the given input violates the EDI spec, then why have we been processing them successfully all these years?

Troubling. I can’t get this project off the ground, and now I worry that when I do it’ll fail because the data I’m sent doesn’t conform to the EDI 850 schema in wM. Oh, my.

It’s all a moot point until I figure out/solve my looping problem.


Hi all,

If the appendToDocumentList idiom is required, why doesn’t the EDI tutorial use it?

It feels like I’m missing something very fundamental, because this shouldn’t be this difficult. Mapping from one schema to another is bedrock to webMethods. There are visual icons to make this as intuitive and easy as possible. (Far more intuitive and easy than writing XSL stylesheets by hand.)

That makes it even more frustrating for me: I’ve got to be an eejit for missing it so badly. :wink:

I’ve had an easier time writing XSL stylesheets to transform from one schema to another. There’s something wrong with me. Can anyone see it? I’ve gotta get this project up and running, and soon.

I hope there are wM support folks lurking on this forum.



Somewhere along the many post here I’ve lost exactly where you’re stuck right now.
Can you briefly summarize your problem?


Please make sure from your parter that raw EDI string they sent is real data or not.And also point them regarding GE01 count is wrong when there is only one GS i said there might be some manual editing involved when they copied the data and missed to update GE01 count.

appendToDocumentList is not a must in the EDI mapping,but due to your target document structure this service makes easier to build the FF structure as expected.I am not sure why you are not comfortable about using this service.

you are right mapping is much easier in WM no doubt about it,even when it is complex case.So using of buit-in services,custom java services helps to move further.

If you are comfortable understanding the provided WmEDISamples,please proceed with that.

We wmusers will help you further,