Brad Finn
C#.NET, How do you make a Web Service call timeout, eg. ws.Timeout = 100; doesn't work.
By Brad Finn in .NET on Jun 16 2009
  • Brad Finn
    Jun, 2009 16

    Hi all,

    I have a C#.NET console app which harvests a couple of mssql databases and creates a bif file (Bulk Import File) for a database/indexing program called Verity.

    Basiclly for each row in the mssql database I am matching the ID of this item with another system called Digitool. Basiclly I am exporting everying thing from the mssql database that is also in digitool into this bif file.

    I am using a Web Reference to perform soap calls against the digitool server to check wether the item exists in digitool and this all works fine but some times the WebService call hangs and just keeps hanging for ever. What I was hoping would happen is after some time it would time out and continue on but that never happens.

    Here is an example:
    string general = @"<?xml version=""1.0"" encoding=""UTF-8""?>
                <xb:general
                xmlns:xb=""http://com/exlibris/digitool/repository/api/xmlbeans"">
                <application>DIGITOOL3</application>
                <owner>SLT01</owner>
                <interface_version>1.0</interface_version>
                <user>REMOVED</user>
                <password>REMOVED</password>
                </xb:general>";
    DigitalEntityManagerWSService ws = new DigitalEntityManagerWSService();
    ws.Timeout = 100;
    ws.Url = "http://rhdtprod.education.tas.gov.au:1801/de_repository_web/services/DigitalEntityManager";
    string command = @"<?xml version=""1.0"" encoding=""UTF-8""?>
            <xb:digital_entity_call
            xmlns:xb=""http://com/exlibris/digitool/repository/api/xmlbeans"">
            <xb:digital_entity>
            <pid>" + pid + @"_t</pid>
            </xb:digital_entity>
            <command>retrieve</command>
            </xb:digital_entity_call>";
    done = false;
    while (!done)
    {
        try
        {
            data = ws.digitalEntityCall(general, command); // this line here hangs some times.
            done = true;
        }
        catch
        {
        }
    }


    The marked line every now and then just hangs for ever. I assume it's just the remote server just being under too much load because I mainly get this issue when the digitool server is under quite a bit of load.

    I basiclly just want the call to time out so that it loops over until it works but the call never times out.

    If you want to see the full code: http://finnsk3.com/harvest.htm

    I am only new to C#.NET so my code might not be very well writen but any suggestions would be great.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS