Heim  >  Artikel  >  Backend-Entwicklung  >  PHP中调用ASP.NET的WebService的代码_PHP教程

PHP中调用ASP.NET的WebService的代码_PHP教程

WBOY
WBOYOriginal
2016-07-21 15:30:12993Durchsuche

其中有个web method像这样的:

复制代码 代码如下:

[WebMethod]
public string HelloWorld()
{
return "Hello World";
}

ok,一切就绪。在某php文件中如下写法:
php5本身就支持SOAP调用Web Service:
复制代码 代码如下:

//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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/323281.htmlTechArticle其中有个web method像这样的: 复制代码 代码如下: [WebMethod] public string HelloWorld() { return "Hello World"; } ok,一切就绪。在某php文件中如下写法:...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn