Hi all.
I have deployed a test service, which just executes a command in the
server:
Runtime rt = Runtime.getRuntime();
String[] cmd =
{"cmd.exe","/c","C:\\winnt\\system32\\xcopy.exe","c:\a.txt","c:\\logs"};
Process proc = rt.exec(cmd);
and then returns a fixed string:
return "This is the web service running";
In the client I'm using a method to call the service, which is:
public static String stringCall(String endPoint, String
serviceGroup,String serviceName, String[] parameterNames, String[]
parameters){
String result=null;
try{
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endPoint));
call.setOperationName(new
javax.xml.namespace.QName(serviceGroup,serviceName));
for(int i=0;i<parameters.length;i++){
call.addParameter(parameterNames[i],
XMLType.XSD_STRING,ParameterMode.IN);
}
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
System.out.println("Just before calling the service");
result=(String)call.invoke(parameters);
System.out.println("Service called");
}catch(Exception ex){
ex.printStackTrace();
}
System.out.println(result);
return result;
}
When I try to access the service, the following happens. The service is
perfectly reached, and the xcopy command is executed (I get a copy of
the a.txt in the logs file). In the client window I can see the "Just
before calling the service" message, but in a moment between the
return "This is the web service running";
line in the service and the
result=(String)call.invoke(parameters);
line in the client, I get the following exception:
AxisFault
faultCode: {http://xml.apache.org/axis/}Server.userException
faultString: java.net.SocketException: Connection reset
faultActor: null
faultDetail:
stackTrace: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:220)
at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
at java.io.FilterInputStream.read(FilterInputStream.java:111)
at
org.apache.xerces.utils.ChunkyByteArray.fill(ChunkyByteArray.java:222)
at
org.apache.xerces.utils.ChunkyByteArray.<init>(ChunkyByteArray.java:98)
at
org.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultReaderFactory.java:153)
at
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(DefaultEntityHandler.java:493)
at
org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:314)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1097)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:232)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:546)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:377)
at org.apache.axis.client.Call.invokeEngine(Call.java:2132)
at org.apache.axis.client.Call.invoke(Call.java:2102)
at org.apache.axis.client.Call.invoke(Call.java:1851)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
at clientenli.stringCall(clientenli.java:26)
at clientenli.main(clientenli.java:43)
java.net.SocketException: Connection reset
at org.apache.axis.AxisFault.makeFault(AxisFault.java:120)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:551)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:377)
at org.apache.axis.client.Call.invokeEngine(Call.java:2132)
at org.apache.axis.client.Call.invoke(Call.java:2102)
at org.apache.axis.client.Call.invoke(Call.java:1851)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
at clientenli.stringCall(clientenli.java:26)
at clientenli.main(clientenli.java:43)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:220)
at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
at java.io.FilterInputStream.read(FilterInputStream.java:111)
at
org.apache.xerces.utils.ChunkyByteArray.fill(ChunkyByteArray.java:222)
at
org.apache.xerces.utils.ChunkyByteArray.<init>(ChunkyByteArray.java:98)
at
org.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultReaderFactory.java:153)
at
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(DefaultEntityHandler.java:493)
at
org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:314)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1097)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:232)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:546)
... 8 more
I have granted Tomcat full permissions. If I do not try to execute the
xcopy, and just return the string, the service works fine, so I guess
there is some problem in the fact of executing commands in a service.
Any clues/ideas/documentation/similar experiences would be really
welcome, as I am in a hurry, and this does not seem very reasonable.
Thank you very much in advance.
Luis.
--
|===============================================|
Luis Rodrigo Aguado
Laboratorio de Sistemas Inteligentes (ISYS)
Facultad de Inform�tica
Universidad Polit�cnica de Madrid
|===============================================|
"El camino m�s largo siempre empieza con un
peque�o paso"
|===============================================|
- Re: Problem with a deployed service Luis Rodrigo
- Re: Problem with a deployed service Mark Mueller
