zoukankan      html  css  js  c++  java
  • WebService基础

    把今天下午看书的内容总结一下,仅此而已:

    1> 从原理的角度出发,可以直接发送HTTP-GET或HTTP-POST请求访问WebService,用XmlReader从返回的Xml中提取结果。
    System.Net.HttpWebRequest req;

                String strUrl 
    = "http://192.168.16.117/WebService3/Service1.asmx/HelloWorld";

    //            req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strUrl);
                req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(strUrl);
                System.Net.HttpWebResponse res;
                res 
    = (System.Net.HttpWebResponse)req.GetResponse();
                

                System.IO.Stream ss;
                ss 
    = res.GetResponseStream();

                System.IO.StreamReader sreader 
    = new System.IO.StreamReader(ss,System.Text.Encoding.Default);
                String result 
    = sreader.ReadToEnd();
                System.Windows.Forms.MessageBox.Show(result);
                sreader.Close();
                ss.Close();


    2> 一般客户端应用中,通过代理类来访问WebService,客户端的HTTP-GET和HTTP-POST代理类分别是HttpGetClientProtocol和HttpPostClientProtocol的派生类。

    3> 将WebService绑定到某种协议如Soap的含义是:采用该协议来描述调用请求和相应。

    4> 如何对WebService生成的Xml进行格式化呢?.net提供两种控制Xml序列化的特性,从而在服务器端定制数据封装。可以选择性的在类、返回值、参数、成员、方法应用这些特性(Attribute)。
  • 相关阅读:
    第72天: PySpider框架的使用
    第71天: Python Scrapy 项目实战
    Web前端资源汇总
    1201即将到来
    C#自定义事件模拟风吹草摇摆
    HTML5 Canvas爱心时钟代码
    CSS3圆环动态弹出菜单
    CSS3实现Loading动画特效
    HTML5优势
    CSS3扁平化Loading动画特效
  • 原文地址:https://www.cnblogs.com/silva/p/211685.html
Copyright © 2011-2022 走看看