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
  • 1.  Read from File --> LookupTable

    Posted Tue June 20, 2017 08:14 AM

    Hello,

    i need an help

    i have to convert some values. If in my input string is “A” i have to convert it in 1, if “B” in 2, “C” in 3 etc etc.
    I used the LookUpTable and it works fine.
    However i need to put this key/values in a file and then read the file and do the conversion.

    How can i solve this problem?

    Thank you,

    MS


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


  • 2.  RE: Read from File --> LookupTable

    Posted Tue June 20, 2017 11:47 AM

    Hi Matteo,

    what about using pub.string:lookupDictionary instead of pub.string:lookupTable?
    It is using a Hashtable instead of a String-Array.
    You can create this Hashtable by using the services from pub.hashtable-Folder after you have read the keys/values from your file.
    You can use the services from pub.file-Folder to read in the fiile.

    Regards,
    Holger


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


  • 3.  RE: Read from File --> LookupTable

    Posted Wed June 21, 2017 05:41 AM

    Hi Holger,

    it’s seems very interesting. Can you please tell me more?
    Can i store the hashtable in memory so i don’t have to read every time the configuration file?

    Can you please be so kind to show me step by step witch flowservices i have to use?

    Thank you


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


  • 4.  RE: Read from File --> LookupTable

    Posted Wed June 21, 2017 09:08 AM

    Hi Matteo,

    create a flow service to create the hashtable from file.
    Define the hashtable as output and set the service to caching enabled.

    pub.file:getFile
    pub.hashable:createHashtable

    Whenever you need access to the hashtable call this service and then use pub.string:lookupDictionary to query the hashtable.

    See IS Built-In-Services Guide for further informations.

    Regards,
    Holger


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


  • 5.  RE: Read from File --> LookupTable

    Posted Wed June 21, 2017 09:29 AM

    Hi Holger,

    i’m noobie and maybe not able to complete the service

    As you can see in the image there is no input for the hashtable. How can i map [/img]the string from getfile and, other question, can you please provide to me an example of a hashtable file?

    Sorry but i feel just a bit confused


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


  • 6.  RE: Read from File --> LookupTable

    Posted Wed June 21, 2017 09:44 AM

    Holger,

    i just updated the post above because the link to the img was broken


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


  • 7.  RE: Read from File --> LookupTable

    Posted Wed June 21, 2017 11:31 AM

    Hi Matteo,

    most likely your file is some sort of a properties file containig key/value pairs.

    You will have to iterate over the pairs and add them to the hashtable using pub.hashtable:put.

    Regards,
    Holger


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


  • 8.  RE: Read from File --> LookupTable

    Posted Wed June 21, 2017 11:57 AM

    I can decide how to build my file.

    What is the best format? an xml structure?


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