1
간단한 클라이언트/서버 XMLRPC 서버 설치를 시도하고 있지만 매개 변수를 사용하는 데 문제가 있습니다. $ client_id 매개 변수를 fetchClient() 메서드와 $ client-> call() 매개 변수 밖으로 벗어나면 코드가 제대로 실행됩니다. 나는 그것을 포함하는 경우, 서버가 반환은 "호출 매개 변수 서명 일치하지 않습니다"Zend_XmlRpc 매개 변수 문제가 발생했습니다.
컨트롤러 코드 :
class XmlrpcController extends Zend_Controller_Action
{
public function init()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
}
public function indexAction()
{
$server = new Zend_XmlRpc_Server();
$server->setClass('App_Service_Customer','customer');
echo $server->handle();
}
}
앱/서비스/Customer.php :
class App_Service_Customer
{
/**
* @param int $client_id
* @return string
*/
public function fetchCustomer($client_id)
{
return 'john doe';
}
}
클라이언트 테스트 코드 :
$client = new Zend_XmlRpc_Client('http://localhost/xmlrpc');
echo $client->call('customer.fetchCustomer', 1);
아이디어가 있으십니까?