Refactoring of SoapWebServiceController::definitionAction()

This commit is contained in:
Francis Besset 2012-08-27 08:59:29 +02:00
parent 4741e142d0
commit 5a88648060

View File

@ -76,17 +76,18 @@ class SoapWebServiceController extends ContainerAware
*/ */
public function definitionAction($webservice) public function definitionAction($webservice)
{ {
$webServiceContext = $this->getWebServiceContext($webservice); $response = new Response($this->getWebServiceContext($webservice)->getWsdlFileContent(
$request = $this->container->get('request'); $this->container->get('router')->generate(
'_webservice_call',
array('webservice' => $webservice),
true
)
));
$request = $this->container->get('request');
if ($request->query->has('wsdl') || $request->query->has('WSDL')) { if ($request->query->has('wsdl') || $request->query->has('WSDL')) {
$endpoint = $this->container->get('router')->generate('_webservice_call', array('webservice' => $webservice), true);
$response = new Response($webServiceContext->getWsdlFileContent($endpoint));
$response->headers->set('Content-Type', 'application/wsdl+xml'); $response->headers->set('Content-Type', 'application/wsdl+xml');
} else { } else {
// TODO: replace with better representation
$response = new Response($webServiceContext->getWsdlFileContent());
$response->headers->set('Content-Type', 'text/xml'); $response->headers->set('Content-Type', 'text/xml');
} }