Submit EDI to Trading Networks


How do you submit more than one EDI documents to TN separately? The built-in service routeXML works if only one EDI doc needs to be submitted, but when I tried to call routeXML twice in one flow, the 2nd EDI doc never shows up in TN, instead, the 1st EDI appeared twice. Results in Pipeline show that the input for the 2nd routeXML is the right EDI string though.

Thanks for your help,

When the first routeXML returns, make sure you dump things you no longer need from the pipeline, particularly the bizdoc record.

Thanks Rob, I did have the bizdoc and node dropped, but no use.


Is this inbound or outbound? Can you share some more details.


It’s outbound EDI.
I created an EDI doc in String and send to TN using Then called rounteXML to send in another EDI in string, TN Transaction shows both doc as the first EDI.
To test, I sent in an EDI doc and an XML doc(converted to node by stringToDocument) both using routeXML, the result is that if I send in EDI first, then the EDI doc will show twice in TN and no XML in there; if I send in the XML node first, by dropping the node and bizdoc, I can see one XML and one EDI in TN.
It seems to me like a bug in routeXML, some variable persists in memory and can’t be cleared by dropping the known variables.

Any thought? Is there another service I can use to submit string to TN?


What is the name of the string that you are mapping the edi data to? If it is ‘edidata’, then this field will be sent behind the scenes and take priority when calling routeXML even if you specifically map the *node object into routeXML. Hope this helps…


Yes, the string name is edidata. And I did drop edidata and node before calling routeXML the second time …



I’m not using routeXML.
Here’s what I’ve done, in my case it is Outbound X12 810 Invoices:

  1. Loop through the flat files from backend mapping each Invoice. The flat file is sorted by customer so that I can get one envelope per partner vs. one document per envelope.
  2. I then use pub.schema:validate to validate the document.
  3. Then I use wm.b2b.edi:convertToString to convert my EDIRecord to string. At this point my EDIRecord contains the ST right through to SE segments.
  4. I then append my EDIRecord to a stringList EDIDocumentList. Therefore many ST/SE in the list. Once the customer changes in the flat file it’s now time to ready the EDIDocumentList for TN.
  5. I use wm.b2b.edi.util:addGroupEnvelope to add the GS/GE
  6. Use wm.b2b.edi.util:addICEnvelope to add the ISA/IEA
  7. I then use pub.client:http to post to TN. Set the content-type to application/EDI or application/EDIStream in IS4.6

The above makes the following assumptions.

  1. That you have read the EDI Users guide and have loaded the necessary EDI documents into TN. You should see doctypes such as X12 4010 810.
  2. You have defined processing rules for the particular doctype that you are working with. Ray Jasko has some good ideas on what type of rules you need. Search ITToolbox for “EDI Transactions in TN”. There’s good info there.

Kinda long winded but I hope it helps.
Let me know if you need more info.



EDI itself was correctly generated and processing rules were setup. The first EDI gets processed successfully, the problem is the second document submitted doesn’t show.
I tried to used http post as you recommended, however have two questions:

  1. what URL do u use? /invoke/ ¡H
  2. where to map the EDI string to? I mapped it to data/string, but TN doesn’t seem to recognize the doc.

Thanks for your detailed information.


yes I’m using /invoke/
I’m also mapping to data/string.

Can you attach the contents of the unrecognized document?
What are you seeing in your Transaction Analysis?
For every group of outbound documents you should see the following doctypes:
one “X12 Envelope”, One “X12 Group”, and one or more “X12 4010 810”.

Which one is not being recognized?


ps. if you want to take this off line send me an email direct.

Hi Lina,
Try adding a string field $edidata (or edidata) under data/args for the HTTP client input and map your EDI data to that instead of using data/string.

PU, adding an edidata gave me a java exception.

However, my problem was solved by dropping variable editn_env in pipeline.

Thank you guys for all your response!


Lina - I just came across your thread. I have seen problems with using routeXml - we worked around it by calling and seperately.

Also, maybe your problem have also been solved by using pub.flow:clearPipeline to drop all variables except ones named in the ‘preserve’ input.