PHP webserver soap non-wsdl

Source: Internet
Author: User
Tags soap wsdl

NON-WSDL, as the name implies, is a webserver service that does not use WSDL files

In fact, the individual feels that using the WSDL mode is not as good as non-wsdl mode, the WSDL mode is slightly troublesome!

1. Open the SOAP module (php5.0+) in the operating environment of the website

2, the server script, (this time we provide a name to check the ID number of the webserver)

<?php    $config = Array (        ' location ' = ' http://127.0.0.1/server.php ',        ' uri ' = = ' HTTP://127.0.0.1/ ',    );    $soap = new SoapServer (null, $config);    $soap->addfunction ("Getcardname");    $soap->handle ();    function Getcardname ($name) {    switch ($name) {case    ' Xiao Li ':    return ' 14862014546846564864 ';    break;    Default:    # code ...    break;    }    }? >

  

3. Client Script

<?php/*  *    /$config = Array (' Location ' = '        http://127.0.0.1/server.php ',        ' uri ' = '/' 127.0.0.1/',    ); $soap = new SoapClient (null, $config); Echo $soap->getcardname (' Xiao Li '); >

http://127.0.0.1/client.php, you can see the effect! More complex is to replace the functions in the server with class for more complex permissions control and functionality

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.