在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
准备工作: [WebMethod] public string HelloWorld() { return "Hello World"; } ok,一切就绪。在某php文件中如下写法: <?php require_once('nusoap.php'); /*index.php*/ $client = new SoapClient('http://localhost/webservice1/service1.asmx?wsdl', true); $str = $client->call('HelloWorld'); if(!$err = $client->getError()) { echo "return:", $str['HelloWorldResult']; } else { echo "error:", $err; } ?>
<?php //get localization strings from C# webservice $client = new SoapClient('http://localhost/webservice1/Localization.asmx?wsdl'); echo "Call web service method from C# WebService:\n"; $result = $client->GetLocalizationResource(); if(!is_soap_fault($result)) { echo "return:\n", $result->GetLocalizationResourceResult; } else { echo "soap call fault"; } ?>
|
请发表评论