.net - Retry policy for SOAP over a ClientBase auto-generated class? -
i have class theservicesoapclient
inheriting clientbase has been auto-generated visual studio 2012 based on wsdl associated remote web service based on soap.
var myclient = new theservicesoapclient(); var r = myclient.getsomething(); // unreliable, need retry policy
yet, remote service not reliable , fails, returning http error codes 403 or 500. implement retry-policy let me intercept faulty responses , retry according.
how can that?
catch invalidoperationexception
exception during unreliable getsomething()
operation, , use appropriate delay before retrying.
retries = 0; while (retries < retrylimit) { try { var r = myclient.getsomething(); } catch (invalidoperationexception exception) { retries++; system.threading.thread.sleep(50); } }
Comments
Post a Comment