[CODE:]SoapClient.php
/** *******************************
* 2008-09-24 SOAP Client Test.
* Author : Mervin.G
* Call me : 76969318
* V 1.0
* *********************************/
echo "start";
include('./lib/nusoap.php');
$type = "我是一只小老虎";
$params2 = array('type'=>$type);
$client = new soapclient('');
$error = $client->call('acceptData', $params2);
echo ''
. htmlspecialchars($client->debug_str, ENT_QUOTES) . '';
//检测发送至服务端后返回来的数据
echo $error;
?>
[CODE:]SoapServer.php
/** *******************************
* 2008-09-24 SOAP Server Test.
* Author : Mervin.G
* Call me : 76969318
* V 1.0
* *********************************/
require_once('./lib/nusoap.php');
$soap = new soap_server;
// Initialize WSDL support
$soap->configureWSDL('acceptDatawsdl', 'urn:acceptDatawsdl');
// Register the method to expose
$soap->register('acceptData', // method name
array('type' => 'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'urn:acceptDatawsdl', // namespace
'urn:acceptDatawsdl#acceptData', // soapaction
'rpc', // style
'encoded', // use
'soap service data' // documentation
);
$soap->service($HTTP_RAW_POST_DATA);
function acceptData($type) {
return $type;
?>
返回结果:我是一只小老虎
|
|