added DependencyInjection configuration for SoapKernel

This commit is contained in:
Christian Kerl 2010-10-04 21:13:45 +02:00
parent 45c8ec7ba5
commit 1a5ff45a39
3 changed files with 36 additions and 3 deletions

View File

@ -2,6 +2,8 @@
namespace Bundle\WebServiceBundle\DependencyInjection; namespace Bundle\WebServiceBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -9,7 +11,10 @@ class WebServiceExtension extends Extension
{ {
public function configLoad(array $config, ContainerBuilder $configuration) public function configLoad(array $config, ContainerBuilder $configuration)
{ {
$configuration->getDefinition("request")->setClass("Bundle\\WebServiceBundle\\SoapRequest"); $loader = new XmlFileLoader($configuration, __DIR__ . "/../Resources/config");
$loader->load("services.xml");
$configuration->setAlias("http_kernel", "webservice_http_kernel");
} }
public function getXsdValidationBasePath() public function getXsdValidationBasePath()

View File

@ -3,4 +3,19 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd"> xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="request.class">Bundle\WebServiceBundle\SoapRequest</parameter>
</parameters>
<services>
<service id="webservice_http_kernel" class="Bundle\WebServiceBundle\SoapKernel">
<call method="setContainer">
<argument type="service" id="service_container" />
</call>
</service>
<service id="symfony_http_kernel" class="%http_kernel.class%">
<argument type="service" id="event_dispatcher" />
<argument type="service" id="controller_resolver" />
</service>
</services>
</container> </container>

View File

@ -2,9 +2,22 @@
namespace Bundle\WebServiceBundle; namespace Bundle\WebServiceBundle;
use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpFoundation\Request;
class SoapKernel extends HttpKernel use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class SoapKernel extends ContainerAware implements HttpKernelInterface
{ {
public function getRequest()
{
return null;
}
public function handle(Request:: $request = null, $type = self::MASTER_REQUEST, $raw = false)
{
$this->container->getSymfonyHttpKernelService()->handle($request, $type, $raw);
}
} }