PHP调用.NET的WebService 简单实例
创建一个C#的web service,这个就不多说了,我用vs2008的wizard创建了一个最简单的,让它运行在:http://localhost/webservice1/service1.asmx
其中有个web method像这样的:
代码如下:
[WebMethod] public string HelloWorld() { return "Hello World"; }
ok,一切就绪。在某php文件中如下写法: php5本身就支持SOAP调用Web Service:
<?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"; } ?>
这样就OK了,会继续介绍SOAP
以上所述就是本文的全部内容了,希望大家能够喜欢。
请您花一点时间将文章分享给您的朋友或者留下评论。我们将会由衷感谢您的支持!
相关推荐
Noneyes 2020-11-10
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23