I'm a bit stuck with an issue. I'm developing a Java/Swing desktop application to run some Soap test. To run the Soap test I perform a curl call.
So, when I run this code:
public int excuteCommand(String cmd, Process pcs) throws IOException, InterruptedException{
Runtime run = Runtime.getRuntime();
pcs = run.exec(cmd);
return pcs.waitFor();
}
The application freezes.
This is the part of the code which invoques the function above:
Process ps = null;
try{
//1. prepare inputFile.xml
//2. create outputFile.xml (if not exists, Win compatibility)
//3. create curl command
Curl oCurl = new Curl();
oCurl.setData(inputFile); //inputFile should contain SoapEnvelope and CDATA request
oCurl.setProxy(settings.getProxy()); //maybe there's proxy setting
oCurl.setHeader(settings.getHeader()); //set content-type and charset
oCurl.setAction(settings.getAction()); //set SOAPAction
oCurl.setTarget(settings.getTarget()); //set http://server:port/service target
oCurl.setOutput(outputFile); //set output file
String cmd = oCurl.getCommand();
if (executeCommand(cmd, ps) == 0)
consoleLog("Test complete!", INFO_LOG);
}catch(Exception e){
consoleLog(e.getMessage(), ERROR_LOG);
}finally{
if (ps != null)
ps.destroy();
}