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;
?>