Home > Backend Development > PHP Tutorial > Simple example of PHP calling .NET's WebService, .netwebservice_PHP tutorial

Simple example of PHP calling .NET's WebService, .netwebservice_PHP tutorial

WBOY
Release: 2016-07-13 10:00:09
Original
754 people have browsed it

PHP calls a simple example of .NET's WebService. .netwebservice

creates a C# web service. I won't go into details about this. I used the wizard of vs2008 to create the simplest one. Yes, let it run at: http://localhost/webservice1/service1.asmx

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 certain php file: php5 itself supports SOAP to call Web Service:

<&#63;php
  //get localization strings from C# webservice
  $client = new SoapClient('http://localhost/webservice1/Localization.asmx&#63;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";
  }
&#63;>

Copy after login

That’s OK, I will continue to introduce SOAP

The above is the entire content of this article, I hope you all like it.

Please take a moment to share the article with your friends or leave a comment. We will sincerely thank you for your support!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/974661.htmlTechArticlePHP calls .NET WebService simple example, .netwebservice creates a C# web service, I won’t go into details about this , I created the simplest one using vs2008 wizard and let it run in:...
Related labels:
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