PHP calls WebService of ASP.NET
- 2020-05-05 10:59:07
- OfStack
There is an web method like this:
ok, all set. In an php file, write as follows:
php5 itself supports SOAP calling Web Service:
So that's OK, and we'll continue with SOAP
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
ok, all set. In an php file, write as follows:
php5 itself supports SOAP calling 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";
}
?>
So that's OK, and we'll continue with SOAP