Hi Reamon,
Below is the code we are using in wM java svc.
This code was working fine from wM 7.1 till recently, but now we are getting status 128.
Also, while saving a java svc, we are getting an error “cannot compile due to the below errors” and there are no errors listed.
FYI, we have different versions of java in dev and test.
As the svc is not working as expected in dev, we migrated the java svc from TEST.
It seems some where the settings got corrupted
Could you please guide us here if you find some thing.
// DOS Syntax: cmd.exe /c ‘command’
// Example: cmd.exe /c copy log.txt log2.txt
IDataCursor idcPipeline = pipeline.getCursor();
String strOutput = "";
String strError = "";
String strCommand = null;
if (idcPipeline.first("command"))
{
strCommand = (String)idcPipeline.getValue();
}
else
{
return;
}
idcPipeline.first("synchronous");
String strSynchronous = (String)idcPipeline.getValue();
Process process = null;
try
{
process = (Runtime.getRuntime()).exec(strCommand);
if (strSynchronous.equals("true"))
{
// Provide an outlet for IO for the process
String line;
BufferedReader ir = new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader er = new BufferedReader(new InputStreamReader(process.getErrorStream()));
while ((line = ir.readLine()) != null)
{
System.out.println(line);
strOutput += line + '\n';
}
while ((line = er.readLine()) != null)
{
System.out.println(line);
strError += line + '\n';
}
ir.close();
er.close();
process.waitFor();
}
}
catch (Exception e)
{
throw new ServiceException(e.toString());
}
finally
{
if (strSynchronous.equals("true") && process != null)
{
int status = process.exitValue();
idcPipeline.insertAfter("status", Integer.toString(status));
}
idcPipeline.insertAfter("output", strOutput);
idcPipeline.insertAfter("error", strError);
process.destroy();
idcPipeline.destroy();
}
#webMethods#Integration-Server-and-ESB#Flow-and-Java-services