当前位置: 首页 > news >正文

电子购物网站建设目的工程造价信息网官网首页

电子购物网站建设目的,工程造价信息网官网首页,辽宁省住房建设厅网站,杭州做网站企业注意#xff1a;该文章涉及到的调用方法若找不到 请移步第一部分内容查找 C# 生成wsdl和dll教程请移步 【超细完整版】C# WebService 通过URL生成WSDL文件和DLL文件 【生成篇】 开始 首先实现一个类#xff0c;用于实现对URL的验证等 public class InputFormatVerifica…注意该文章涉及到的调用方法若找不到 请移步第一部分内容查找 C# 生成wsdl和dll教程请移步 【超细完整版】C# WebService 通过URL生成WSDL文件和DLL文件 【生成篇】 开始 首先实现一个类用于实现对URL的验证等 public class InputFormatVerification {/// summary/// 是否合法Url地址统一资源定位/// /summary/// param namestrValueurl地址/param/// returns成功返回true 失败返回false/returnspublic static bool IsUrl(string strValue){string RegexStr string.Empty;RegexStr ^(http|https)\://([a-zA-Z0-9\.\-](\:[a-zA-Z0-9\.%\$\-])*)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]\.)*[a-zA-Z0-9\-]\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{1,10}))(\:[0-9])*(/($|[a-zA-Z0-9\.\,\?\\\\%\$#\~_\-]))*$;return formatChecks(RegexStr, strValue);}/// summary/// 检测串值是否为合法的格式/// /summary/// param namestrRegex正则表达式/param/// param namestrValue要检测的String值/param/// returns成功返回true 失败返回false/returnspublic static bool formatChecks(string strRegex, string strValue){if (string.IsNullOrWhiteSpace(strValue)){return false;}Regex re new Regex(strRegex);return re.IsMatch(strValue);} }实现Invoke 获取WebService中的所有web 方法 #region 获取web方法 /// summary /// 获取WebService接口的所有WebMethod方法 /// 通过WebService方法的特性为【System.Web.Services.Protocols.SoapDocumentMethodAttribute】 /// 根据特性SoapDocumentMethodAttribute来筛选出所有WebMethod方法 /// /summary /// param nameurl/param public static ListMethodInfo GetAllWebMethodsFromLink(string url, out string className) {className GetClassNameFromUrl(url);CompilerResults result UrlToDllFile(url);Assembly assembly result.CompiledAssembly;Type type assembly.GetType(className);return GetWebMethods(type); } /// summary /// 获取WebService接口的所有WebMethod方法 /// 通过WebService方法的特性为【System.Web.Services.Protocols.SoapDocumentMethodAttribute】 /// 根据特性SoapDocumentMethodAttribute来筛选出所有WebMethod方法 /// /summary /// param namewsdlFilePath/param public static ListMethodInfo GetAllWebMethodsFromWsdl(string wsdlFilePath, out string className) {className GetClassNameFromWsdl(wsdlFilePath);CompilerResults result WsdlToDll(wsdlFilePath);Assembly assembly result.CompiledAssembly;Type type assembly.GetType(className);return GetWebMethods(type); }private static ListMethodInfo GetWebMethods(Type type) {ListMethodInfo methodInfoList new ListMethodInfo();if (type null){return methodInfoList;}MethodInfo[] methodInfos type.GetMethods();for (int i 0; i methodInfos.Length; i){MethodInfo methodInfo methodInfos[i];//WebMethod方法的特性为System.Web.Services.Protocols.SoapDocumentMethodAttribute Attribute attribute methodInfo.GetCustomAttribute(typeof(System.Web.Services.Protocols.SoapDocumentMethodAttribute));if (methodInfo.MemberType MemberTypes.Method attribute ! null){methodInfoList.Add(methodInfo);}}return methodInfoList; } #endregion通过wsdl或url进行调用 /// summary /// 调用WebService /// /summary /// param nameaddressWebService地址/param /// param namemethodName方法名称/param /// param nameargs参数列表/param /// param nametimeOut/param /// returns返回调用结果/returns /// exception crefException/exception private static object InvokeWebService(string address, string methodName, object[] args, string timeOut ) {try{string className string.Empty;CompilerResults result null;//支持直接URL或wsdl类型文件的调用if (InputFormatVerification.IsUrl(address)){className GetClassNameFromUrl(address);result UrlToDllFile(address);}else{className GetClassNameFromWsdl(address);result WsdlToDll(address);}Assembly assembly result.CompiledAssembly;Type type assembly.GetType(className);FieldInfo[] arry type.GetFields();//实例类型对象 object obj Activator.CreateInstance(type);System.Reflection.MethodInfo mi type.GetMethod(methodName);//添加超时时间if (!string.IsNullOrEmpty(timeOut)){int timeout 0;int.TryParse(timeOut, out timeout);if (timeout 0) timeout 1200;//设置超时时间((System.Web.Services.Protocols.WebClientProtocol)(obj)).Timeout timeout * 1000;//毫秒s,timeOut超时时间设置为分钟}var res mi.Invoke(obj, args);return res;}catch (Exception ex){throw new Exception(ex.InnerException.Message, new Exception(ex.InnerException.StackTrace));} }老规矩
http://www.zqtcl.cn/news/335859/

相关文章:

  • 德骏网站建设重庆企业网站如何推广
  • 路由器做内部网站服务器石家庄新闻综合频道在线直播回放
  • 怎么给网站备案亚马逊网站建设与维护方法分析
  • 金华网站建设团队产品网络推广方案范文
  • 拼多多刷单网站开发虚拟机可以做两个网站
  • wordpress安装路径和站点地址的设置信通网站开发中心
  • 柳州公司网站建设网站服务商
  • 智能建站实验报告成功营销网站
  • 基于jsp的网站开发开题报告青海公路工程建设市场信用信息服务网站
  • 做网站页面的软件wordpress如何开启page页面评论
  • 做网站最简单的长春财经学院
  • 导购网站 icp备案要求网站设置ico
  • ftp做网站营销策划方案步骤
  • 网站建设若干意见wordpress查看数据库密码
  • 什么网站可以做宣传西安网站建设聚星互联
  • 产品展示网站源码2015年做哪些网站致富
  • 潍坊网站制作推广怎样做彩票网站
  • 做视频网站被判刑自己怎么做企业网站建设
  • 安庆网站建设兼职哪个公司的卡网络最好
  • tp框架做响应式网站青岛网站建设首选
  • 外国自适应企业网站做网站模板用什么框架
  • win7做网站服务器隐私浏览器
  • 优秀的设计网站广州排名推广
  • 做电商设计有什么好的网站推荐软件产品开发流程图
  • 建设网站请示宣传企业网站建设的
  • 汉中定制网站建设公司网站建设建站知识
  • 做壁纸网站建站优化办事效率高
  • linux 做网站数据库怎么开发ios软件
  • 沛县网站设计html制作网页的代码
  • 南昌网站建设公司如何万维网络(临沂网站建设)