我是wsdl,nusoap代碼的新手。我正在嘗試使用Nousoap來實現一個簡單的hello world編程。我在wsdl_hello_server.php實現服務器代碼,Nusap代碼無法正常工作
<?php
require_once('nusoap.php');
$server = new soap_server();
$server->register('hello');
function hello($name) {
return 'Hello, ' . $name;
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
和客戶端代碼保存在文件wsdl_hello_client.php,
<?php
require_once('nusoap.php');
$client = new soapclient('http://localhost:8888/nousoap_example/wsdl_hello_server.php');
$result = $client->call('hello', array('name' => 'world'));
print_r($result);
?>
當我運行客戶端它不會給任何結果(空白頁)。如果我嘗試運行服務器代碼,它給我,
<SO`AP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
<faultactor xsi:type="xsd:string"/>
<faultstring xsi:type="xsd:string">method '' not defined in service</faultstring>
<detail xsi:type="xsd:string"/>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>`
忘記somthing?請幫幫我 ??
注:我已經包含在同一文件夾 'nusoap.php'
仍然不能工作:( – omrehman