@@ -6,9 +6,12 @@ tools. You must, of course, have the `PHP SOAP`_ extension installed.
66As the PHP SOAP extension can not currently generate a WSDL, you must either
77create one from scratch or use a 3rd party generator.
88
9- Here is an example o
9+ Below is an example of a controller that is capable of handling a SOAP
10+ request. If ``indexAction() `` is accessible via the route /soap, then the
11+ WSDL document can be retrieved via /soap?wsdl.
1012
1113.. code-block :: php
14+
1215 class MySoapController extends Controller
1316 {
1417 public function indexAction()
@@ -36,27 +39,29 @@ Here is an example o
3639 }
3740 }
3841
39- Take note of the calls to ob_start, ob_get_contents, and ob_clean . These
42+ Take note of the calls to `` ob_start() `` and `` ob_get_clean() `` . These
4043methods control `output buffering `_ which allows us to "trap" the echoed
41- output of $server->handle().
44+ output of `` $server->handle() `` .
4245This is necessary because Symfony expects our controller to return a
4346Response object with our output as it's "content". You must also remember
4447to set the "Content-Type" header to "text/xml", as this is what the client
4548will expect. So, we use ob_start to start buffering the STDOUT and use
46- ob_get_clean to dump the echoed output into the content of our Response
49+ `` ob_get_clean() `` to dump the echoed output into the content of our Response
4750and clear our output buffer. Finally, we're ready to return our Response.
4851
4952Below is an example calling our service using `NuSOAP `_ client. This example
5053assumes indexAction in our controller above is accessible via the route "/soap".
5154
5255.. code-block :: php
56+
5357 $client = new soapclient('http://example.com/app.php/soap?wsdl', true);
5458
5559 $result = $client->call('hello', array('name' => 'Scott'));
5660
5761 An example WSDL is below.
5862
5963.. code-block :: xml
64+
6065 <?xml version =" 1.0" encoding =" ISO-8859-1" ?>
6166 <definitions xmlns : SOAP-ENV =" http://schemas.xmlsoap.org/soap/envelope/"
6267 xmlns : xsd =" http://www.w3.org/2001/XMLSchema"
0 commit comments