I am developing an application which need to call a SOAP service developed using SOAP 1.1.The service which I am calling is accepting the file url(file should be available on internet)and some other information related to file. This service copies the file from location and upload to internal file location. When I am trying to call the service with small files then my application is working fine but when I am trying to upload bigger files then I am getting error as
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)
Below is piece of code which I am using to call the SOAP service.
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());
Can someone please help me to fix this error.
Thanks in advance.