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协议。
  • 相关阅读:
    HTTP Status 401
    Spring Data Elasticsearch 应用
    Elasticsearch基础概念
    Windows上使用Linux命令
    在服务器搭建git仓库
    SSH
    Linux/Windows 配置config 使用ssh连接
    在阿里云CentOS服务器上安装Python3.7并设置为默认Python
    Linux下Python3源码安装
    Vue
  • 原文地址:https://www.cnblogs.com/solocao/p/3709168.html
Copyright © 2011-2022 走看看