Calling an bat or an kershel shell script from webmethods

Hi all,

I was curious to know if we have any built in services in webMethods which invokes an batch application (.bat) or an shell script from webMethods.I know that we can do that by using Runtime classes in java and creating a custom service to do the needed.But i am not sure of the code for that. so could any one help me out in this.

Thank You

I guess, You can write a Java service similar to the sample service “sample.commandLineExec:fireCommandExec” to execute a batch script.

Small piece of advice when using Runtime.exec(): make sure you handle the process’ output and error streams properly. If your process does not generate any output, you can probably get away with simply executing exec() and not having to do anything else. However, if your process does generate output, depending on the amount of output generated, your process will block if you do not handle the streams properly. Take a look at when you get a chance:
[url=“http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html”]Welcome to JavaWorld.com

Let me know if you need further help.

  • Percio

Percio,
Great article in there. Thank you.

Hi All,

Thanks alot guys, and sekay is the service built in service in webMethods “sample.commandLineExec:fireCommandExec”.Once again thamk and give a try to do run this service.
bye

sorry
i mean i will give a try to run this service and let you know if i have any doubts.
Thank you…