How to exceute OS command on a server through webmethod.

Hi,

I have one requirement to execute simple OS command such as dir,move,date etc on a server through wM with the help of pub.utils.executeOSCommand service. So can anyone suggest me :confused: which Directory path and what are the command list should i set inside Wmpublic .cnf file for the following Parameter .

–>allowedOSCommands=
–>allowedWorkingDirectories=

and in the IS Service Parameter

–>command
–>environment
–>workingDirectory

thanks,

Where did you found these parameters documentation from to have it configured? Also from where did you find this Wmpublic .cnf file and does it exist on the IS folders? as I don’t think so they are:

Any reference link you got?

HTH,
RMG

I am referring to OSCommands.cnf file Present inside Integration Server\packages\WmPublic\config directory

i have set the parameter for the OSCommands.cnf file as given below for exceuting simple dir command:-

allowedOSCommands
=dir;
allowedWorkingDirectories=F:\IntegrationServer\packages\Test;

and in wm IS service (pub.utils:executeOSCommand) input Parameter i set the value as:
command=dir
workingDirectory=F:\IntegrationServer\packages\Test

While executing the service from webmethod IS i am getting below error :

An error occurred while tracing.
com.wm.app.b2b.server.ServiceException: [ISS.0086.9279] Specified working directory
[F:\WM9065\IntegrationServer\packages\Test] is not on the allowedWorkingDirectories list in the OSCommands.cnf file

For Reference i am using document link given below -----
http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_sp2/Integration_Server/8-2-SP2_Integration_Server_Built-In_Services_Reference.pdf

could you please suggest what should be the reason for this error and the appropriate solution for the same??:sad:

allowedWorkingDirectories=F:\IntegrationServer\packages\Test;

Is this shared drive/mount directory accessible or permissions to the webMethods user that you using?.

HTH,
RMG

I have the same problem, but I’m working on UNIX

Thank you for your help

What same problem…please elaborate on your question and the exact issue you are having:

In the OSCommands.cnf file Present inside Integration Server\packages\WmPublic\config directory

i have set the parameter for the OSCommands.cnf file as given below for exceuting simple command in fil sh (shell script) :-

allowedOSCommands=/home/webmethods/ls.sh;
allowedWorkingDirectories=/home/webmethods/;

and in wm IS service (pub.utils:executeOSCommand) input Parameter i set the value as:
command=/home/webmethods/ls.sh
workingDirectory=/home/webmethods/

While executing the service from webmethod IS i am getting below error :

An error occurred while tracing.
com.wm.app.b2b.server.ServiceException: [ISS.0086.9279] Specified working directory
[/home/webmethods/] is not on the allowedWorkingDirectories list in the OSCommands.cnf file

PI: the user can access the directory:/home/webmethods/
Thank you

Are you sure is that the directory absolute path?

/home/webmethods/

Can you check the IS folder path from any WinSCP or Filezilla or Putty?

I am sure some thing is not right the IS is looking for accessing the file path.

HTH,
RMG

Hi,

You can also use the Runtime.getRuntime().exec(fullCommand) to get the command executed and capture the details using java io.