Home  >  Article  >  Backend Development  >  请问php调用c#的webservice的方法

请问php调用c#的webservice的方法

WBOY
WBOYOriginal
2016-06-13 13:33:37889browse

请教php调用c#的webservice的方法
对方给了一个测试地址:HT T P: //s.dailiangu.com:8011/test_Service.asmx
对方说里面有一个方法叫helloworld(),不用传递参数,就能返回一个字符串,我一直弄不对,因为以前没有接触过,所以请大家多多指教,我是如此写的代码。

PHP code
<?php header("content-type:text/html;charset=utf-8");
$client = new SoapClient("http://s.dailiangu.com:8011/test_Service.asmx?WSDL");
$p = $client->__soapCall('HelloWorld');
//print_r($p->ChkWeleResult);  //这里先输出一下变量$p,看看是什么类型。
?>



------解决方案--------------------
PHP code

$p = $client->__soapCall('HelloWorld', array());//
var_dump($p);//结果从这里分析,你懂的
<br><font color="#e78608">------解决方案--------------------</font><br>
PHP code
<?php $client = new SoapClient("http://s.dailiangu.com:8011/test_Service.asmx?WSDL");
$p = $client->__call('HelloWorld',array());
echo $p->HelloWorldResult;
//Hello World <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn