IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

How to save pipeline in a string or stream

  • 1.  How to save pipeline in a string or stream

    Posted Mon January 28, 2019 08:46 AM

    Hi,

    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).

    Regards


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 2.  RE: How to save pipeline in a string or stream

    Posted Mon January 28, 2019 02:35 PM

    Hi Cedric,

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

    Regards,
    Holger


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 3.  RE: How to save pipeline in a string or stream

    Posted Mon January 28, 2019 03:28 PM

    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)


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 4.  RE: How to save pipeline in a string or stream

    Posted Tue January 29, 2019 10:07 AM

    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.

    Regards,
    Holger


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 5.  RE: How to save pipeline in a string or stream

    Posted Tue January 29, 2019 10:37 AM

    Holger,
    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.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 6.  RE: How to save pipeline in a string or stream

    Posted Tue January 29, 2019 06:39 PM

    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).


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 7.  RE: How to save pipeline in a string or stream

    Posted Wed January 30, 2019 03:41 AM

    You can write a java services.

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


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 8.  RE: How to save pipeline in a string or stream

    Posted Wed January 30, 2019 08:26 AM

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

    Regards

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <IDataXMLCoder version="1.0">
    <record javaclass="com.wm.data.ISMemDataImpl">
    <value name="fileName">\\Mif-srv-dat01\REF1\Doc1\PRIVE\test.txt</value>
    <value name="var1">valeur1</value>
    <value name="input1">valeur1</value>
    </record>
    </IDataXMLCoder>

    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 9.  RE: How to save pipeline in a string or stream

    Posted Mon February 04, 2019 01:06 PM

    Hi,

    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)?


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 10.  RE: How to save pipeline in a string or stream

    Posted Mon February 04, 2019 03:29 PM

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


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 11.  RE: How to save pipeline in a string or stream

    Posted Mon February 04, 2019 04:15 PM

    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…


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 12.  RE: How to save pipeline in a string or stream

    Posted Mon February 04, 2019 05:52 PM

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


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 13.  RE: How to save pipeline in a string or stream

    Posted Tue February 05, 2019 04:44 AM

    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.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 14.  RE: How to save pipeline in a string or stream

    Posted Wed February 06, 2019 01:38 PM

    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.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB