2012-03-10 59 views
0

我找不到面向對象nusoap_client調用的語法:oop nusoap_client調用的語法是什麼?

如果我向服務器註冊類方法,那麼正確的語法是什麼?我知道服務器的代碼,但無法實現正確的客戶端。

我有這樣的服務器:

<?php 

require_once "lib/nusoap.php"; 
require_once 'SampleData.php'; 

class SoapServer { 

    protected $server; 

    public function __construct() { 

     $this->server = new soap_server(); 
     $server->register("SampleData.getSampleData"); 
     $server->service($HTTP_RAW_POST_DATA); 

    }  
} 
?> 

我如何把這個從我SoapClient的?

$result = $this->client->call("SampleData.getSampleData", array("category" => "sample")); 

似乎不工作。

回答

1

我會避免使用SoapServer作爲類名,可能與標準擴展名衝突(PHP Manual SoapServer)。

你爲什麼用SoapServer來包裝soap_server呢?相反,嘗試:

$server = new soap_server(); 
$server->register("SampleData.getSampleData"); 
$server->service($HTTP_RAW_POST_DATA); 

客戶端調用應該是這樣的:

$client = new soapclient('URL'); 
$result = $client->call("SampleData.getSampleData", array("category" => "sample")); 
print_r($result); 
0

//定義客戶端

$客戶端=新SoapClient的( 'HTTP:webservice.com'); (調用方法
$ result = $ client-> call('method',array('param1,param2'));