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)。
  • 相关阅读:
    前端异常上报
    前端异常解析:Source Map
    前端操作剪切板不完全指北
    多系统之间模块相互引用的引发的深思
    浅谈vue原理(四)
    浅谈vue原理(三)
    浅谈vue原理(二)
    浅谈vue原理(一)
    vue中路由嵌套的作用
    常用的学习网站和小工具
  • 原文地址:https://www.cnblogs.com/silva/p/211685.html
Copyright © 2011-2022 走看看