You are here

public function ServicesClientConnectionXmlrpcServer::processResponse in Services Client 7

Same name and namespace in other branches
  1. 7.2 services_client_connection/plugins/ServicesClientConnectionXmlrpcServer.inc \ServicesClientConnectionXmlrpcServer::processResponse()

Overrides ServicesClientConnectionPlugin::processResponse

File

services_client_connection/plugins/ServicesClientConnectionXmlrpcServer.inc, line 45
XMLRPC server

Class

ServicesClientConnectionXmlrpcServer
@file XMLRPC server

Code

public function processResponse(ServicesClientConnectionResponse &$response) {
  parent::processResponse($response);

  // Add library
  $this
    ->includeXmlrpcLibrary();

  // Try to retrieve error message
  $message = xmlrpc_message($response->raw_response);

  // Try to get error code from response
  if (ServicesClientConnectionHttp::isError($response->response_code)) {
    $response->error_code = $response->response_code;
    $response->error_message = ServicesClientConnectionHttp::getHttpMessage($response->response_code);
  }
  elseif (!empty($message) && !xmlrpc_message_parse($message)) {
    $response->error_code = -32700;
    $response->error_message = t('Parse error. Not well formed');
  }
  elseif ($message->messagetype == 'fault') {
    $response->error_code = $message->fault_code;
    $response->error_message = $message->fault_string;
  }
  else {
    $response->data = $message->params[0];
  }
}