其中有個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