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.

Mouli.

Look in the WmSamples package.

Guys,

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.

Avner

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 java.io.File 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.

Hi,

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

sample.commandLineExec:fireCommandExec

in adetailed manner.

Thnks in advance

Mouli.

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

IDataCursor myCursor = pipeline.getCursor();

myCursor.first(“fullPath”);
String fullPath = (String) myCursor.getValue();
myCursor.destroy();

java.io.File f = new java.io.File(fullPath);
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.