Esempio n. 1
0
 /**
  * @param ProfileContext $context
  *
  * @return void
  */
 public function doExecute(ProfileContext $context)
 {
     $binding = $this->bindingFactory->create($context->getEndpoint()->getBinding());
     $outboundContext = $context->getOutboundContext();
     $context->getHttpResponseContext()->setResponse($binding->send($outboundContext));
     $this->logger->info('Sending message', LogHelper::getActionContext($context, $this, array('message' => $outboundContext->getSerializationContext()->getDocument()->saveXML())));
 }
 /**
  * @param ProfileContext $context
  */
 protected function doExecute(ProfileContext $context)
 {
     $ownEntityDescriptor = $context->getOwnEntityDescriptor();
     /** @var SerializationContext $serializationContext */
     $serializationContext = $context->getSubContext(ProfileContexts::SERIALIZATION, SerializationContext::class);
     $serializationContext->getDocument()->formatOutput = true;
     $ownEntityDescriptor->serialize($serializationContext->getDocument(), $serializationContext);
     $xml = $serializationContext->getDocument()->saveXML();
     $response = new Response($xml);
     $contentType = 'text/xml';
     $acceptableContentTypes = array_flip($context->getHttpRequest()->getAcceptableContentTypes());
     foreach ($this->supportedContextTypes as $supportedContentType) {
         if (isset($acceptableContentTypes[$supportedContentType])) {
             $contentType = $supportedContentType;
             break;
         }
     }
     $response->headers->replace(array('Content-Type' => $contentType));
     $context->getHttpResponseContext()->setResponse($response);
 }