Skip to content

Commit 1fed97b

Browse files
author
Roger Webb
committed
Added double-back-quotes to mark function names inline, expanded the sentence before the first example and added a blank line after block declarations
1 parent bb20bf8 commit 1fed97b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cookbook/web_services/php_soap_extension.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ tools. You must, of course, have the `PHP SOAP`_ extension installed.
66
As the PHP SOAP extension can not currently generate a WSDL, you must either
77
create 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
4043
methods control `output buffering`_ which allows us to "trap" the echoed
41-
output of $server->handle().
44+
output of ``$server->handle()``.
4245
This is necessary because Symfony expects our controller to return a
4346
Response object with our output as it's "content". You must also remember
4447
to set the "Content-Type" header to "text/xml", as this is what the client
4548
will 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
4750
and clear our output buffer. Finally, we're ready to return our Response.
4851

4952
Below is an example calling our service using `NuSOAP`_ client. This example
5053
assumes 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

Comments
 (0)