PHP Soap instance does not use WSDL

Source: Internet
Author: User
Tags soap wsdl

Server End +client End

The last article used a WSDL It's not written . WSDL of the .

Statement : it's simple . !!!!!!

refer to the following :

http://blog.111cn.net/phphot/archive/ 2007/07/15 /1692109.aspx

class file

<?php

/**

* The class that implements the business logic, which is a generic class

*

*/

Class Basic {

       /**

* Returns a string:Hello world!

        *

* @return string

        */

Public Function returnstring ($test) {

return "Hello world!". $test;

       }

}

?>

Server

<?php

/**

* Web Service of the Server end, including class files.

*/

Require_once ("basic.php");

/**

* Create Server Object

*/

$arrOptions = Array (' URI ' => ' Checkapi '); / / set up namespaces

$objSoapServer = new SoapServer (null, $arrOptions);

/**

* Register Basic all methods of the class

*/

$objSoapServer->setclass ("Basic");

/**

* Processing Requests

*/

$objSoapServer->handle ();

?>

Client

<?php

/**

* Client end, first create Client Object

*/

$arrOptions = Array (' uri ' = > ' Checkapi ',                       //

' Location ' => ' http://localhost/user/soaptest.php ' ,//Set Place Server address

' trace ' =>true);

$objSoapClient = new SoapClient (null, $arrOptions);

/**

* Remote Call

*/

$test = ' ok123 ';

try{

$strReturn = $objSoapClient->returnstring ($test);

}catch (Exception $e) {

}

/**

* Print Results

*/

Echo $strReturn;

?>

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.