Executing an exe from webmethods

Hi All,
Is it possible to call a ‘.exe’ on a windows platform to call from webmethods.I have IS on unix platform on a different server.Both the exe and webmethods IS are lying on different servers.
SO can I execute a exe from webmethods both being on separate servers?

Thanks,
Santosh

look at this service PSUtilities.misc:makeSystemCall for calling executables. In unix you can configure remotehost to do that and in windows sharing a network folder should do the trick.

To make sure I understand the question:

  • IS running on a Unix box.
  • A Windows .exe available on a Windows box.
  • Launch the remote .exe from IS.

PSUtilities.misc:makeSystemCall will run a program on the IS box. As Adnan points out, network shares can let you run programs whose binaries are another box–but since this is a Windows program you want to run, this won’t work unless you have something like WINE on your Unix install.

If you want to launch the .exe on the Windows box then you’ll need some Unix-hosted mechanism to signal Windows to launch that .exe (ala remote control). I’ve not tried anything like this nor am I aware of simple utilities that would make this easy but there may be something out there to help you do the job.

HTH

I am trying to invoke PSUtilities makeSystemCall Service.

I understand that we have to change PSUtilties.cnf file to append the allowed command list…

I do not know exactly how? Can somebody paste the configuration for executing a windows command?

I’m not familiar with how the config file is done in PSUtilities, but you can do this yourself without a config file using:

myProcess = (Runtime.getRuntime()).exec(“MyProgram”);

A quick google found this page, which is a nice intro:

http://www.mountainstorm.com/publications/javazine.html

Needless to say, it would pay to be careful about how “general purpose” you make this service. That’s why the PS folks added the config file feature.

If IS is running on a Unix box and a Windows .exe is available on a Windows box. You can try Java RMI. Using Mark’s code as the RMI client and the Java service as the RMI server.

It’s NOT an exe file.

Say, I want to use the PSUtilties:makeSystemCall service to execute a windows command…

Use the source, Luke!

IntegrationServer/packages/PSUtilities/config/PSUtilities.cnf is a sample config file which has a sample “allowedCommands” entry. The sample has an entry for running the “dir” command using the command shell.

IntegrationServer/packages/PSUtilities/pub/GEAR 6 PSUtilities Package Documentation.doc is the documentation for the package and contains a description of the “allowedCommands” property.

The source for PSUtilities.misc:makeSystemCall and supporting services, particularly PSUtilities.config:checkParameterValidity, is available.

From these items, one can determine that the allowedCommands list is a ‘*’ delimited list of strings. The “command” parameter passed to PSUtilities.misc:makeSystemCall must match one of the entries in the list exactly.

The current setting in your file (allowdCommands) allows 2 commands:

  1. ping localhost
  2. dir

You should be able to add an additional command by adding an asterisk (*) after the dir, and appending the exact command string you want to allow.

Let us know what changes you make to the file, and if it doesn’t work.

The ping and dir commands itself doesn’t work. I tried to make changes to the Java code, by NOT allowing the parameter check and it works…

But I am trying to use parameter check and still be able to use the allowed commands (dir, ping)

Did you run PSUtilities.config:loadPSUtilitiesConfig to reload the config, reload the PSUtilities package or restart IS after making changes to the config file? Changes to the config file won’t be reflected in execution until one of those actions is completed.

I am using the reload package service, to flush the memory…

But doesn’t help…

You can use PSUtilities.config:getParameterValue and PSUtilities.config:checkParameterValidity to help debug what’s going on with your config file.

Hi,
Can i execute a .sh command in a similar manner as .exe command?

Not sure what you mean by this as .sh are shell scripts particulary devised to run on UNIX based machines whereas .exe are Windows based commands.

HTH
Malhar