Search code examples
c#xml-rpcxml-rpc.net

XML-RPC timeout?


I'm attempting to consume an XML-RPC webservice from C# (.NET 3.5). If it doesn't respond within 15 seconds, I'd like the request to time out, so that I can attempt to contact the backup webservice.

I am using the CookComputing.XmlRpc client.


Solution

  • From the XML-RPC.NET docs:

    2.4 How do I set a timeout on a proxy method call?

    Proxy classes are derived from IXmlRpcProxy and so inherit a Timeout property. This takes an integer which specifies the timeout in milliseconds. For example, to set a 5 second timeout:

    ISumAndDiff proxy = XmlRpcProxyGen.Create<ISumAndDiff>();
    proxy.Timeout = 5000;
    SumAndDiffValue ret = proxy.SumAndDifference(2,3);