Thread: [Soaplab2-dev] ACD outfile problem: how do you return a file?
Brought to you by:
marsenger
From: Tom C. <tc...@cs...> - 2008-07-09 10:15:21
|
Hi, I'm trying to expose a Java program as a web service using soaplab2 (2.1.1), but I am unable to return the wav audio output file that it generates. It uses a -dumpAudio flag to output to a file, otherwise the audio is played on the server (sent to the audio stream - not ideal for a web service). This is how I have encoded the dumpAudio parameter in the ACD file: # -dumpAudio <file> flag string: dump_audio [ qualifier: dumpAudio standard: "Y" default: "output.wav" information: "dump audio to this file (default: output.wav)" comment: defaults comment: "display false" ] it's hidden from the user so will always output to a file. My outfile definition is: outfile: output [ comment: "mimetype audio/x-wav" comment: bindata comment: "make_url yes" ] but when I run the process, it succeeds but I am unable to access output.wav: -------------------------------------- Summary: Completed: Successfully Termination status: 0 Started: 2008-Jul-09 11:08:18 (BST) Ended: 2008-Jul-09 11:08:21 (BST) Duration: 0:00:03.210 Report: Name: text_to_speech.freetts Job ID: [text_to_speech.freetts]_4ca7ea84.11b07436c4e._7ffe Program and parameters: java -jar /opt/freetts-1.2.1/lib/freetts.jar -dumpAudio output.wav -text Hello World! -output /home/tc/apache-tomcat-6.0.16/temp/_R_/SANDBOX/[text_to_speech.freetts]_4ca7ea84.11b07436c4e._7ffe/o_output --- end of parameters Exit: 0 Standard output stream: Wrote synthesized speech to output.wav -------------------------------------- no URL or output is generated, only the "report" and "detailed_status". When I looking in the location above on the server there is the output file, but why is no URL generated? Am I doing something incorrect with the outfile definition? Is it possible to return the file via Spinet? Thanks for your help, Tom -- Tom Crick Mathematical Foundations Group Department of Computer Science University of Bath tc...@cs... http://www.cs.bath.ac.uk/tom/ |
From: Martin S. <mar...@gm...> - 2008-07-10 06:30:55
|
Hi, It uses a -dumpAudio flag to output to a file No, I am afraid it does not. The dumpAudio is a string, not an outout file. Soaplab has no idea that the underlying application uses this parameter as an output file - it just takes its value (e.g. the string 'output.wav' literally as a command-lien option but it does not do anything else with it. The only output file the Soaplab sees is the one defined in the 'output' paremeter (and Soaplab give it its own name). If your applicatation has a hard-coded name for the output file, you are out of luck, at least now. You have to wrap you script into few lines that can map the hard-coded file name into the one given by Soaplab (in your exanple, it was: /home/tc/apache-tomcat-6.0.16/temp/_R_/SANDBOX/[text_to_speech.freetts]_4ca7ea84.11b07436c4e._7ffe/o_output). I think that all your observed problems have the same cause: your application uses the -dumpAudio parameter for the output file, but Soaplab consideres the -output parameter as the one for the output. Cheers, Martin PS. Sorry if I do not reply for your other emails soon - but I will be for next about ten days on my holiday, and I may not be always available on-line. M. -- Martin Senger email: mar...@gm...,m.s...@cg... skype: martinsenger |
From: Tom C. <tc...@cs...> - 2008-08-29 16:42:18
|
Hi, [bringing up an old thread, original problem now solved...] Martin Senger wrote: > Hi, > > It uses a -dumpAudio flag to output to a file > > No, I am afraid it does not. The dumpAudio is a string, not an outout file. > Soaplab has no idea that the underlying application uses this parameter as > an output file - it just takes its value (e.g. the string 'output.wav' > literally as a command-lien option but it does not do anything else with it. > The only output file the Soaplab sees is the one defined in the 'output' > paremeter (and Soaplab give it its own name). > > If your applicatation has a hard-coded name for the output file, you are out > of luck, at least now. Ah...is there any way I can get around this? I have an application that output nine different text files, all with hard-coded names! > You have to wrap you script into few lines that can > map the hard-coded file name into the one given by Soaplab (in your exanple, > it was: > /home/tc/apache-tomcat-6.0.16/temp/_R_/SANDBOX/[text_to_speech.freetts]_4ca7ea84.11b07436c4e._7ffe/o_output). But won't this change every time? > I think that all your observed problems have the same cause: your > application uses the -dumpAudio parameter for the output file, but Soaplab > consideres the -output parameter as the one for the output. Thanks, Tom |
From: Martin S. <mar...@gm...> - 2008-09-09 18:29:04
|
> Ah...is there any way I can get around this? I have an application that > output nine different text files, all with hard-coded names! > > > You have to wrap you script into few lines that can > > map the hard-coded file name into the one given by Soaplab (in your > exanple, > > it was: > > > /home/tc/apache-tomcat-6.0.16/temp/_R_/SANDBOX/[text_to_speech.freetts]_4ca7ea84.11b07436c4e._7ffe/o_output). > > But won't this change every time? Yes, the file name will be different each time, but the parameter name not. What I meant was this: Because your application produces 9 output files, you have to define nine outputs in the ACD file. To each of them, you create a parameter name - any name of your choice; for example: out1, out2, ...out9. Then you write a wrapper that explores the command line create by Soaplab and convert it into your nine hard coded names. For example, Soaplab will produce a command-line like this: wrapper -out1 /home/tc/apache-tomcat..../o_output -out2 /home/tc/.... -out3 blah/blah... and the task of your wrapper is to take the value of the parameter '-out1' (which is /home/tc/apache-tomcat..../o_output) and convert it into a single name that your application expects. And so on, for all -outX parameters. For example, a wrapper in Perl may be like this (just for three hard coded outputs; replace 'echo' by the name of your real program): #!/usr/bin/perl -w # use Getopt::Long; my ($hard1, $hard2, $hard3); GetOptions ("out1=s" => \$hard1, "out2=s" => \$hard2, "out3=s" => \$hard3); exec ('echo', $hard1, $hard2, $hard3); This wrapper changes this input arguments: --out1 value1 --out2 value2 --out3 valu3 into this: value1 value2 value3 A site comment: In order to let Soapab generates a command-line with the 'long' options - the ones started with double dashes, you use in the ACD file the 'option: method', For example: outfile : out1 [ option: "method --&& $$" ... ] But this was just because my example wrapper is using the long options. You can also write an ordinary wrapper that takes only one-letter arguments and, therefore, can use just simple Getopt. An example of such wrapper could be this: use Getopt::Std; our ($opt_a, $opt_b, $opt_c); getopt ('abc'); exec ('echo', $opt_a, $opt_b, $opt_c); converting: -a value1 -b value2 -c value3 into: value1 value2 value3 Cheers, Martin -- Martin Senger email: mar...@gm...,m.s...@cg... skype: martinsenger |