Using WCF Services with PHP

Source: Internet
Author: User
I recently wrote and postings on the subject of WCF SERVICES:WCF services? Let ' s Get Started and WCF and Unit Tests. One could see that creating and testing services is not complicated on all. Let's go on and take some steps nearer to the real world? Our service was used by SOAP clients running on different platforms.

I conducted my first experiment with PHP. PHP is widely used in the world of the Web with all likelihood there would dawn a day when DT are asked just for such an I Ntegration. As PHP4 development and support are soon going to being discontinued, I didn ' t bother with an example using PHP4 SOAP tools. PHP5 is in the market and it comes with a quick and stable SOAP library. The performance is many times better than in case of similar widgets written for PHP4.

I had Apache and PHP5 running on Windows and for SOAP support I had to use an extension named Php_soap.dll. Thus, I have to remove the comment mark in front of the appropriate php.ini line and restart Apache.

As an example I'll present a PHP code calling the service ' s Add () method and writing the result on the screen. An example of WCF code can being found in we blog, in the posting WCF Services? Let ' s Get Started.

 
  x = 2.5; $obj->y = 3.5; $retval = $client->add ($obj); echo "2.5 + 3.5 =". $retval->addresult;? >

If Nothing went wrong, the result should is something like this:

    WCF Test    2.5 + 3.5 = 6

As can see, the using WCF services in PHP are very simple. The SOAP library provided along with PHP5 does a great deal of the work "behind the curtains", leaving us with an easily r Eadable Brief code.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.