Merge remote-tracking branch 'origin/master' into request_headers

Conflicts:
	DependencyInjection/BeSimpleSoapExtension.php
	Resources/config/webservice.xml
	WebServiceContext.php
This commit is contained in:
Francis Besset 2011-08-14 21:16:11 +02:00
commit cce23d8abe
4 changed files with 21 additions and 32 deletions

View File

@ -60,8 +60,8 @@ class BeSimpleSoapExtension extends Extension
$options = $container $options = $container
->getDefinition('besimple.soap.context.'.$bindingSuffix) ->getDefinition('besimple.soap.context.'.$bindingSuffix)
->getArgument(7); ->getArgument(4);
$definition->replaceArgument(7, array_merge($options, $config)); $definition->replaceArgument(4, array_merge($options, $config));
} }
} }

View File

@ -6,7 +6,7 @@
<parameters> <parameters>
<parameter key="besimple.soap.context.class">BeSimple\SoapBundle\WebServiceContext</parameter> <parameter key="besimple.soap.context.class">BeSimple\SoapBundle\WebServiceContext</parameter>
<parameter key="besimple.soap.cache_dir">%kernel.cache_dir%/webservice</parameter> <parameter key="besimple.soap.cache_dir">%kernel.cache_dir%/webservice</parameter>
<parameter key="besimple.soap.binder.request.header.rpcliteral.class">BeSimple\SoapBundle\ServiceBinding\RpcLiteralRequestHeaderMessageBinder</parameter> <parameter key="besimple.soap.binder.request_header.rpcliteral.class">BeSimple\SoapBundle\ServiceBinding\RpcLiteralRequestHeaderMessageBinder</parameter>
<parameter key="besimple.soap.binder.request.rpcliteral.class">BeSimple\SoapBundle\ServiceBinding\RpcLiteralRequestMessageBinder</parameter> <parameter key="besimple.soap.binder.request.rpcliteral.class">BeSimple\SoapBundle\ServiceBinding\RpcLiteralRequestMessageBinder</parameter>
<parameter key="besimple.soap.binder.response.rpcliteral.class">BeSimple\SoapBundle\ServiceBinding\RpcLiteralResponseMessageBinder</parameter> <parameter key="besimple.soap.binder.response.rpcliteral.class">BeSimple\SoapBundle\ServiceBinding\RpcLiteralResponseMessageBinder</parameter>
<parameter key="besimple.soap.binder.request.documentwrapped.class">BeSimple\SoapBundle\ServiceBinding\DocumentLiteralWrappedRequestMessageBinder</parameter> <parameter key="besimple.soap.binder.request.documentwrapped.class">BeSimple\SoapBundle\ServiceBinding\DocumentLiteralWrappedRequestMessageBinder</parameter>
@ -20,40 +20,31 @@
<service id="besimple.soap.context.rpcliteral" class="%besimple.soap.context.class%" abstract="true"> <service id="besimple.soap.context.rpcliteral" class="%besimple.soap.context.class%" abstract="true">
<argument type="service" id="besimple.soap.definition.loader" /> <argument type="service" id="besimple.soap.definition.loader" />
<argument type="service" id="besimple.soap.definition.dumper.wsdl.rpcliteral" /> <argument type="service" id="besimple.soap.definition.dumper.wsdl.rpcliteral" />
<argument type="service" id="besimple.soap.binder.request.header.rpcliteral" />
<argument type="service" id="besimple.soap.binder.request.rpcliteral" />
<argument type="service" id="besimple.soap.binder.response.rpcliteral" />
<argument type="service" id="besimple.soap.type.repository" /> <argument type="service" id="besimple.soap.type.repository" />
<argument type="service" id="besimple.soap.converter.repository" /> <argument type="service" id="besimple.soap.converter.repository" />
<argument type="collection"> <argument type="collection">
<argument key="cache_dir">%besimple.soap.cache_dir%</argument> <argument key="cache_dir">%besimple.soap.cache_dir%</argument>
<argument key="debug">%kernel.debug%</argument> <argument key="debug">%kernel.debug%</argument>
<argument key="binder_request_header_class">%%besimple.soap.binder.request_header.rpcliteral.class%%</argument>
<argument key="binder_request_class">%besimple.soap.binder.request.rpcliteral.class%</argument>
<argument key="binder_response_class">%besimple.soap.binder.response.rpcliteral.class%</argument>
</argument> </argument>
</service> </service>
<service id="besimple.soap.context.documentwrapped" class="%besimple.soap.context.class%" abstract="true"> <service id="besimple.soap.context.documentwrapped" class="%besimple.soap.context.class%" abstract="true">
<argument type="service" id="besimple.soap.definition.loader" /> <argument type="service" id="besimple.soap.definition.loader" />
<argument type="service" id="besimple.soap.definition.dumper.wsdl.documentwrapped" /> <argument type="service" id="besimple.soap.definition.dumper.wsdl.documentwrapped" />
<argument type="service" id="besimple.soap.binder.request.header.documentwrapped" />
<argument type="service" id="besimple.soap.binder.request.documentwrapped" />
<argument type="service" id="besimple.soap.binder.response.documentwrapped" />
<argument type="service" id="besimple.soap.type.repository" /> <argument type="service" id="besimple.soap.type.repository" />
<argument type="service" id="besimple.soap.converter.repository" /> <argument type="service" id="besimple.soap.converter.repository" />
<argument type="collection"> <argument type="collection">
<argument key="cache_dir">%besimple.soap.cache_dir%</argument> <argument key="cache_dir">%besimple.soap.cache_dir%</argument>
<argument key="debug">%kernel.debug%</argument> <argument key="debug">%kernel.debug%</argument>
<argument key="binder_request_header_class">%%besimple.soap.binder.request_header.documentwrapped.class%%</argument>
<argument key="binder_request_class">%besimple.soap.binder.request.documentwrapped.class%</argument>
<argument key="binder_response_class">%besimple.soap.binder.response.documentwrapped.class%</argument>
</argument> </argument>
</service> </service>
<service id="besimple.soap.binder.request.header.rpcliteral" class="%besimple.soap.binder.request.header.rpcliteral.class%" />
<service id="besimple.soap.binder.request.rpcliteral" class="%besimple.soap.binder.request.rpcliteral.class%" />
<service id="besimple.soap.binder.response.rpcliteral" class="%besimple.soap.binder.response.rpcliteral.class%" />
<service id="besimple.soap.binder.request.documentwrapped" class="%besimple.soap.binder.request.documentwrapped.class%" />
<service id="besimple.soap.binder.response.documentwrapped" class="%besimple.soap.binder.response.documentwrapped.class%" />
<service id="besimple.soap.definition.dumper.wsdl.rpcliteral" class="%besimple.soap.definition.dumper.wsdl.rpcliteral.class%"> <service id="besimple.soap.definition.dumper.wsdl.rpcliteral" class="%besimple.soap.definition.dumper.wsdl.rpcliteral.class%">
<argument type="service" id="besimple.soap.definition.loader.annot_complextype" /> <argument type="service" id="besimple.soap.definition.loader.annot_complextype" />
</service> </service>

View File

@ -15,12 +15,12 @@ Controller
class DemoController extends ContainerAware class DemoController extends ContainerAware
{ {
/** /**
* @Soap\Method("isString") * @Soap\Method("hello")
* @Soap\Param("strings", phpType = "string[]") * @Soap\Param("names", phpType = "string[]")
* @Soap\Result(phpType = "boolean") * @Soap\Result(phpType = "string")
*/ */
public function helloAction(array $strings) public function helloAction(array $names)
{ {
return new SoapResponse(true); return new SoapResponse("Hello ".implode(', ', $names));
} }
} }

View File

@ -27,9 +27,6 @@ use Symfony\Component\Config\Loader\LoaderInterface;
*/ */
class WebServiceContext class WebServiceContext
{ {
private $requestHeaderMessageBinder;
private $requestMessageBinder;
private $responseMessageBinder;
private $typeRepository; private $typeRepository;
private $converterRepository; private $converterRepository;
@ -41,14 +38,10 @@ class WebServiceContext
private $serviceBinder; private $serviceBinder;
private $serverFactory; private $serverFactory;
public function __construct(LoaderInterface $loader, DumperInterface $dumper, MessageBinderInterface $requestHeaderMessageBinder, MessageBinderInterface $requestMessageBinder, MessageBinderInterface $responseMessageBinder, TypeRepository $typeRepository, ConverterRepository $converterRepository, array $options) { public function __construct(LoaderInterface $loader, DumperInterface $dumper, TypeRepository $typeRepository, ConverterRepository $converterRepository, array $options) {
$this->loader = $loader; $this->loader = $loader;
$this->wsdlFileDumper = $dumper; $this->wsdlFileDumper = $dumper;
$this->requestHeaderMessageBinder = $requestHeaderMessageBinder;
$this->requestMessageBinder = $requestMessageBinder;
$this->responseMessageBinder = $responseMessageBinder;
$this->typeRepository = $typeRepository; $this->typeRepository = $typeRepository;
$this->converterRepository = $converterRepository; $this->converterRepository = $converterRepository;
@ -92,7 +85,12 @@ class WebServiceContext
public function getServiceBinder() public function getServiceBinder()
{ {
if (null === $this->serviceBinder) { if (null === $this->serviceBinder) {
$this->serviceBinder = new ServiceBinder($this->getServiceDefinition(), $this->requestHeaderMessageBinder, $this->requestMessageBinder, $this->responseMessageBinder); $this->serviceBinder = new ServiceBinder(
$this->getServiceDefinition(),
new $this->options['binder_request_header_class'](),
new $this->options['binder_request_class'](),
new $this->options['binder_response_class']()
);
} }
return $this->serviceBinder; return $this->serviceBinder;