Using pubclienthttp to send an EDI message between 2 servers

Hi,

In various messages it is mentioned that the instructions for sending EDI documents via HTTP in the EDI core component guide (pages 15/16) is wrong, they do not however specify what exactly should be done!

I am trying to send an EDIFACT message via HTTP with the following parameters:
URL: [url=“http://localhost:5555/invoke/test/MNReceive”]http://localhost:5555/invoke/test/MNReceive[/url]
method: POST
data-String: EDIFACT message (BGM, NAD, REF etc)
headers- name: content-type
headers-value: application/EDIstream

The service MNReceive has 1 string parameter (edidata). The service MNReceive is called correctly, but the parameter edidata is not filled.

It seems as if the content-type i set is being ignored, as in the return parameter from the http call, header, the content-type used was text/html. Do i have to somehow tell the server that i want to use the content-type application/EDIstream…or does anyone have any other ideas what i am doing wrong?

Thanks for any help,
Mark

Using application/edistream is probably tripping you up. When this content-type is used, the resulting pipeline object is an input stream, not a string.

[url=“wmusers.com”]wmusers.com has a bunch of discussion about the various content-types.

Options:

  • Change the content-type to application/EDI
  • Change the service to accept either a string or an InputStream. The input parm named edidata should be an object, not a string. In my entry service, I call a Java service that accepts edidata as a string or a stream and returns a string.

HTH

Hi Rob,

Changing the content-type to application/EDI seemed to do the trick. The service now receives the data in the edidata String. Thanks!

I then tried changing the edidata parameter to an object in order to use the EDIstream content-type (wm seems to recommend this in order to conserve memory and we will be sending large messages). This still didn’t work however.

Mark

When edidata is an Object in the pipeline, and the content-type is application/edistream, the edidata var holds a reference to a java.io.InputStream object. To use this object you’ll need to use Java services to read from the stream and/or follow the large document handling procedures identified in the EDI docs.

Pipeline vars that hold references to Java objects are not viewable in the results tab (you’ll see an address) nor do they get saved to disk/memory using the savePipeline* services. Thus, it looks like the var isn’t present, but it is. You can confirm this by testing edidata in your FLOW service with a branch:

BRANCH on /edidata
…$null: MAP – set a var indicating no edidata
…$default: MAP – set a var indicating edidata is not null

then save the pipeline, or write a log entry or something else to confirm that edidata is set or not.

You’ll need to put in a test to see if edidata is a String or an InputStream and then process accordingly. You’ll need to write a Java service for this.

HTH