How to save pipeline in a string or stream


I need to reuse the data retrieved by the savePipelineToFile.
Could you tell me tell where I can find the code source of this service please ?
(or maybe could you share me the portion code if you know it ?)

I need to code my own service Java because I don’t want the data saved in a file (but just in a string or a stream).


Hi Cedric,

what about using savePipeline instead of savePipelineToFile?
For both of these there is a corresponding restore service.


Thank you Holger but if I need to get the data to put it in a db table field (through a jdbc adapter), I don’t understand how savePipeline can help me (if I can’t get the memory data to put it in a string variable before)

Hi Cedric,

in this case you might want to have a look into the IntegrationServer JavaAPI Documentation.

You can get access to the pipeline by using an IDataCursor.
This one should also have a toString() method.
Then use a second IDataCursor to return the string representation of the pipeline.


I already used Java code to get the key/value of pipeline… and it works.
but because I would like to avoid to reinvent the wheel, I was looking to find an existant java service in wmPublic that already does the same thing, or using the java code of savePipeline would have the best solution for me.

There is a service for this. IIRC its name is documentToXmlValues (or something like that). The result XML string is not very nice, but it can be easily (and unabmiguously!) converted back to a document (with another service).

You can write a java services.

IDataMap iMap = new IDataMap(pipeline);
IDataJSONCoder jsonCoder = new IDataJSONCoder();
ByteArrayOutputStream encodedStream = new ByteArrayOutputStream();
jsonCoder.encode(encodedStream, pipeline);
String jsonString = new String(encodedStream.toByteArray(), “UTF8”);
iMap.put(“pipelineJason”, jsonString);

Thanks a lot.
If this java code creates such an XML representation String below (like savePipelinetoFile does), it will be fine :slight_smile:


<?xml version="1.0" encoding="UTF-8"?>

<IDataXMLCoder version="1.0">
  <record javaclass="">
    <value name="fileName">\\Mif-srv-dat01\REF1\Doc1\PRIVE\test.txt</value>
    <value name="var1">valeur1</value>
    <value name="input1">valeur1</value>


I used IDataXMLCoder to generate an XML string from the pipeline and it works well (thank you Franck).

But without using any Java service, how do you do Fml2 to use DocumentToXmlString?
(how do you pass the pipeline in its Input Document)?

I don’t know how to do it without a java service.

And using a Java service how do you pass the pipeline to the DocumentToXmlString service ?

I’ve tried to make a little java service that returns only a IData var as pipeline, but when I pass this to the DocumentToXmlString service, it does not work…

The name of the service is documentToXMLValues; IIRC, it’s in the folder pub.document.

Oups… Thank you Fml2 … So I would have the same question :wink:

I’ve tried with documentToXMLValues… but I don’t understand what do you pass as Input to this service ?
I have an IData pipeline, so I don’t understand how to you pass IData to Document for your service.
And I can’t convert first my pipeline to Document, because in my case, the pipeline may be always different (and have different structures depending of the java service from which it is called)

In any case, no problem, I can keep the whole java service solution (suggested by Frank xu) that works fine for me.

You could write a java service that returns the pipeline as a document. Then you could write a flow service that calls the java service and then the documentToValues service.

But if you already have an acceptable solution – stick with it, there are certainly other things to do.