zoukankan      html  css  js  c++  java
  • WebService 调用

    一、WebService调用
    1.webservice支持四种调用方式:SOAP 1.1,SOAP 1.2,GET,POST。
     
            2.如果要webservice支持GET,POST调用还需要web.config中 <system.web>
    添加:
       <webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> </protocols> </webServices>
     
            3.webservice默认输出xml格式,如果想让webservice输出文本格式:
    去除webservice函数返回值,输出:
    Context.Response.Clear(); 
     Context.Response.Charset = "UTF-8"; 
     Context.Response.ContentType = "text/plain";
    Context.Response.Write(json);  //这里是json个文本
    Context.Response.End();
     
            4.AJAX不支持跨域,如果要跨域调用webservice,请使用jsonp(参考jquery jsonp)。
     
    5.调用注意:重要是发送的数据与webservice接受的数据,请求类型,请求头字段必须一致。
    例如:采用SOAP 连接

    1.将请求类型设为:POST。

    2.将Content-Type设为:application/soap+xml。
    3.数据为xml 。
     
    6.https协议:webservice的好处可以将http协议改为https协议。
  • 相关阅读:
    Labeling Balls
    Following Orders
    Frame Stacking
    Window Pains
    Sort it all out
    Ferry Loading||
    今年暑假不AC
    xcode10 出现 框架 或者 pod 出错
    网络请求 步骤
    swift UIAlertController使用 UIAlertController的宽度 为270
  • 原文地址:https://www.cnblogs.com/solocao/p/3709168.html
Copyright © 2011-2022 走看看