zoukankan      html  css  js  c++  java
  • php 利用 soap调用.Net的WebService asmx文件

    PHP部分调用webservice的方法
     
    <?php
    //php.ini中打开下面3个dll
    //extension = php_soap.dll
    //extension = php_curl.dll
    //extension = php_openssl.dll
    header("content-type:text/html;charset=utf-8");
    $client = new SoapClient(" http://192.168.1.178:808/ChkWelePsw.asmx?WSDL");
    //本行测试不可行 $client = new SoapClient(" http://192.168.1.178:808/chkwelepsw.asmx?WSDL/ChkWele?username=test3&psw=123");
    //参数这样传递 先包装一下
    $param = array('username'=>'test3','psw'=>'123');
    //调用必须用__soapCall
    $p = $client->__soapCall('ChkWele',array('parameters' => $param));
    print_r($p->ChkWeleResult);  //这里先输出一下变量$p,看看是什么类型。
    ?>

    .NET部分 webservice要注意的地方

           /*
             *	<system.web>在这个节点中加入如下内容
    	        <webServices>
                 <protocols>
                    <add name="HttpSoap"/>
                    <add name="HttpPost"/>
                    <add name="HttpGet"/>
                    <add name="Documentation"/>
                 </protocols>
                </webServices>  
             */
            [WebMethod(Description = "This......", EnableSession = false)]
            public string ChkWele(string username, string psw)
            {
                string ret = "";
                return ret;
            }
    

  • 相关阅读:
    PostgreSQL主从流复制部署
    MySQL集群主从复制搭建
    zabbix修改支持中文主机名
    BGP总结(三)
    BGP总结(二)
    BGP总结(一)
    VXLAN配置实例(华为)
    VXLAN理论解析
    飞塔创建IPSec
    关于SANGFOR AC记录上网记录
  • 原文地址:https://www.cnblogs.com/JangoJing/p/1965363.html
Copyright © 2011-2022 走看看