2010-04-20 2 views
1

지난 2 일 동안 NuSoap을 사용하여 PHP로 웹 서비스를 만들려고 노력했습니다. 그러나, 끝없이 다양한 튜토리얼과 가이드를 통해 선별 한 후에, 나는 여전히 작동을 거절하는 코드의 012 라인을 과 붙어있다.NuSoap 도움말 - 웹 서비스 생성

서버 :

// Pull in the NuSOAP code 
require_once('./lib/nusoap.php'); 

// Create the server instance 
$server = new soap_server; 

// Initialize WSDL support 
$server->configureWSDL('hellowsdl','http://mysite.com'); 

// Register the method to expose 
$server->register('hello', 
    array("params"=>"xsd:string"), 
    array("result"=>"xsd:string"), 
    'http://mysite.com' 
); 

// Define the method as a PHP function 
function hello($name) { 
     return 'Hello, ' . $name; 
} 

// 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); 

그리고 클라이언트 :

// Pull in the NuSOAP code 
require_once('./lib/nusoap.php'); 

// Create the client instance 
$client = new nusoap_client('http://localhost/nusoap/server.php?wsdl',true); 

// Call the SOAP method 
$result = $client->call('hello',array("name"=>"Scott")); 

var_dump($result); 

나에게 (false)를 부울를 제공

내가 잘못 갈거야 ??? 당신이 방법을 등록 할 때

답변

1

, 당신은 매개 변수 'PARAMS'하지 '이름'을 호출하는 코드가 있어야한다 :

$server->register('hello', 
array("name"=>"xsd:string"), 
array("result"=>"xsd:string"), 
'http://mysite.com' 
); 

내가 함께 코드를 실행하면, 비록 거짓 점점되어서는 안된다 그것의 버그는 아직 있어요

string(12) "Hello, " 

(빈 $ 이름 변수). http://localhost/nusoap/server.php?wsdl으로 이동하여 클라이언트를 실행중인 동일한 시스템에서 WSDL을 볼 수 있는지 확인하십시오.