Added SoapResponseListener
This listener allow return a raw result from the action. Before: /** * @Soap\Method("hello") * @Soap\Param("name", phpType = "string") * @Soap\Result(phpType = "string") */ public function helloAction($name) { return $this->container->get('besimple.soap.response')->setReturnValue(sprintf('Hello %s!', $name)); } After: /** * @Soap\Method("hello") * @Soap\Param("name", phpType = "string") * @Soap\Result(phpType = "string") */ public function helloAction($name) { return sprintf('Hello %s!', $name); }
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
<parameters>
|
||||
<parameter key="besimple.soap.response.class">BeSimple\SoapBundle\Soap\SoapResponse</parameter>
|
||||
<parameter key="besimple.soap.response.listener.class">BeSimple\SoapBundle\EventListener\SoapResponseListener</parameter>
|
||||
<parameter key="besimple.soap.context.class">BeSimple\SoapBundle\WebServiceContext</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>
|
||||
@ -20,6 +21,11 @@
|
||||
<services>
|
||||
<service id="besimple.soap.response" class="%besimple.soap.response.class%" />
|
||||
|
||||
<service id="besimple.soap.response.listener" class="%besimple.soap.response.listener.class%">
|
||||
<tag name="kernel.event_listener" event="kernel.view" method="onKernelView" />
|
||||
<argument type="service" id="besimple.soap.response" />
|
||||
</service>
|
||||
|
||||
<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.dumper.wsdl.rpcliteral" />
|
||||
|
@ -34,7 +34,7 @@ Annotations for Controllers
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace My\App\Controller;
|
||||
namespace Acme\DemoBundle\Controller;
|
||||
|
||||
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
@ -48,7 +48,17 @@ Annotations for Controllers
|
||||
*/
|
||||
public function helloAction($name)
|
||||
{
|
||||
return $this->container->get('besimple.soap.response')->setReturnValue(sprintf('Hello %s!', $name));
|
||||
return sprintf('Hello %s!', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Soap\Method("goodbye")
|
||||
* @Soap\Param("name", phpType = "string")
|
||||
* @Soap\Result(phpType = "string")
|
||||
*/
|
||||
public function goodbyeAction($name)
|
||||
{
|
||||
return $this->container->get('besimple.soap.response')->setReturnValue(sprintf('Goodbye %s!', $name));
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,5 +67,4 @@ Get your WSDL
|
||||
|
||||
To access your WSDL go to the following address: http://localhost/app_dev.php/ws/DemoApi?wsdl
|
||||
|
||||
To read the WSDL in your browser you can call this address: http://localhost/app_dev.php/ws/DemoApi
|
||||
|
||||
To read the WSDL in your browser you can call this address (without `wsdl` parameter): http://localhost/app_dev.php/ws/DemoApi
|
||||
|
Reference in New Issue
Block a user