0

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.

5
  • Check this post might be helpful in your situation stackoverflow.com/questions/19824339/… Commented Apr 27, 2017 at 14:18
  • Thanks for the suggestion ssanrao . I am checking for the owner of the SOAP service if there is any timeout set from their side. Hope this will help. Commented Apr 28, 2017 at 5:40
  • I got confirmation from owner of the service that they dont have any timeout on server level. Now I don't understand what can be the problem here.. :( Commented May 8, 2017 at 9:52
  • As per the error possible reason for the exception is server is busy / can't handle the load. As you mentioned client is loading file to server checkout are there any limit on file size? Commented May 8, 2017 at 15:25
  • Nope. There is no limit. Client confirmed that other consumers have uploaded file up to 9 GB. Commented May 9, 2017 at 11:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.