Beispiel #1
0
 public function testDateTime()
 {
     $encoded = Xmlrpc::encodeRequest('formatDateTime', array('from' => new DateTime('2014-01-01'), 'until' => new DateTime('2014-12-31')));
     $decoded = Xmlrpc::decodeRequest($encoded, $methodName);
     $this->assertEquals('DateTime', get_class($decoded[0]['from']));
     $this->assertEquals('DateTime', get_class($decoded[0]['until']));
 }
 /**
  * @param \Blar\Events\Event $event Event.
  */
 public function requestCreatedCallback($event)
 {
     $request = $event->getTarget();
     $body = $request->getBody();
     $encoded = Xmlrpc::encodeRequest($body['method'], $body['arguments']);
     $request->setBody($encoded);
 }
Beispiel #3
0
 /**
  * @param string $methodName
  * @param array $arguments
  * @return mixed
  * @throws \Exception
  */
 public function __call($methodName, $arguments)
 {
     if ($this->getNamespace()) {
         $methodName = $this->getNamespace() . '.' . $methodName;
     }
     $methodCall = Xmlrpc::encodeRequest($methodName, $arguments);
     $request = $this->createRequest();
     $request->setUrl($this->getEndpoint());
     $request->setBody($methodCall);
     $response = $request->send();
     $data = Xmlrpc::decodeResponse($response->getBody());
     if (Xmlrpc::isFault($data)) {
         throw new Exception($data['faultString'], $data['faultCode']);
     }
     return $data;
 }