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
Release: 2016-07-21 15:30:12
Original
1040 people have browsed it

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:...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template