After further twiddling, here’s some more information. The key element is the content-type, of which application/edistream has some special considerations.
I believe that the description of content-type in section “The EDI Content Handler and EDI Content Types” in Chapter 7 of the EDI Module: Trading Networks Component guide is wrong. This section appears to be a simple a copy of “The EDI Content Handler” section in Chapter 3 of the EDI Module: Core Component guide with minor edits.
The EDI guide describes application/edistream as a way to use memory efficiently. Perfect. The EDI for TN guide doesn’t add that using application/edistream when submitting to wm.tn:receive 1) doesn’t work; 2) isn’t necessary. Using application/edistream is only necessary when using the EDI Core Component by itself.
I offer the following evidence to support the claim.
Doing this:
pub.file:getFile
…filename=e:\mydir\myfile\multiISA.txt
…loadAs=stream
pub.client:http
…url=http://localhost:5555/invoke/wm.tn/receive
…method=post
…loadAs=bytes (note this is for the response, not the post)
…data/stream=body/stream from getFile
…auth/type=basic
…auth/user=[user]
…auth/pass=[pass]
…headers/Content-type=application/EDI
pub.string:bytesToString
…bytes=body/bytes (which now has the response)
…encoding=UTF-8
works just fine. Note that the content type is application/EDI, not application/EDIstream as it was in the previous post. I haven’t configured the large doc handling stuff yet but that’s next on the agenda.
The content handlers for application/edi, application/x12, et. al. all put “edidata” var into the pipeline. For all but application/edistream, edidata is a String. So http/ftp clients simply set the content-type to one of the EDI content handler-supported types and viola, edidata shows up in the pipeline. wm.tn:receive supports this.
If the content-type is application/edistream, edidata is not a String but is a java.io.InputStream object. wm.tn:receive does not support this and errors out.
So how can EDI documents with content-type of application/edistream be passed to wm.tn:receive? My best guess is that they can’t. Nor do they need to be. Using the “normal” content-types, the TN large doc handling ought to kick in just fine.
If someone needs to send a content-type of application/edistream, one needs to write a “front-end” service to simply redirect the edidata input stream to the pub.client:http data/stream. A simple service named receiveX12Stream does this easily:
pub.client:http
…url=http://localhost:5555/invoke/wm.tn/receive
…method=post
…loadAs=bytes (note this is for the response, not the post)
…data/stream=edidata
…auth/type=basic
…auth/user=[user]
…auth/pass=[pass]
…headers/Content-type=application/EDI
So application/edistream submitters would invoke not wm.tn:receive but this receiveX12Stream service instead, which re-types the content and passes it on. Of course one can add in some checks to make sure the content-type is right and do the right thing. Ultimately, wm.tn:receive needs to be able to accept InputStream objects.
Sorry for the lengthy post. Hopefully this helps someone. It helped me!!