2011-08-02 23:27:56 +02:00
|
|
|
Configuration
|
|
|
|
=============
|
|
|
|
|
|
|
|
Routing
|
|
|
|
-------
|
|
|
|
|
|
|
|
Include the `BeSimpleSoapBundle`'s routing configuration in your routing file (you can choose the prefix arbitrarily):
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
# app/config/routing.yml
|
|
|
|
_besimple_soap:
|
|
|
|
resource: "@BeSimpleSoapBundle/Resources/config/routing/webservicecontroller.xml"
|
|
|
|
prefix: /ws
|
|
|
|
|
|
|
|
Config
|
|
|
|
------
|
|
|
|
|
|
|
|
Configure your first web service in your config file:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
# app/config/config.yml
|
|
|
|
be_simple_soap:
|
|
|
|
services:
|
|
|
|
DemoApi:
|
|
|
|
namespace: http://mysymfonyapp.com/ws/DemoApi/1.0/
|
|
|
|
binding: rpc-literal
|
|
|
|
resource: "@AcmeDemoBundle/Controller/DemoController.php"
|
|
|
|
resource_type: annotation
|
|
|
|
|
|
|
|
Annotations for Controllers
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
.. code-block:: php
|
|
|
|
|
2013-02-20 14:45:47 +01:00
|
|
|
namespace Acme\DemoBundle\Controller;
|
2011-08-27 22:47:58 +02:00
|
|
|
|
2011-08-02 23:27:56 +02:00
|
|
|
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
|
2011-08-27 22:47:58 +02:00
|
|
|
use Symfony\Component\DependencyInjection\ContainerAware;
|
2011-08-02 23:27:56 +02:00
|
|
|
|
2011-08-27 22:47:58 +02:00
|
|
|
class DemoController extends ContainerAware
|
2011-08-02 23:27:56 +02:00
|
|
|
{
|
|
|
|
/**
|
2011-08-27 22:47:58 +02:00
|
|
|
* @Soap\Method("hello")
|
2011-08-02 23:27:56 +02:00
|
|
|
* @Soap\Param("name", phpType = "string")
|
|
|
|
* @Soap\Result(phpType = "string")
|
|
|
|
*/
|
|
|
|
public function helloAction($name)
|
|
|
|
{
|
2013-02-20 14:45:47 +01:00
|
|
|
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));
|
2011-08-02 23:27:56 +02:00
|
|
|
}
|
2011-11-13 21:55:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Get your WSDL
|
|
|
|
-------------
|
|
|
|
|
|
|
|
To access your WSDL go to the following address: http://localhost/app_dev.php/ws/DemoApi?wsdl
|
2011-11-22 10:08:36 +01:00
|
|
|
|
2013-02-20 14:45:47 +01:00
|
|
|
To read the WSDL in your browser you can call this address (without `wsdl` parameter): http://localhost/app_dev.php/ws/DemoApi
|