SOAP错误:java.net.SocketException:意外的文件结尾
我正在开发一个应用程序,它需要调用使用SOAP1.1开发的SOAP服务。我正在调用的服务是接受文件url(文件应该在internet上可用)和一些其他与文件相关的信息。此服务将文件从位置复制并上载到内部文件位置。当我试图用小文件调用该服务时,我的应用程序工作正常,但当我试图上传大文件时,我得到的错误如下:SOAP错误:java.net.SocketException:意外的文件结尾,java,web-services,soap,Java,Web Services,Soap,我正在开发一个应用程序,它需要调用使用SOAP1.1开发的SOAP服务。我正在调用的服务是接受文件url(文件应该在internet上可用)和一些其他与文件相关的信息。此服务将文件从位置复制并上载到内部文件位置。当我试图用小文件调用该服务时,我的应用程序工作正常,但当我试图上传大文件时,我得到的错误如下: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SO
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1921)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:269)
下面是我用来调用SOAP服务的一段代码
URL endpoint =
new URL(new URL(host), service,
new URLStreamHandler() {
@Override
protected URLConnection openConnection(URL url)throws IOException {
URL target = new URL(url.toString());
URLConnection connection = target.openConnection();
// Connection settings
connection.setConnectTimeout(60000000*300);
connection.setReadTimeout(60000000*300);
connection.setRequestProperty("Content-Type",
"application/soap+xml; charset=UTF-8");
connection.setDoInput(true);
connection.setDoOutput(true);
return(connection);
}
});
System.out.println("endpoint.."+endpoint.toString());
String ingestSoapRequest = NPSClientHelper.createIngestRequestString(mimixStr, renditionId, isMac, urlList);
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
InputStream is = new ByteArrayInputStream(ingestSoapRequest.getBytes());
SOAPMessage request = MessageFactory.newInstance().createMessage(null, is);
SOAPMessage soapResponse = soapConnection.call(request, endpoint);
ByteArrayOutputStream out = new ByteArrayOutputStream();
soapResponse.writeTo(out);
soapConnection.close();
String ingestResponse = new String(out.toByteArray());
有人能帮我纠正这个错误吗
提前感谢。查看此帖子可能对您有所帮助。感谢ssanrao的建议。我正在检查SOAP服务的所有者是否设置了超时。希望这会有所帮助。我得到了服务所有者的确认,他们在服务器级别上并没有任何超时。现在我不明白这里有什么问题(根据错误,出现异常的可能原因是服务器忙/无法处理加载。正如您提到的,客户端正在将文件加载到服务器签出是否对文件大小有任何限制?没有。没有限制。客户端确认其他用户已上载高达9 GB的文件。