Merge branch '0.1'

This commit is contained in:
Francis Besset 2013-10-15 11:15:10 +02:00
commit 391a3f10b8
5 changed files with 37 additions and 6 deletions

View File

@ -92,10 +92,8 @@ class SoapWebServiceController extends ContainerAware
));
$query = $this->container->get('request')->query;
if ($query->has('wsdl') || $query->has('WSDL')) {
$response->headers->set('Content-Type', 'application/wsdl+xml');
} else {
$response->headers->set('Content-Type', 'text/xml');
if (!$query->has('wsdl') && !$query->has('WSDL')) {
$this->container->get('request')->setRequestFormat('xml');
}
return $response;

View File

@ -40,6 +40,8 @@ class BeSimpleSoapExtension extends Extension
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('request.xml');
$loader->load('loaders.xml');
$loader->load('converters.xml');
$loader->load('webservice.xml');

View File

@ -0,0 +1,15 @@
<?php
namespace BeSimple\SoapBundle\EventListener;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
class RequestFormatListener
{
public function onKernelRequest(GetResponseEvent $event)
{
$event->getRequest()->setFormat('wsdl', 'application/wsdl+xml');
$event->getRequest()->setFormat('soap', 'application/soap+xml');
}
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="besimple.soap.request_format.listener.class">BeSimple\SoapBundle\EventListener\RequestFormatListener</parameter>
</parameters>
<services>
<service id="besimple.soap.request_format.listener" class="%besimple.soap.request_format.listener.class%">
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" />
</service>
</services>
</container>

View File

@ -6,13 +6,13 @@
<route id="_webservice_call" pattern="/{webservice}">
<default key="_controller">BeSimpleSoapBundle:SoapWebService:Call</default>
<default key="_format">xml</default>
<default key="_format">soap</default>
<requirement key="_method">POST</requirement>
</route>
<route id="_webservice_definition" pattern="/{webservice}">
<default key="_controller">BeSimpleSoapBundle:SoapWebService:Definition</default>
<default key="_format">xml</default>
<default key="_format">wsdl</default>
<requirement key="_method">GET</requirement>
</route>
</routes>