Discussions

XML & Web services: Send millions of record as soap response for single request..

  1. Hi All,

    I have implemented one SOAP API which wil fetch data from database (It may contain 1 million rec or high..) and write all records into one file and send the file path as soap response.

    If data is too high then the time out exception occurs in client side.

    I want to make it wait until whole data to be written into the file.

    How wil I increase the client timeout?

    Data size wil vary according to the request parameters.

    So how wil I set the fixed timeout for this particular SOAP API.

    waiting for the reply ASAP.

    Thanks & Regards
    Jayaseelan.

    Threaded Messages (2)

  2. Don't write to the file[ Go to top ]

    Why bother writing to a file, when you can start streaming the results immediately via ServletResponse.getOutputStream()?

  3. whoops... sorry[ Go to top ]

    ... I missed the part about "returning a path to the file".

    Your client will have to set the timeout before making the request, as in HttpURLConnection.setConnectionTimeout():


    connection = (HttpURLConnection) url.openConnection();
    connection.setRequestProperty("Content-Type", "text/xml");
    connection.setRequestMethod("POST");
    connection.setDoOutput(true);
    connection.setConnectionTimeout(600*1000); // 10 minutes 
    connection.setDoInput(true);
    connection.connect();


     Setting the connection timeout to zero will cause it to wait indefinitely.