Creating a folder in our system using webmethods service...

Hi All,

can you pls tel me how to create a folder in our system with the given name in

the given path using a web method’s service.

Thanks in advance.


Look in the WmSamples package.


Please note, that the OS level command gets executed on the same user level as the IS engine is running on.

Also I recommed to either execute shell scripts or batch files.


In any other environment, invoking system commands is considered a last resort. Especially, executing shell scripts or batch commands is a big security no-no because it’s so easy to introduce opportunities for command injection attacks this way.

I have worked in environments where auditors would check for the system() and exec() keywords in your code, and refuse to allow it to be run in a production environment.

I see no reason why webMethods should be an exception.

To create a directory, if there is no built in service to do so (I have not checked), I would suggest writing a Java service. There are plenty of examples online of how to use the class to make a directory.

Taking your cue from the built in services, write a simple Java service to do the job. Then you can access it from your flow services.


can you pls explain me how to create new folder using the service


in adetailed manner.

Thnks in advance


Probably just a personal preference… but we like to keep it within java:

IDataCursor myCursor = pipeline.getCursor();

String fullPath = (String) myCursor.getValue();
myCursor.destroy(); f = new;
if (!f.mkdir()){

This is a great point. I would not begin to use an exec()-based operation or create any scripts without checking the webMethods or Java (or C/C++, or VB.NET) libraries to manipulate files or perform OS-level processes. Once these resources are exhausted, then I’d get creative.