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.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
Expand all | Collapse all

Need help in designing a service

  • 1.  Need help in designing a service

    Posted 03/04/14 09:52 AM

    Hi All,
    My requirement is getting data from db and creating a csv file with that. I followed the below steps.

    I got the data from db with my required columns say col1,col2 and col3. When i am trying to append everything to a string, i am not getting expected resultSet. I first initialized errorData string variable with empty string.

    PFA dia and help to meet my requirement.

    Thanks,
    RP


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


  • 2.  RE: Need help in designing a service

    Posted 03/04/14 10:11 AM

    Why not use getTracedataOutput/results/BID directly, don’t need to specify index, results will become a single document in the Loop.


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


  • 3.  RE: Need help in designing a service

    Posted 03/04/14 01:33 PM

    since you are looping over getTracedataOutput/results, you should remove the index of [$iteration], directly use:
    %getTracedataOutput/results/BID% for inString2.

    I think Xiaowei is saying the same.


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


  • 4.  RE: Need help in designing a service

    Posted 03/05/14 02:44 AM

    Hi,
    Both options will work but the mistake tat i did was, didn’t select “Perform variable Substitution” button. Now its working fine.

    Now my input string contains value -bid1,tid1bid2,tid2bid3,tid3

    How can i make this as below

    bid1,tid1
    bid2,tid2
    bid3,tid3

    And how can i write the same into xls in 2 diffreent columns. Kindly guide me.


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


  • 5.  RE: Need help in designing a service

    Posted 03/05/14 03:40 AM

    You can append “\r\n” after “%getTracedataOutput/results/TID%” like “%getTracedataOutput/results/TID%\r\n”, then you will get the errorData like:
    bid1,tid1
    bid2,tid2
    bid3,tid3
    Save the errorData string into a file named whatever.csv, you don’t need to do something to maintain the columns, Excel will do it.


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


  • 6.  RE: Need help in designing a service

    Posted 03/05/14 04:31 AM

    Hi Wang,

    I tried in the same way but in the string, its coming like
    bid1,tid1\r\nbid2,tid2\r\nbid3,tid3\r\n

    and in giving this to a java service, in file name providing .xls as extension but in .xls file, everyting is coming in a single column.

    Still trying other options, please share if you have any tweaks.

    Thanks,
    RP


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


  • 7.  RE: Need help in designing a service

    Posted 03/05/14 05:46 AM

    Hi,
    I tried a sample service my errorData looks like bid1,tid1,error1 bid2,tid2,error2 bid3,tid3,error3

    You can tokenize the string based on space character and then remove the comma if you need (customize the code).

    valueList will look like
    bid1,tid1,error1
    bid2,tid2,error2
    bid3,tid3,error3

    Pass this as your second input to string concat.
    %Mahesh.SAG:getTracedataOutput/getTracedataOutput/results/BID%,%Mahesh.SAG:getTracedataOutput/getTracedataOutput/results/TID%,%Mahesh.SAG:getTracedataOutput/getTracedataOutput/results/ERROR%[one space at last]


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


  • 8.  RE: Need help in designing a service

    Posted 03/05/14 09:28 AM

    Sorry, it’s my fault, it won’t work in that way. You can right click on the input control, and click “Use larger editor” as attached screen-shot, in this editor you can type a carriage return.
    larger editor.png


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


  • 9.  RE: Need help in designing a service

    Posted 03/05/14 02:06 PM

    Hello,
    Try out what Xiaowei Wang or I suggested. It should work :slight_smile:


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


  • 10.  RE: Need help in designing a service

    Posted 03/20/14 03:11 AM

    Hi,
    When i am writing everything to a string list and finally when i am passing it to a fileWriter service,it is just taking very 1st line of String list and writing to a file (is it just because fileWriter takes string as an input ).

    When i tried differently like keeping everything in to a single variable say –

    final String : bif1,tif1"\r\n"bif2,tif2"\r\n"bif3,tif3"\r\n", when i am writing this to a file it is writing file content too with the same data instead of appending new line in place of “\r\n”.

    Kindly help me


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


  • 11.  RE: Need help in designing a service

    Posted 03/24/14 03:23 PM

    Hi RP,
    Is this issue resolved?

    Did you try the steps suggested as above.


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


  • 12.  RE: Need help in designing a service

    Posted 03/25/14 12:31 AM

    Thanks Mahesh and Wang for your inputs here.

    I tried the way which Wang suggested but still i am not getting my desired output.

    With the below output there is no use – bif1,tif1"\r\n"bif2,tif2"\r\n"bif3,tif3"\r\n"

    By writing some logic, i am able to produce the below output as part of StringList

    bid1,tid1,error1
    bid2,tid2,error2
    bid3,tid3,error3

    But when i am trying to write to a file, as writeToFile service takes only only a string, its not writing details which are other than 1st line.

    Hence final output to file is – bid1,tid1
    Thanks,
    RP


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


  • 13.  RE: Need help in designing a service

    Posted 03/25/14 10:36 AM

    You can right click on the input control, and click “Use larger editor” as attached screen-shot, and HIT enter the cursor and close the setValue and save it.\

    This will start give the new line feeds…

    HTH,
    RMG


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


  • 14.  RE: Need help in designing a service

    Posted 03/25/14 03:17 PM

    RP,

    Did you try the steps suggested by me in this post. I had replicated the service as per your requirement and it worked for me without any issues :slight_smile:

    Share your code (PKG) let me have a look at that.


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


  • 15.  RE: Need help in designing a service

    Posted 03/27/14 11:05 AM

    Hi All,

    It’s working fine now. Thanks for your helping hands !!!

    Thanks,


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


  • 16.  RE: Need help in designing a service

    Posted 03/27/14 12:53 PM

    Glad to hear it resolved now…if you can update the final resolution would be good for this thread n others:


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