Hi,

We are using NetInsight XML API to fetch large reports that take a while to process.

However, after 2 minutes, it results into timeout and no reports are fetched.

Could someone advise how to increase the timeout value OR prevent network timeouts when using the IBM Unica NetInsight XML API ?

Any help is greatly appreciated!

Swathi

Views: 204

Reply to This

Replies to This Discussion

Hello Swathi! It sounds like there may be a timeout built into the script in use, or a default timeout is set that could be overridden by the script in use. The NetInsight API definitely should allow reports to run for more than 2 minutes.

If you would like to upload the script, or a sanitized version of the script, perhaps I or another community member could look it over?

ToddB

static void GetReport()

        {

            try

            {

               

                var bcUrl = @"http://abc.com/cgi-bin/NetInsight/xxx/ntcgi.cgi";

               

                WebRequest request = WebRequest.Create(bcUrl);

                request.Method = "POST";

                request.ContentType = "text/xml";

                //request.Timeout = 600000; //10minutes = 600000ms

 

                CredentialCache credentialCache = new CredentialCache();

                credentialCache.Add(

                    new System.Uri(bcUrl),

                    "Basic",

                    new System.Net.NetworkCredential("XXX", "XXX")

                );

 

               

                string reportKey = "report036";

                string startDate = "2014-05-05";

                string endDate = "2014-05-05";

                string body = CreateXMLRequest(reportKey, startDate, endDate);

                ASCIIEncoding encoding = new ASCIIEncoding();

                byte[] data = encoding.GetBytes(body);

 

                request.ContentLength = data.Length;

 

                Stream requestStream = request.GetRequestStream();

                requestStream.Write(data, 0, data.Length);

 

                WebResponse response = request.GetResponse();

 

                // Display the status.

                Console.WriteLine(((HttpWebResponse)response).StatusDescription);

 

                // Get the stream containing content returned by the server.

                Stream responseStream = response.GetResponseStream();

 

                // Open the stream using a StreamReader for easy access.

                StreamReader reader = new StreamReader(responseStream);

 

                // Read the content.

                string responseFromServer = reader.ReadToEnd();

 

                // Display the content.

                Console.WriteLine(responseFromServer); // Write Logic here to process the csv/xml response here.

 

                // Clean up the streams and the response.

                reader.Close();

                response.Close();

 

                Console.WriteLine("END");

                Console.ReadLine();

            }

            catch (Exception ex)

            {

                string msg = ex.Message + "   " + ex.StackTrace;

            }

        }

 

Here is the XML Request for reference:

 

<?xml version="1.0" encoding="UTF-8"?> <methodCall>

  <methodName>GetReportData</methodName>

  <params>

    <param>

      <value>report036</value>

    </param>

    <param>

      <value>

        <struct>

          <member>

            <name>show</name>

            <value>10</value>

          </member>

          <member>

            <name>format</name>

            <value>csv</value>

          </member>

          <member>

            <name>filters</name>

            <value><![CDATA[<filterinstances>

  <filterinstance type="date" comparison="between">

    <range>

      <start>2014-05-05</start>

      <end>2014-05-05</end>

    </range>

  </filterinstance>

</filterinstances>]]></value>

          </member>

        </struct>

      </value>

    </param>

  </params>

</methodCall>

 

 

 

 

If we set the Request.Timeout = 600000, we get the following exception in approx 2 minutes:

"The remote server returned an error: (504) Gateway Timeout."

 

If we do not set this Request.Timeout value, we get the following exception in 2 minutes:

"The operation has timed out"

We are able to fetch reports for a few report keys within seconds. 

The clientside timeout is important, but I've seen cases where the first request fails after a while (timeout related or otherwise) but if you immediately re-try the same call it then succeeds (as the result is already ready and waiting for you).

Ideally of course you'd just make the back-end faster. :-)

Bob, Could you please let us know which back-end processes need to be optimized? Making repetitive calls is not the ideal solution for us. It doesn't seem to be working either.

Have you checked the server timeouts? We had to bump out our timeout setting in Apache due to Netinsight API errors.

Reply to Discussion

RSS

© 2017   Created by Wendy Ertter.   Powered by

Badges  |  Report an Issue  |  Terms of Service