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.


#TechXchangePresenter
 View Only
Expand all | Collapse all

how to define arguments values in input of pub.utils:executeOSCommand service

  • 1.  how to define arguments values in input of pub.utils:executeOSCommand service

    Posted Mon April 09, 2018 10:49 AM

    Hi ,
    I am tryin to use pub.utils:executeOSCommand service in wM IS 9.9, for running windows commond. But I am getting error as Invalid argument.
    command :findstr /I /M /S “Arsenal” fullyQualifiedPathOfpackageLocation

    PFB service inputs I am giving
    command:findstr
    arguments: /I
    /M
    /S
    “Arsenal”
    environment: null
    workingDirectory:fullyQualifiedPathOfpackageLocation

    OSCommands.cnf setting
    allowedOSCommands= findstr;dir
    allowedWorkingDirectories= fullyQualifiedPathOfpackageLocation

    Please help how do I have to specify argument values


    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: how to define arguments values in input of pub.utils:executeOSCommand service

    Posted Mon April 09, 2018 12:30 PM

    Hi,

    Are you trying to find a particular string in a folder\file using that command findstr?

    Also can you validate that command with arguments works fine via a putty client ?

    HTH,
    RMG


    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: how to define arguments values in input of pub.utils:executeOSCommand service

    Posted Tue April 10, 2018 03:42 AM

    yes I’m trying to search particuler string via windows command.
    yes I tried that command on cmd box it is working fine and giving me correct results.
    can you please help how to use arguments for that service.


    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: how to define arguments values in input of pub.utils:executeOSCommand service

    Posted Tue April 10, 2018 06:46 AM

    Hi,

    Try using echo instead of findstr to debug what is actually sent to the shell.

    I would suspect the workingDirectory argument will need quoting if the value has spaces in it.

    Good luck.


    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: how to define arguments values in input of pub.utils:executeOSCommand service

    Posted Tue April 10, 2018 08:03 AM

    PFB things which I tried

    1. Ran echo command via executeOSCommand service,with same inputs those are mention above

    Result :com.wm.app.b2b.server.ServiceException: java.io.IOException: Invalid argument

    2.There is no spaces in working directory still I tried with quotes ,I edited config file with quotes and In service given same path without quotes

    Result: com.wm.app.b2b.server.ServiceException: java.io.IOException: Invalid argument


    #Integration-Server-and-ESB
    #webMethods


  • 6.  RE: how to define arguments values in input of pub.utils:executeOSCommand service

    Posted Fri April 13, 2018 12:25 PM

    FINDSTR = Searches for patterns of text in files.

    Try this it is working as expected

    allowedOSCommands=findstr
    allowedWorkingDirectories=C:/Users/Mahesh/Desktop/temp

    Under the above folder, I have a file called “proposal.txt” which contains “Windows I am ready” and the same file is present in subfolders

    When you run the service with below inputs, it will list the expected output. Correct me if there is any issues.

    command findstr
    workingDirectory C:/Users/Mahesh/Desktop/temp
    arguments[0] /m
    … /i
    … /s
    … Windows
    … file name or . To search every file in the current directory and all subdirectories that contained the word Windows,


    #webMethods
    #Integration-Server-and-ESB


  • 7.  RE: how to define arguments values in input of pub.utils:executeOSCommand service

    Posted Fri April 13, 2018 12:26 PM

    Make sure you reload WmPublic package fully after you make any changes to config file.


    #webMethods
    #Integration-Server-and-ESB


  • 8.  RE: how to define arguments values in input of pub.utils:executeOSCommand service

    Posted Fri April 13, 2018 01:14 PM

    Yes this is an post step to note to make the changes work :)-


    #Integration-Server-and-ESB
    #webMethods


  • 9.  RE: how to define arguments values in input of pub.utils:executeOSCommand service

    Posted Mon April 16, 2018 05:05 AM

    thank you @RMG and
    Special thanks to @Mahesh taking time and trying at your end.
    Yes I eqarlier tried with same way the way you have mention I gain retired it but everytime I am getting below error .

    Could not run ‘executeOSCommand’
    com.wm.app.b2b.server.ServiceException: [ISS.0086.9279] Specified working directory [\Server\c$\SoftwareAG_99\IntegrationServer\instances\default\path] is not on the allowedWorkingDirectories list in the OSCommands.cnf file

    after making changes in configFile I reloaded pacakge several times.

    It worked for me when I specified path as \server\c$\SoftwareAG_99\IntegrationServer\instances\default\path\

    problem with it is it gaves error as INDSTR: Cannot open and FINDSTR: Out of memory

    SOLUTION that I have applied as of now I wrote java service to execute command and it is giving me correct results. But it is taking more than 2 min. to fetch the results.
    java code is very simple with the use of process = (Runtime.getRuntime()).exec(Command);
    It would be very helpful if you give your views on executing command quickly in permisiable time. :slight_smile:


    #webMethods
    #Integration-Server-and-ESB


  • 10.  RE: how to define arguments values in input of pub.utils:executeOSCommand service

    Posted Tue April 17, 2018 07:57 AM

    Try with / or //.

    Alternatively, you can also try the service in PSUtilities and the implementation should be same as WmPublic.

    If you still have issues, contact me via email.


    #Integration-Server-and-ESB
    #webMethods