Java / Swing卷曲卡住了

时间:2013-05-30 10:05:51

标签: java curl

我有点陷入困境。 我正在开发一个Java / Swing桌面应用程序来运行一些Soap测试。 要运行肥皂测试,我会执行卷曲调用。

所以,当我运行这段代码时:

public int excuteCommand(String cmd, Process pcs) throws IOException, InterruptedException{
   Runtime run = Runtime.getRuntime();
   pcs = run.exec(cmd);
   return pcs.waitFor();
}

应用程序冻结。

这是上述函数的代码部分:

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();
}

0 个答案:

没有答案