Skip to content

Instantly share code, notes, and snippets.

@francisbesset
Created August 5, 2013 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francisbesset/6156111 to your computer and use it in GitHub Desktop.
Save francisbesset/6156111 to your computer and use it in GitHub Desktop.
<?php
namespace App\DemoBundle\Entity;
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
class Address
{
/**
* @Soap\ComplexType("int", nillable=true)
*/
protected $id;
/**
* @Soap\ComplexType("string", nillable=true)
*/
protected $label;
public function __construct($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function getLabel()
{
return $this->label;
}
public function setLabel($label)
{
$this->label = $label;
}
}
be_simple_soap:
services:
DemoApi:
namespace: http://mysymfonyapp.com/ws/DemoApi/1.0/
binding: rpc-literal
resource: "@AppDemoBundle/Controller/DemoController.php"
resource_type: annotation
<?php
namespace App\DemoBundle\Controller;
use App\DemoBundle\Entity\Address;
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use Symfony\Component\DependencyInjection\ContainerAware;
class DemoController extends ContainerAware
{
/**
* @Soap\Method("getAddress")
* @Soap\Param("id", phpType = "int")
* @Soap\Result(phpType = "App\DemoBundle\Entity\Address")
*/
public function getAction($id)
{
$address = new Address($id);
$address->setLabel("Test Label");
return $address;
}
}
_besimple_soap:
resource: "@BeSimpleSoapBundle/Resources/config/routing/webservicecontroller.xml"
prefix: /ws
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://mysymfonyapp.com/ws/DemoApi/1.0/">
<soapenv:Header/>
<soapenv:Body>
<ns:getAddress>
<id>42</id>
</ns:getAddress>
</soapenv:Body>
</soapenv:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://mysymfonyapp.com/ws/DemoApi/1.0/">
<SOAP-ENV:Body>
<ns1:getAddressResponse>
<return>
<id>42</id>
<label>Test Label</label>
</return>
</ns1:getAddressResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment