21,886
社区成员
发帖
与我相关
我的任务
分享
<?php
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Define the method as a PHP function
function hello($name) {
return 'Hello, '.$name;
}
//echo '<pre>';print_r($_SERVER);echo '</pre>';
$_SERVER['HTTPS'] = isset($_SERVER['HTTPS']) ? "on" : "off";
// Create the server instance
$server = new soap_server();
// Initialize WSDL support
$server->configureWSDL('hellowsdl', 'urn:hellowsdl');
// Put the WSDL schema types in the namespace with the tns prefix
$server->wsdl->schemaTargetNamespace = 'urn:hellowsdl';
$soap_defencoding = 'ISO-8859-1';
$server->soap_defencoding='ISO-8859-1';
// Register the method to expose
$server->register('hello', // method name
array('name' => 'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'urn:hellowsdl', // namespace
'urn:hellowsdl#hello', // soapaction
'rpc', // style
'encoded', // use
'Says hello to the caller' // documentation
);
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>