Home  >  Article  >  Backend Development  >  webservice video tutorial Code for calling ASPNET's WebService in PHP

webservice video tutorial Code for calling ASPNET's WebService in PHP

WBOY
WBOYOriginal
2016-07-29 08:44:551332browse

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


This is OK , will continue to introduce SOAP

The above has introduced the webservice video tutorial code for calling ASPNET's WebService in PHP, including the content of the webservice video tutorial. I hope it will be helpful to friends who are interested in PHP tutorials.

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