How move JSON File to IS Server

After an HTTP GET request (pub.client:http), I retrieve a JSON file in a documentType.
I would like to save my JSON file on the server before turning it into a String. How to do ?

I believe you cannot save the IData unless you have converted the json document to string during run-time scenario.

Also check by the getTransportInfo flow how is it being received from the source.


Thanks for your answer but I would just move the received JSON file to the server before transforming it. Just to see what’s in the JSON document
Is impossible ?

Yes I believe If you are receiving the jsonString directly then you can write the file to temp location and analyze it.


pub.client:http does not return the body of the response as a document type. It returns it either as a byte array or as an input stream depending on what you set the loadAs variable to. You can do anything you want with that byte array or input stream before converting it to a document type, including writing it to a file. There are services in WmPublic already that will help you with these tasks.


Hi Sabine,

Hope the above solutions will work for you!



In WebMethods, I use the following services:

  • pub.client: http with:
    . the GET method (IN)
    . loadAs = stream (IN)
    . header Authorization (Basic Token) and Content_type (application / json; charset = utf-8) (IN)
    . body in body (OUT)

  • pub.json: jsonStreamToDocument with:
    . body in jsonStream (IN)
    . document in agriJsonDT (OUT) (my document type)

  • pub.json: documentToJSONString with:
    . agriJsonDT in document (IN)
    . prettyPrint (True) (IN)
    . jsonString dasn jsonString (OUT)
    . agrisJsonName (OUT) (my Path and filename .xml)

  • pub.file: stringToFile with:
    . jsonString in data (IN)
    . agriJsonName in fileName (IN)
    . append (true) (IN)
    . encoding (auto-detect) (IN)

It’s Ok, I have an .xml file out but it’s not the Json. It’s transformed. I can not take this xml document and put it back in my stream if I have an error.
Do you have an idea to recover the JSON without transformation

Instead of calling pub.json:jsonStreamToDocument, you could first call pub.file:streamToFile. This would write the raw content to a file. If the JSON document you’re getting is not large (or if you don’t expect the number of concurrent instances of this service to be large), you could even call pub.client:http with loadAs set to bytes instead of stream. This would prevent the need for resetting the input stream, or the need to read the contents from the file that you just wrote, in order to get the document (IData) you need for mapping.

If you use the bytes approach, you could:

(1) Call pub.file:bytesToFile to write the contents to a file
(2) Then call pub.string:bytesToString to convert the bytes to a string (alternatively, you could call
(3) Finally, call pub.json:jsonStringToDocument to get the JSON document (alternatively, if you called bytesToStream in #2, you could call jsonStreamToDocument in this step)

Hope this helps,

Hi Sabine,

If you try use the Percio’s approach it can capture the raw content of the json string (non-transformed) to document structure (IDATA).


Thank you for your answers.
After the pub.client:http invoke, I tried to use the pub.file:streamToFile invoke with:
. fileName (path and filename in variable) (IN)
. body/stream in stream (IN)
. append (True) (IN)
to send json file to the server.

And then pub.json:jsonStreamToDocument

But I have an error “Parameter [JsonStream] is not of type: [InputStream]”

I try again today with the bytes version and I tell you how it happened
Thanks again

Sorry, the expected result is not the one I was hoping for.
When I save the JSON from debug mode via “Save IDATA to local file” I get a file that I can use to run tests and restart my flow. It is this file that I would like to recover but without going through the debug mode.
I attach an excerpt from this file (20180516 - agriJsonDT_extrait.xml)
File result with bytes or stream is in 20180516_123000_pro_cts_extrait.xml
Thank you for your help
20180516_123000_pro_cts_extrait.xml (1.13 KB)
20180516 - agriJsonDT_extrait.xml (2.51 KB)

Ah… that is indeed a very different request. What you want is pub.flow:savePipelineToFile. Try that.


That’s exactly what I wanted.
Thank you very much and have a good day

Did you set loadAs=stream and the receiving service input is set as *contentStream or jsonString??

OK plz try with bytes and let us know.


My new flow is:

  • pub.client:http with:
    . the GET method (IN)
    . loadAs = stream (IN)
    . headers=> Authorization (Basic Token) and Content_type (application / json; charset = utf-8 (IN)
    . header in header (OUT)
    . body in body (OUT)

  • pub.json:jsonStreamToDocument with:
    . body/stream in jsonStream (IN)
    . document in agriJsonDT (OUT) (my document type, document reference $rootArray)

  • pub.flow:savePipelineToFile with:
    . variable agriJsonName (mypath and filename .xml) in filename (IN)

And the result is what I wanted, an XML file that I can reuse.

Then I loop on the agriJsonDT to turn all the fields into a string to send it in SAP.
Do I answer your question?
Thank you for your help

Sounds good with your new flow!!!