Firecommandexec service in WmSamples package

Can someone tell me how this works? I have .bat file I can execute by double clicking just fine. Attempting to run it via this service using a fullcommand of “cmd batfile.bat” returns a success flag of “true” but the bat file is not running. Where does the .bat file need to reside? Is there something else I’m missing?

the fire exec command should run the command but not provide output. you can ensure this is going on my creating a batch file which produces a file or writes something etc.

to get output
you need to do something like this:
Process child = Runtime.getRuntime().exec(fullCommand);

InputStream in = child.getInputStream();

// print out stream
BufferedReader din = new BufferedReader ( new InputStreamReader ( in ) );
String txt = null;
StringBuffer strBuf = new StringBuffer ();
while ( ( txt = din.readLine () ) != null )
{
strBuf.append ( txt + “\n” );
}
idcPipeline.insertAfter(“output”, strBuf.toString());

remember also to handle the error stream

The batch file I’m submitting does a CD to change to a directory where a program resides and runs an executable with command line parameters that encrypts a file to another file name. So I would expect a new file to show up, like it does when I run the .bat file manually, but it doesn’t when run via this service. Any thoughts? Does that .bat file need to reside where the executable is?

All items are executed from the perspective of the main webMethods directory. I suggest using absolute paths…

Thanx for your assistance, I was able to get it to work…seems kinda silly now…

I am trying to gauge how much memory will be used when loading XML documents into memory. Suppose I have an XML document of size X kilobytes or has Y kilobytes of information

Is there a good way of determining how much memory would be used in loading it into a record structure?

I want to determine the upper limit of how large an XML can be loaded into a wM record structure. I suppose this will depend on the heap size, but I need to understand this a bit more.

It depends how you load the XML into webMethods. For least memory consumption, load the file as a stream and use the NodeIterator to extract the data you want. The main memory culprit is documentToRecord if the ‘document’ is the entire file. By creating smaller nodes using the NodeIterator you minimize what is loaded into memory. Set your JVM memory allocation to at least 500MB.

If you load a 5meg XML file, the getFile (using bytes) method will reduce the available memory by 5megs.

Have a look at the large document handling docs.

I’m having the same issue with the fireCommandExec file… I try to invoke a shell script that works perfectly from the command line and I get the successFlag fo True but the command never runs…

My shell script simply takes the output of the bdf command(disk space usage) and sends it to a log file. Again, this works fine from command line not from WM…

What was your fix to get it to work correctly?? Script is located in IS46 dir on UNIX and Ive even used a fully qualified path with no results at all… I’m stumped at this point

Here is what my shell script looks like:

#!/usr/bin/sh

bdf | grep ‘WD1’ >> /wm/WD1/disk.log

Ignore my earlier post i have it workingnow

Ignore my earlier post i have it workingnow

Jim: Please add how you solved your own problem. Will help
other users to NOT do it, also will save a future post.

I honestly dont know how I solved it… I just started
working all of a sudden… What I did do was add a sleep
function to the flow to give the script time to run before
looking for the output file… I dont think that was the
solution however… Sorry I cant be more explicit…

I have a same issue. The script file (does encryption) works fine at Unix command line. It doesn’t work in fireCommandExec. I tried the sleep function. It didn’t make differece. Any suggestion?

I am having the same problem. I place a wzzip command in a bat file and place the bat filename in the command for the service (firecommand). The service ends immediately but there is no output at that point. The zip file is produced only after 9 mins. The timings is not consistent sometimes it is 1 mins and sometimes it is 5 mins. Initially I thought it is not working until I put a savepipeline service in the flow and it starts producing output. But i am not quite comfortable with this inconsistent timing. Any suggestions folks ?

Hi Nick,

My objectives of using the firecommand service is becasue I need to zip a file with a password. I have downloaded the zip package that Rob has developed but there is no password capability. I am not good in java which is why I tried to avoid having to code it. So I am thinking if the firecommands helps. What you have suggested sound abit complicated to me. But If come to worse I have to do Java, then modifying the zip service is more feasible to me. Do you think it is difficult to change the zip package to allow password capability ?Not sure if you have seen the code in the first place

Gary,
It’s a good question - I hunted a little on the net for you. Assuming that the code you’re talking about uses java.util.zip.* …

Other people have had your problem:
[url=“Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos”]Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos

 The general solution seems to be implement your own security for what you put within the zip. If you're comfortable doing this, great. Perhaps there's another way to solve your problem. 

 Have you contacted the author of the code you're using? Rob (Eamon?) would probably be interested in hearing about your requirement. 

Nick

Yes I have checked with Rob, he gave me some suggestion. It seems to him that java.util.zip does not support password. I didn’t expect this to be so complicated. I manage to do some flow service using the firecommand service and activating some bat file. Though it works but I am not too satisfied with the time delay of this firecommand.Thks for the url.