Fix compatibility with SF4 + Other fixes
This commit is contained in:
parent
873dc0ae08
commit
2d36e5f060
|
@ -1,3 +1,4 @@
|
||||||
vendor/
|
vendor/
|
||||||
composer.lock
|
composer.lock
|
||||||
phpunit.xml
|
phpunit.xml
|
||||||
|
.idea/
|
||||||
|
|
|
@ -15,12 +15,14 @@ namespace BeSimple\SoapBundle\Controller;
|
||||||
use BeSimple\SoapBundle\Handler\ExceptionHandler;
|
use BeSimple\SoapBundle\Handler\ExceptionHandler;
|
||||||
use BeSimple\SoapBundle\Soap\SoapRequest;
|
use BeSimple\SoapBundle\Soap\SoapRequest;
|
||||||
use BeSimple\SoapBundle\Soap\SoapResponse;
|
use BeSimple\SoapBundle\Soap\SoapResponse;
|
||||||
|
use BeSimple\SoapBundle\WebServiceContext;
|
||||||
use BeSimple\SoapServer\SoapServerBuilder;
|
use BeSimple\SoapServer\SoapServerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Exception\FlattenException;
|
use Symfony\Component\Debug\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
||||||
|
@ -31,11 +33,7 @@ use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
||||||
*/
|
*/
|
||||||
class SoapWebServiceController implements ContainerAwareInterface
|
class SoapWebServiceController implements ContainerAwareInterface
|
||||||
{
|
{
|
||||||
|
use ContainerAwareTrait;
|
||||||
/**
|
|
||||||
* @var ContainerInterface
|
|
||||||
*/
|
|
||||||
protected $container;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \SoapServer
|
* @var \SoapServer
|
||||||
|
@ -62,19 +60,12 @@ class SoapWebServiceController implements ContainerAwareInterface
|
||||||
*/
|
*/
|
||||||
private $headers = array();
|
private $headers = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function setContainer(ContainerInterface $container = null)
|
|
||||||
{
|
|
||||||
$this->container = $container;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \BeSimple\SoapBundle\Soap\SoapResponse
|
* @return \BeSimple\SoapBundle\Soap\SoapResponse
|
||||||
*/
|
*/
|
||||||
public function callAction($webservice)
|
public function callAction($webservice)
|
||||||
{
|
{
|
||||||
|
/** @var WebServiceContext $webServiceContext */
|
||||||
$webServiceContext = $this->getWebServiceContext($webservice);
|
$webServiceContext = $this->getWebServiceContext($webservice);
|
||||||
|
|
||||||
$this->serviceBinder = $webServiceContext->getServiceBinder();
|
$this->serviceBinder = $webServiceContext->getServiceBinder();
|
||||||
|
@ -98,7 +89,7 @@ class SoapWebServiceController implements ContainerAwareInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Symfony\Component\HttpFoundation\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function definitionAction($webservice)
|
public function definitionAction($webservice)
|
||||||
{
|
{
|
||||||
|
@ -110,7 +101,8 @@ class SoapWebServiceController implements ContainerAwareInterface
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$request = $this->container->get('request');
|
/** @var Request $request */
|
||||||
|
$request = $this->container->get('request_stack')->getCurrentRequest();
|
||||||
$query = $request->query;
|
$query = $request->query;
|
||||||
if ($query->has('wsdl') || $query->has('WSDL')) {
|
if ($query->has('wsdl') || $query->has('WSDL')) {
|
||||||
$request->setRequestFormat('wsdl');
|
$request->setRequestFormat('wsdl');
|
||||||
|
@ -136,9 +128,9 @@ class SoapWebServiceController implements ContainerAwareInterface
|
||||||
throw new \LogicException(sprintf('The parameter "%s" is required in Request::$query parameter bag to generate the SoapFault.', '_besimple_soap_webservice'), null, $e);
|
throw new \LogicException(sprintf('The parameter "%s" is required in Request::$query parameter bag to generate the SoapFault.', '_besimple_soap_webservice'), null, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
$view = 'TwigBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error').'.txt.twig';
|
$view = '@Twig/Exception/'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error').'.txt.twig';
|
||||||
$code = $exception->getStatusCode();
|
$code = $exception->getStatusCode();
|
||||||
$details = $this->container->get('templating')->render($view, array(
|
$details = $this->container->get('twig')->render($view, array(
|
||||||
'status_code' => $code,
|
'status_code' => $code,
|
||||||
'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
|
'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
|
||||||
'exception' => $exception,
|
'exception' => $exception,
|
||||||
|
|
|
@ -177,6 +177,7 @@ class BeSimpleSoapExtension extends Extension
|
||||||
|
|
||||||
$options = $container
|
$options = $container
|
||||||
->getDefinition('besimple.soap.context.'.$bindingSuffix)
|
->getDefinition('besimple.soap.context.'.$bindingSuffix)
|
||||||
|
->setPublic(true)
|
||||||
->getArgument(2);
|
->getArgument(2);
|
||||||
|
|
||||||
$definition->replaceArgument(2, array_merge($options, $config));
|
$definition->replaceArgument(2, array_merge($options, $config));
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
namespace BeSimple\SoapBundle\Handler;
|
namespace BeSimple\SoapBundle\Handler;
|
||||||
|
|
||||||
use BeSimple\SoapServer\Exception\ReceiverSoapFault;
|
use BeSimple\SoapServer\Exception\ReceiverSoapFault;
|
||||||
|
use Symfony\Component\Debug\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Exception\FlattenException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francis Besset <francis.besset@gmail.com>
|
* @author Francis Besset <francis.besset@gmail.com>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
</parameters>
|
</parameters>
|
||||||
|
|
||||||
<services>
|
<services>
|
||||||
<service id="besimple.soap.response" class="%besimple.soap.response.class%" />
|
<service id="besimple.soap.response" class="%besimple.soap.response.class%" public="true" />
|
||||||
|
|
||||||
<service id="besimple.soap.response.listener" class="%besimple.soap.response.listener.class%">
|
<service id="besimple.soap.response.listener" class="%besimple.soap.response.listener.class%">
|
||||||
<tag name="kernel.event_listener" event="kernel.view" method="onKernelView" />
|
<tag name="kernel.event_listener" event="kernel.view" method="onKernelView" />
|
||||||
|
|
|
@ -35,6 +35,11 @@ class ComplexType extends Configuration
|
||||||
return $this->isNillable;
|
return $this->isNillable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getIsNillable()
|
||||||
|
{
|
||||||
|
return $this->isNillable;
|
||||||
|
}
|
||||||
|
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
|
@ -50,6 +55,11 @@ class ComplexType extends Configuration
|
||||||
$this->isNillable = (bool) $isNillable;
|
$this->isNillable = (bool) $isNillable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setIsNillable($isNillable)
|
||||||
|
{
|
||||||
|
$this->isNillable = (bool) $isNillable;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -66,7 +76,7 @@ class ComplexType extends Configuration
|
||||||
public function setIsAttribute($isAttribute)
|
public function setIsAttribute($isAttribute)
|
||||||
{
|
{
|
||||||
$this->isAttribute = $isAttribute;
|
$this->isAttribute = $isAttribute;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,4 +84,4 @@ class ComplexType extends Configuration
|
||||||
{
|
{
|
||||||
return 'complextype';
|
return 'complextype';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ class Dumper
|
||||||
$complexType = $this->document->createElement(static::XSD_NS.':complexType');
|
$complexType = $this->document->createElement(static::XSD_NS.':complexType');
|
||||||
$complexType->setAttribute('name', $type->getXmlType());
|
$complexType->setAttribute('name', $type->getXmlType());
|
||||||
|
|
||||||
$all = $this->document->createElement(static::XSD_NS.':'.'sequence');
|
$all = $this->document->createElement(static::XSD_NS.':'.($type instanceof ArrayOfType ? 'sequence' : 'all'));
|
||||||
$complexType->appendChild($all);
|
$complexType->appendChild($all);
|
||||||
|
|
||||||
foreach ($type->all() as $child) {
|
foreach ($type->all() as $child) {
|
||||||
|
@ -258,10 +258,10 @@ class Dumper
|
||||||
$name = $childType->getName();
|
$name = $childType->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === strpos($name, 'ArrayOf')) {
|
// if (0 === strpos($name, 'ArrayOf')) {
|
||||||
$isArray = true;
|
// $isArray = true;
|
||||||
$name = lcfirst(substr($name, 7));
|
// $name = lcfirst(substr($name, 7));
|
||||||
}
|
// }
|
||||||
|
|
||||||
$element->setAttribute('type', static::TYPES_NS.':'.$name);
|
$element->setAttribute('type', static::TYPES_NS.':'.$name);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue