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

How can i run windows commands through webMethods?

  • 1.  How can i run windows commands through webMethods?

    Posted 03/04/14 01:07 AM

    Hi Experts,

                I want to run windows commands through webMethods like running batch file or any commands. please help me.
    

    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General


  • 2.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 01:39 AM

    Just the same as how you do it with Java, and there is a build-in service pub.utils.executeOSCommand may be useful.


    #webMethods-General
    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 04:26 AM

    Thank you Xiaowei Wang,

                                    What is the syntax to specify in "allowedOSCommands="
    

    I want to specify ‘fc’ command in allowed commands. I have specified like this, its not working.

    allowedOSCommands=fc
    allowedWorkingDirectories=E:\wMFiles


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General


  • 4.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 05:22 AM

    What do you mean “its not working”, you get some error?

    As I know, you need to specify any parameter you used in allowedOSCommands, not just command name. For exmaple:

    allowedOSCommands=fc fileA fileB


    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 05:30 AM

    Yes i am getting the below error. I Specified as you said, but still getting error.

    com.wm.app.b2b.server.ServiceException: [ISS.0086.9277] Specified command [fc E:\wMFiles\Email_FF.txt E:\wMFiles\PurchaseOrder.txt] is not on the allowedOSCommands list in the OSCommands.cnf file

    Here i am passing input for command is “fc E:\wMFiles\Email_FF.txt E:\wMFiles\PurchaseOrder.txt”


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General


  • 6.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 05:46 AM

    Please try to add the command below into OSCommands.cnf file.
    fc E:\\wMFiles\\Email_FF.txt E:\\wMFiles\\PurchaseOrder.txt


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General


  • 7.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 07:10 AM

    Files with the extension .cnf are not allowed as attachment in the message.

    So i am pasting the content of My OSCommands.cnf

    allowedOSCommands=fc E:\wMFiles\Email_FF.txt E:\wMFiles\PurchaseOrder.txt
    allowedWorkingDirectories=E:\wMFiles


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB


  • 8.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 07:26 AM

    Change the command in OSCommands.cnf to
    fc E:\\wMFiles\\Email_FF.txt E:\\wMFiles\\PurchaseOrder.txt
    And don’t change the service input


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB


  • 9.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 07:52 AM

    Changed the command in OSCommands.cnf

    allowedOSCommands=fc E:\\wMFiles\\Email_FF.txt E:\\wMFiles\\PurchaseOrder.txt
    allowedWorkingDirectories=E:\wMFiles

    Service input
    command

    1)fc E:\\wMFiles\\Email_FF.txt E:\\wMFiles\\PurchaseOrder.txt

    2)fc E:\wMFiles\Email_FF.txt E:\wMFiles\PurchaseOrder.txt

    tried both, getting same error.


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB


  • 10.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 08:03 AM

    Did u refer the built in services reference guide for wM 8.1.2?


    #webMethods-General
    #Integration-Server-and-ESB
    #webMethods


  • 11.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 08:07 AM

    Yeah, they mentioned like

    For example, if the allowed command is cmd.exe /c c:/temp/ab;c.txt , specify it as cmd.exe /c
    c:/temp/ab\;c.txt when specifying it as a parameter for the OSCommands.cnf file.


    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB


  • 12.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 08:44 AM

    Did you reload the WmPublic package? And in your case, working directory input is not required, please notice that.


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General


  • 13.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 09:25 AM

    Didn’t specified the Working directory and Restarted the server.

    Getting same error.


    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB


  • 14.  RE: How can i run windows commands through webMethods?

    Posted 03/04/14 10:42 AM

    Strange, I test in my environment, it works fine.
    Can you save the input of executeOSCommand into file system, and attache this pipeline data and your OSCommands.cnf, so I can verify it in my environment.


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General


  • 15.  RE: How can i run windows commands through webMethods?

    Posted 03/05/14 12:46 AM

    Files with the extension .cnf and .Input are not allowed as attachment,

    so i am uploading the OSCommands.cnf Image

    Input command

    fc E:\wMFiles\Email_FF.txt E:\wMFiles\PurchaseOrder.txt

    Otherwise tell me for basic dir command syntax, i will try for it later.


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General


  • 16.  RE: How can i run windows commands through webMethods?

    Posted 03/05/14 02:22 AM

    I need exactly the files to reproduce your problem, the string you typed may make me confuse, for example there is a space char at the end of your command input.

    I use the attached OSCommands.cnf, and load pipelinedata.xml as input, then successfully run the command as result.png. You can try them in your environment.
    pipelinedata.xml (231 Bytes)
    result.png
    OSCommands.cnf.txt (113 Bytes)


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB


  • 17.  RE: How can i run windows commands through webMethods?

    Posted 03/05/14 03:11 AM

    Its working Xiaowei Wang.

    I really appreciate your patience in problem solving. Thank you very much.


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods


  • 18.  RE: How can i run windows commands through webMethods?

    Posted 05/09/14 08:16 PM

    Hello,

    I am also having problems running windows commands through webMethods. Is there a basic example that will work that I can try and test with?

    This is the command I execute from the command line:
    C:>xcopy.exe c:\MyText.txt c:\Text\MyText.txt

    The command I want to execute the same command from webMethods.

    Also where is this OSCommands.cnf file located? Is it somewhere on the integration server?

    Thanks


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General


  • 19.  RE: How can i run windows commands through webMethods?

    Posted 05/10/14 12:01 AM

    Hi Fred,

    You can execute xcopy.

    I guess webMethods 8.X and above has this file, located at : C:\SoftwareAG\IntegrationServer\packages\WmPublic\config\

    Please make use of config file shared by Wang.

    HTH.

    Thanks,
    Rankesh


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General


  • 20.  RE: How can i run windows commands through webMethods?

    Posted 05/10/14 03:05 AM

    Yes, we have the OSCommands.cnf file from webMethods 8 and above.

    The OSCommands.cnf configuration file in the Software AG_directory\Integration
    Server\packages\WmPublic\config directory contains parameters that Integration Server uses to provide validation checks to make the pub.utils:executeOSCommand service secure.


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods


  • 21.  RE: How can i run windows commands through webMethods?

    Posted 05/10/14 05:46 PM

    Thanks guys! I found the .cnf file.

    I want to make sure I understand how the “pub.utils.executeOSCommand” works. Do I have to put the command in the OSCommands.cnf file as well as specify the same command to my Service input? That seems silly to have to inform webMethods twice for the same call. Can someone clear that up for me?

    Also it appears as if you cannot run executeOSCommand with jre7 due to security issues even if you lower the security. It only works on jre6. Can someone confirm this?

    Best Regards,
    -Fred


    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB