/**
  * @param GetResponseEvent $event
  * @param Response         $response
  * @param RpcResponse      $rpcResponse
  */
 protected function setResponse(GetResponseEvent $event, Response $response, RpcResponse $rpcResponse)
 {
     $responseType = $response->headers->get('Content-Type');
     list($protocol, $encoding) = $this->factory->getContentType($responseType);
     $content = $this->serializer->serialize($rpcResponse, $protocol, ['encoding' => $encoding]);
     $response->setContent($content);
     $event->setResponse($response);
 }
 protected function buildResponseError($protocol)
 {
     /** @var Response $object */
     $object = $this->responseFactory->create($protocol);
     $error = new Error();
     if ($protocol === 'soap') {
         $error = new SoapFault();
     }
     if ($protocol === 'xml-rpc') {
         $error = new XmlRpcFault();
     }
     if ($protocol === 'json-wsp') {
         $error = new JsonWspFault();
     }
     $object->setError($error);
     $object->getError()->setCode(33);
     $object->getError()->setMessage('Freak Occurence');
     return $object;
 }