Merge remote-tracking branch 'origin/request_headers'
This commit is contained in:
@ -6,9 +6,11 @@
|
||||
<parameters>
|
||||
<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.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.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_header.documentwrapped.class">BeSimple\SoapBundle\ServiceBinding\DocumentLiteralWrappedRequestHeaderMessageBinder</parameter>
|
||||
<parameter key="besimple.soap.binder.response.documentwrapped.class">BeSimple\SoapBundle\ServiceBinding\DocumentLiteralWrappedResponseMessageBinder</parameter>
|
||||
<parameter key="besimple.soap.definition.dumper.wsdl.rpcliteral.class">BeSimple\SoapBundle\ServiceDefinition\Dumper\WsdlDumper</parameter>
|
||||
<parameter key="besimple.soap.converter.repository.class">BeSimple\SoapBundle\Converter\ConverterRepository</parameter>
|
||||
@ -24,6 +26,7 @@
|
||||
<argument type="collection">
|
||||
<argument key="cache_dir">%besimple.soap.cache_dir%</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>
|
||||
@ -37,6 +40,7 @@
|
||||
<argument type="collection">
|
||||
<argument key="cache_dir">%besimple.soap.cache_dir%</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>
|
||||
|
@ -23,5 +23,6 @@ Tutorial
|
||||
|
||||
tutorial/array
|
||||
tutorial/complex_type
|
||||
tutorial/header
|
||||
|
||||
.. _`ckWebServicePlugin`: http://www.symfony-project.org/plugins/ckWebServicePlugin
|
32
Resources/doc/tutorial/header.rst
Normal file
32
Resources/doc/tutorial/header.rst
Normal file
@ -0,0 +1,32 @@
|
||||
Header
|
||||
======
|
||||
|
||||
Controller
|
||||
----------
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace My\App\Controller;
|
||||
|
||||
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
|
||||
use BeSimple\SoapBundle\Soap\SoapResponse;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
|
||||
class DemoController extends ContainerAware
|
||||
{
|
||||
/**
|
||||
* @Soap\Method("hello")
|
||||
* @Soap\Header("api_key", phpType = "string")
|
||||
* @Soap\Param("names", phpType = "string[]")
|
||||
* @Soap\Result(phpType = "string")
|
||||
*/
|
||||
public function helloAction(array $names)
|
||||
{
|
||||
$soapHeaders = $this->container->get('request')->getSoapHeaders();
|
||||
if (!$soapHeaders->has('api_key') || '1234' !== $soapHeaders->get('api_key')->getData()) {
|
||||
throw new \SoapFault("INVALID_API_KEY", "The api_key is invalid.");
|
||||
}
|
||||
|
||||
return new SoapResponse("Hello ".implode(', ', $names));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user