some cleanup
Conflicts: Controller/SoapWebServiceController.php ServiceBinding/ServiceBinder.php
This commit is contained in:
parent
887169de13
commit
0126cd4221
|
@ -15,6 +15,7 @@ use Bundle\WebServiceBundle\Soap\SoapResponse;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +48,7 @@ class SoapWebServiceController extends ContainerAware
|
||||||
*/
|
*/
|
||||||
public function callAction($webservice)
|
public function callAction($webservice)
|
||||||
{
|
{
|
||||||
$webServiceContext = $this->container->get('webservice.context.'.$webservice);
|
$webServiceContext = $this->getWebServiceContext($webservice);
|
||||||
$this->serviceBinder = $webServiceContext->getServiceBinder();
|
$this->serviceBinder = $webServiceContext->getServiceBinder();
|
||||||
|
|
||||||
$this->soapRequest = SoapRequest::createFromHttpRequest($this->container->get('request'));
|
$this->soapRequest = SoapRequest::createFromHttpRequest($this->container->get('request'));
|
||||||
|
@ -66,7 +67,7 @@ class SoapWebServiceController extends ContainerAware
|
||||||
*/
|
*/
|
||||||
public function definitionAction($webservice)
|
public function definitionAction($webservice)
|
||||||
{
|
{
|
||||||
$webServiceContext = $this->container->get('webservice.context.'.$webservice);
|
$webServiceContext = $this->getWebServiceContext($webservice);
|
||||||
$request = $this->container->get('request');
|
$request = $this->container->get('request');
|
||||||
|
|
||||||
if ($request->query->has('wsdl') || $request->query->has('WSDL')) {
|
if ($request->query->has('wsdl') || $request->query->has('WSDL')) {
|
||||||
|
@ -75,7 +76,7 @@ class SoapWebServiceController extends ContainerAware
|
||||||
$response = new Response($webServiceContext->getWsdlFileContent($endpoint));
|
$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 represantation
|
// TODO: replace with better representation
|
||||||
$response = new Response($webServiceContext->getWsdlFileContent());
|
$response = new Response($webServiceContext->getWsdlFileContent());
|
||||||
$response->headers->set('Content-Type', 'text/xml');
|
$response->headers->set('Content-Type', 'text/xml');
|
||||||
}
|
}
|
||||||
|
@ -159,4 +160,13 @@ class SoapWebServiceController extends ContainerAware
|
||||||
{
|
{
|
||||||
return $this->soapResponse;
|
return $this->soapResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getWebServiceContext($webservice)
|
||||||
|
{
|
||||||
|
if(!$this->container->has('webservice.context.'.$webservice))
|
||||||
|
{
|
||||||
|
throw new NotFoundHttpException(sprintf('No webservice with name "%s" found.', $webservice));
|
||||||
|
}
|
||||||
|
return $this->container->get('webservice.context.'.$webservice);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -32,14 +32,8 @@ class ServiceBinder
|
||||||
*/
|
*/
|
||||||
private $responseMessageBinder;
|
private $responseMessageBinder;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(ServiceDefinition $definition, MessageBinderInterface $requestMessageBinder, MessageBinderInterface $responseMessageBinder) {
|
||||||
ServiceDefinition $definition,
|
$this->definition = $definition;
|
||||||
MessageBinderInterface $requestMessageBinder,
|
|
||||||
MessageBinderInterface $responseMessageBinder
|
|
||||||
)
|
|
||||||
{
|
|
||||||
$this->definition = $definition;
|
|
||||||
|
|
||||||
$this->requestMessageBinder = $requestMessageBinder;
|
$this->requestMessageBinder = $requestMessageBinder;
|
||||||
$this->responseMessageBinder = $responseMessageBinder;
|
$this->responseMessageBinder = $responseMessageBinder;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue