The bundle is back!

The definition of service has changed, read the README.
This commit is contained in:
Francis Besset
2011-07-17 10:46:54 +02:00
parent 81118f8d47
commit 1c608ccf20
48 changed files with 641 additions and 535 deletions

View File

@ -8,14 +8,46 @@ Requirements
------------
* Install and enable PHP's `SOAP` extension
* Download and add `Zend\Soap` library to `app/autoload.php`
* Download `Zend\Soap`
git submodule add http://github.com/zendframework/zf2.git vendor/zend-framework
* Add `Zend\Soap` library to `app/autoload.php`
// app/autoload.php
$loader->registerNamespaces(array(
'Zend\\Soap' => __DIR__.'/../vendor/zend-frameword/library',
// your other namespaces
));
QuickStart
----------
* Put WebServiceBundle in your `src/Bundle` dir
* Put WebServiceBundle in your `vendor/bundles/Bundle` dir
git submodule add https://github.com/BeSimple/BeSimpleSoapBundle.git vendor/bundles/WebServiceBundle
* Enable WebServiceBundle in your `app/AppKernel.php`
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new new Bundle\WebServiceBundle\WebServiceBundle(),
// ...
);
}
* Register the Bundle namespace
// app/autoload.php
$loader->registerNamespaces(array(
'Bundle' => __DIR__.'/../vendor/bundles',
'Zend\\Soap' => __DIR__.'/../vendor/zend-frameword/library',
// your other namespaces
));
* Include the WebServiceBundle's routing configuration in `app/config/routing.yml` (you can choose the prefix arbitrarily)
_ws:
@ -27,32 +59,40 @@ QuickStart
web_service:
services:
DemoApi:
namespace: http://mysymfonyapp.com/ws/DemoApi/1.0/
namespace: http://mysymfonyapp.com/ws/DemoApi/1.0/
binding: rpc-literal
resource: "@AcmeDemoBundle/Controller/DemoController.php"
resource_type: annotation
* Annotate your controller methods
// src/Acme/DemoBundle/Controller/DemoController.php
/**
* @ws:Method("Hello")
* @ws:Param("name", type = "string")
* @ws:Result(type = "string")
*/
public function helloAction($name)
use Bundle\WebServiceBundle\ServiceDefinition\Annotation\Method;
use Bundle\WebServiceBundle\ServiceDefinition\Annotation\Param;
use Bundle\WebServiceBundle\ServiceDefinition\Annotation\Result;
use Bundle\WebServiceBundle\Soap\SoapResponse;
class DemoController extends Controller
{
return new SoapResponse(sprintf('Hello %s!', $name));
/**
* @Method("Hello")
* @Param("name", phpType = "string")
* @Result(phpType = "string")
*/
public function helloAction($name)
{
return new SoapResponse(sprintf('Hello %s!', $name));
}
}
* Open your web service endpoint
* `http://localhost/app_dev.php/ws/DemoApi` - HTML documentation
* `http://localhost/app_dev.php/ws/DemoApi?WSDL` - WSDL file
* `http://localhost/app_dev.php/ws/DemoApi?wsdl` - WSDL file
Test
----
phpunit -c myapp src/Bundle/WebServiceBundle
phpunit -c phpunit.xml.dist
[1]: http://www.symfony-project.org/plugins/ckWebServicePlugin