Home >Backend Development >PHP Tutorial >Code for calling ASP.NET WebService in PHP_PHP Tutorial

Code for calling ASP.NET WebService in PHP_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:30:121047browse

There is a web method like this:

Copy code The code is as follows:

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

ok, everything is ready. The following is written in a php file:
php5 itself supports SOAP to call Web Service:
Copy the code The code is as follows:

//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";
}
?>

That’s it, I will continue to introduce SOAP

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323281.htmlTechArticleThere is a web method like this: Copy the code The code is as follows: [WebMethod] public string HelloWorld() { return "Hello World"; } ok, everything is ready. In a php file, it is written as follows:...
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