Blog. csdn. netmayongzhan
Http://blog.csdn.net/mayongzhan-ma yongzhan, myz, mayongzhan Server + Client end with the wsdl write this do not need wsdl. Statement: Very simple !!!!!! See: http://blog.csdn.net/phphot/archive/2007/07/15/1692109.aspx class files? Php/*** class that implements business logic. This class is
Http://blog.csdn.net/mayongzhan-ma yongzhan, myz, mayongzhan
Server + Client
In the previous article, wsdl is used to write data without wsdl.
Statement: Very simple !!!!!!
Refer to the following:
Http://blog.csdn.net/phphot/archive/2007/07/15/1692109.aspx
Class File
/**
* Class that implements business logic. This class is a common class.
*
*/
Class Basic {
/**
* Returns a string: Hello World!
*
* @ Return string
*/
Public function returnString ($ test ){
Return "Hello World! ". $ Test;
}
}
?>
Server
/**
* The Web Service Server, including class files.
*/
Require_once ("basic. php ");
/**
* Create a Server Object
*/
$ ArrOptions = array ('url' => 'checkapi '); // you can specify a namespace.
$ ObjSoapServer = new SoapServer (null, $ arrOptions );
/**
* Register all methods of the Basic class
*/
$ ObjSoapServer-> setClass ("Basic ");
/**
* Request processing
*/
$ ObjSoapServer-> handle ();
?>
Client
/**
* Client: first, create a Client object.
*/
$ ArrOptions = array ('url' => 'checkapi ', // set the namespace
'Location' => 'HTTP: // localhost/user/soaptest. php', // set the Server address
'Track' => true );
$ ObjSoapClient = new SoapClient (null, $ arrOptions );
/**
* Remote Call
*/
$ Test = 'ok123 ';
Try {
$ StrReturn = $ objSoapClient-> returnString ($ test );
} Catch (Exception $ e ){
}
/**
* Print the result
*/
Echo $ strReturn;
?>