2012-03-10 2 views
0

객체 지향 nusoap_client 호출 구문을 찾지 못했습니다.oop nusoap_client call의 구문은 무엇입니까?

클래스 메소드를 서버에 등록한 경우 올바른 구문은 무엇입니까? 서버 코드를 알고 있지만 올바른 클라이언트를 구현하지 못했습니다.

<?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)과 충돌 할 수 있습니다.

왜 soap_server를 SoapServer로 포장하고 있습니까? 대신하려고 :

$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'));