XmlRpcClient.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using CookComputing.XmlRpc;
  2. namespace MeasureThread
  3. {
  4. /// <summary>
  5. /// 客户端服务类-> 公共工具类(XmlRpcClient)
  6. /// </summary>
  7. public static class XmlRpcClient
  8. {
  9. // 访问路径http://localhost:8080/XmlRpcWebServer
  10. //public static string urlstring = "http://localhost:8019/MathService.ashx";
  11. /// <summary>
  12. /// 获取接口:用于调用方法;
  13. /// </summary>
  14. /// <param name="urlstr">访问服务器服务类路径</param>
  15. /// <returns>instance</returns>
  16. public static IMethod getInstance(string urlstr)
  17. {
  18. // 用XmlRpcProxyGen创建接口: 只有此接口实现IXmlRpcProxy接口才能添加url值;
  19. IMethod service = XmlRpcProxyGen.Create<IMethod>();
  20. service.Timeout = 5 * 60 * 1000;
  21. service.XmlEncoding = new System.Text.UTF8Encoding();
  22. service.Url = urlstr;
  23. return service;
  24. }
  25. /// <summary>
  26. /// 对焦
  27. /// </summary>
  28. /// <returns></returns>
  29. public static string autofocusstig(int search_step, int iter_n, double wd_searh_factor, double stig_range, double iter_range_damping, string urlstr,bool normalized)
  30. {
  31. string xrs;
  32. //调取接口方法
  33. IMethod method = getInstance(urlstr);
  34. xrs = method.autofocusstig( search_step, iter_n, wd_searh_factor, stig_range, iter_range_damping,normalized);
  35. return xrs;
  36. }
  37. /// <summary>
  38. /// 对焦
  39. /// </summary>
  40. /// <returns></returns>
  41. public static string autofocus(int search_step, double wd_searh_factor, double retry, bool refine, string urlstr,bool normalized)
  42. {
  43. string xrs;
  44. //调取接口方法
  45. IMethod method = getInstance(urlstr);
  46. xrs = method.autofocus( search_step, wd_searh_factor, retry, refine,normalized);
  47. return xrs;
  48. }
  49. }
  50. }