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

网站建设哪家有网上购物平台哪个最好

网站建设哪家有,网上购物平台哪个最好,me域名的网站,网站建设与管理基础及实训电子版http://hi.baidu.com/654085966/item/53ee8c0f108ad78202ce1b1d -----------转自 客户端调用Web Service的方式我现在知道的有三种,分别为Http_Get,Http_Post和通过代理类来调用 直接通过HTTP-GET和直接通过HTTP-POST来请求访问Web服务是非常底层的且麻烦,(详细用法请查看C#分…http://hi.baidu.com/654085966/item/53ee8c0f108ad78202ce1b1d   -----------转自 客户端调用Web Service的方式我现在知道的有三种,分别为Http_Get,Http_Post和通过代理类来调用 直接通过HTTP-GET和直接通过HTTP-POST来请求访问Web服务是非常底层的且麻烦,(详细用法请查看C#分类中的说明),还有一种就是通过代理类来访问,DoNet框架提供的WSDL.EXE可以产生要求的代理类.在.net命令里输入wsdl http//url/xxx.asmx /language:cs /out:xxx.ss /protocol:httpGet即可生成HttpGet的代理类首先我将列出WebService的原代码:using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Web; using System.Web.Services; using System.Data.SqlClient;namespace Play.CH1 { public class Service1 : System.Web.Services.WebService {public Service1(){InitializeComponent();}private System.Data.SqlClient.SqlConnection sqlConnection1;private IContainer components null;private void InitializeComponent(){this.sqlConnection1 new System.Data.SqlClient.SqlConnection();this.sqlConnection1.ConnectionString workstation id\192.168.1.9\;packet size4096;user idsa;data source\192.168.1.9\;pe rsist security infoTrue;initial catalogpubs;password;this.sqlConnection1.InfoMessage new System.Data.SqlClient.SqlInfoMessageEventHandler(this.sqlConnection1_InfoMessage);}protected override void Dispose( bool disposing ){if(disposing components ! null){components.Dispose();}base.Dispose(disposing); }private void sqlConnection1_InfoMessage(object sender, System.Data.SqlClient.SqlInfoMessageEventArgs e){}[WebMethod]public string doSearch(string keyword){SqlDataAdapter da new SqlDataAdapter(select top 20 title_id,title from titles where title like title,sqlConnection1);da.SelectCommand.Parameters.Add(new SqlParameter(title,%keyword%));DataSet dsnew DataSet();da.Fill(ds);return ds.GetXml();}} }再贴出刚生所生成的代理类的原代码 //------------------------------------------------------------------------------ // autogenerated // This code was generated by a tool. // Runtime Version: 1.1.4322.573 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // /autogenerated //------------------------------------------------------------------------------// // 這個原始程式碼是由 wsdlVersion1.1.4322.573 自動產生。 // using System.Diagnostics; using System.Xml.Serialization; using System; using System.Web.Services.Protocols; using System.ComponentModel; using System.Web.Services;/// remarks/ [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute(code)] public class Service1 : System.Web.Services.Protocols.HttpGetClientProtocol {public Service1() {this.Url http://localhost/Play/CH1/Service1.asmx;}[System.Web.Services.Protocols.HttpMethodAttribute(typeof(System.Web.Services.Protocols.XmlReturnReader), typeof(System.Web.Services.Protocols.UrlParameterWriter))][return: System.Xml.Serialization.XmlRootAttribute(string, Namespacehttp://tempuri.org/, IsNullabletrue)]public string doSearch(string keyword) {return ((string)(this.Invoke(doSearch, (this.Url /doSearch), new object[] {keyword})));}public System.IAsyncResult BegindoSearch(string keyword, System.AsyncCallback callback, object asyncState) {return this.BeginInvoke(doSearch, (this.Url /doSearch), new object[] {keyword}, callback, asyncState);}public string EnddoSearch(System.IAsyncResult asyncResult) {return ((string)(this.EndInvoke(asyncResult)));} }再来对代理类进行详细说明1. 代理类开始是引出一系列的命名空间,代码的主题是定义一个跟待访问的Web服务类同名的 从System.Web.Services.Protocols.HttpGetClientProtocol派生的代理类 2. 代理类具有如下四个方法 2.1 不带参数的构造函数 构造函数主要是设定代理类的URL属性,这个属性表示WEB服务的URL. 2.2 doSearch方法 该方法是WEB服务的doSearch方法的本地代理版本,该方法被一个HttpMethodAttribute所标注,其目的是指示如何序列化发送到WEB服务的doSearch方法的参数以及如何反序列化WEB服务的响应.如果采用HTTP-GET调用WEB服务的方法,则必须把HTTPMothodAttribute的ReturnFormatter属性设置为XmlReturnReader,ParameterFormatter属性设置为UrlParameterWriter.方法的返回值也被一个XmlRootAttribute特性所标记.该特性用以将类,结构,枚举或结口标记为XML文档实例的根(或项级)元素.该特性的ElementName属性表示返回值对应的XML元素的名称,Namespace属性表示XML根元素的命名空间,IsNullable属性表示返回值为空时ElementName所指的无素是否包xsi:nil属性. 以上特性其实代替了我在C#分类中所讲的利用HTTP-GGET;HTTP-POST来获得WEB服务中的设置URL,在URL中附中参数,以及从返回XML文档中提结果的大段代码 再来看看方法中的代码 return ((string)(this.Invoke(doSearch, (this.Url /doSearch), new object[] { keyword}))); 上述代码先调用一个Invoke方法,(该方法继承自父类HttpGetClientProtocol),然后把调用结果强制转化为字符串类型. Invoke方法的原型: protected Object Invoke(string MethodName,string RequestUrl,Object[] Parameters); 参数:MethodName-表示要调用的Web服务的名称,本例中的“doSearch“ 参数:RequestUrl-表示WEB服务的方法的URL,它是由WEB服务的URL加上/方法名组成 参数:Parameters-是一个对象数组,包含要传递到远程WEB服务的参数,数组中的顺序与派生类的调用方法中的参数顺序对应 返回值包含派生类方法的返回值和所有引用或输出参数的对象数组 2.3 BegindoSearch方法 这个方法用以启动对WEB服务的doSearch方法的异步调用 BegindoSearch的参数:keyword: 参数.callback: AsyncCallback类型的委托对象,当异步调用结束后,callback所代表的函数将被回调,用来接收结果.AsyncCallback委托原型:[Serializable]public delegate void AsyncCallback(IAsyncResult ar);其: IAsyncResult接口:用于监视和管理异步操作.IAsyncResult接口的原型public interface IAsyncResult{object AsyncState{get;}//返回被作为最后一个参数提供的对象WaitHandle AsyncWaitHandle{get;}//返回WaitHandle,它可用于执行WaitHandle.WaitOne,WaitAny,WaitAll,以实现同步bool CompletedSynchronously{get;}//如果开始操作同步完成,则CompletedSynchronouslytruebool IsCompleted{get;}//在服务器完成调用处理后IsCompletedtrue}2.4 EnddoSearch方法 这个方法用以结束异步调用,并获得调用结果  转载于:https://www.cnblogs.com/anbylau2130/p/3481857.html
http://www.pierceye.com/news/635284/

相关文章:

  • 北京网站建设认百度非企推广开户
  • 厦门模板建站系统网站icp备案信息注册
  • 网站建设维护人员多语言网站开发
  • 网站开发 论文大连微信公众号开发公司
  • 珠海网站建设王道下拉惠烟台网站制作专业
  • 用php做网站要用构架吗ios开发者模式
  • 如何实现一个制作好的网站wordpress cdn
  • 成都网站商城建设深圳制作网站制作公司哪家好
  • 谁可以做网站开发公司空置房拨款合同
  • seo网站管理网站建设信(信科网络)
  • 做网站需要哪些东西网站设计报价单模板
  • 合肥家居网站建设怎么样网站建设与维护中
  • 淘宝app网站建设做网页设计可以参考哪些网站
  • 合作建设网站协议江门seo计费管理
  • 企业管理网站模板保定网站制作设计哪个公司好
  • 物流网站查询优秀设计赏析网站
  • 设计分享网站网站建设资料需要公司提交的吗
  • 广州网站站建设培训html用户登录注册页面代码
  • 网站建设怎么购买域名怎么屏蔽2345网址导航
  • 物流网站建设推广wordpress安全配置文件
  • 做网站用哪个服务器不用备案宣传网站设计
  • 网站建设哪种语言好电子商务型网站建设
  • 广州网站建设平台网站怎么做必须交钱吗
  • 做网站费免图片网站背景图网站
  • 上海电商网站开发公司门户网站建设 总结
  • 网站产品类别顺序如果修改wordpress多城市seo
  • 做网站托管的好处公司erp系统
  • 管局备案网站高端定制网站的特点
  • 成都极客联盟网站建设公司有没有帮别人做网站
  • 宝安专业网站设计公司公众号小程序怎么做