I have deployed a webservice using Axis2. It works fine, but ....
Here is a problem: I need to run an external program through the Client, so
I've put in existing library piece of code, which contains
Runtime.getRuntime(). When I run test, it works fine, but no external
program is run. It seems like piece of code with  "Runtime rt =
Runtime.getRuntime();"(it works when is run locally) just ignored...  
Could anyone help me with this issue?

This is class to be wrapped :
package eu.project.samplewebservice;



import java.io.BufferedReader;

import java.io.InputStream;

import java.io.InputStreamReader;




public class SampleExistingLibrary {



    /**

     * Adds two input integer parameters and returns the result.

     * 

     * @param i1

     *            An integer input

     * @param i2

     *            An integer input

     * @return The integer result which is the sum of the two input integers

     */

    public int addTwoIntegers( int i1, int i2 ) { 

        System.out.println( "TEST!!!!!!" );

        ///!!!!!!!!!!!

                String mkcolpath = System.getenv("MKCOLPATH"); 

                String pafpath = System.getenv("PAFPATH");

                //System.out.print(mkcolpath);  

                try

            {            

                Runtime rt = Runtime.getRuntime();

                Process proc = rt.exec("supertux");
 //this is a game
                //pathToCollectionF = pafpath+"/collection.mf";

                InputStream noerr = proc.getInputStream();

                InputStream stderr = proc.getErrorStream();

                InputStreamReader isr = new InputStreamReader(stderr);

                BufferedReader br = new BufferedReader(isr);

                InputStreamReader isr1 = new InputStreamReader(noerr);

                BufferedReader br1 = new BufferedReader(isr1);

                String line = null;

                //System.out.println("<OUTPUT>");

                while ( (line = br1.readLine()) != null || (line =
br.readLine()) != null){

                        System.out.println(line);

                }

                //System.out.println(line);

                //System.out.println("</OUTPUT>");

                int exitVal = proc.waitFor();

                //exitValCl=exitVal;

                System.out.println("Process exitValue: " + exitVal);

            } catch (Throwable t)

              {

                t.printStackTrace();

              }

           

        

        ///!!!!!!!!!!!

        

        

        return i1 + i2;



    }



    /**

     * Concatenates two input string parameters and returns the result.

     * 

     * @param s1

     *            A string input

     * @param s2

     *            A string input

     * @return The string result which consists of two input strings, with
the second input string linked to the end of

     *         the first input string

     */

    public String concatenateTwoStrings( String s1, String s2 ) {

        return s1 + s2;



    }

}


-- 
View this message in context: 
http://www.nabble.com/Problem-with-Runtime.getRuntime%28%29-exec-tp24064489p24064489.html
Sent from the Axis - User mailing list archive at Nabble.com.

Reply via email to