I am trying to create a web service in Symfony. I have looked at these webs, and tried them all, but they do not work for me.
http://besim.pl/SoapBundle/soapserver/configuration.html
http://barandigoyen.wordpress.com/2012/07/13/como-implementar-un-web-service-wsdl-en-symfony-2/
Could anyone explain the process better, step by step, please?
Thanks a lot!!!
EDITED: The steps I have followed are:
1) Added the following to composer.json
"require":{
...
"besimple/soap-bundle": "dev-master",
"besimple/soap-common": "dev-master",
"ass/xmlsecurity": "dev-master",
"besimple/soap-server": "dev-master",
"besimple/soap-client": "dev-master"
...
}
2) Run the following:
$ php composer.phar self-update
$ php composer.phar update
3) Added the following to app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new BeSimple\SoapBundle\BeSimpleSoapBundle(),
// ...
);
}
4) Added the followin to app/config/config.yml
be_simple_soap:
cache:
type: disk
lifetime: 86400
limit: 5
services:
AplicationService:
namespace: http://localhost/myproject/web/app_dev.php/ws/AplicationService
binding: rpc-literal
resource: “@StaticBundle/Controller/WebServiceController.php“
resource_type: annotation
5) Added the following to app/config/routing.yml
_besimple_soap:
resource: "@BeSimpleSoapBundle/Resources/config/routing/webservicecontroller.xml"
prefix: /ws
6) Create the following Controller in StaticBundle
namespace myproject\StaticBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
class WebServiceController extends Controller
{
/**
* @Soap\Method("hello")
* @Soap\Param("name", phpType = "string")
* @Soap\Result(phpType = "string")
*/
public function helloAction($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));
}
}
7) Access to localhost/myproject/web/app_dev.php/ws/AplicationService?wsdl and get a xml with error code 500.