From the SOAP server page here, this is the client that can connect to the PHP server page, the client uses the WSDL (Web Services Description Language) part of the server to find out the functions that are available.
To connect to the server WSDL, you create a new Soap Client with the WSDL as the URI link
$client = new SoapClient("http://localhost/projects/webservice/zend_soap_server.php?wsdl")
in this example I am passing in some variables for debugging
array(
"trace" => 1, // enable trace to view what is happening
"exceptions" => 0, // disable exceptions
"cache_wsdl" => 0) // disable any caching on the wsdl, encase you alter the wsdl server
so to only get a response from the server you just need to call the function on the server like it is running within the local PHP environment
echo $client->getQuote("monday");
What is happening behind the scenes, is that the client has created a XML request and send that to the server, the server processes the request and responds with a XML response to the client, the client then pulls out the result from the XML response, here is how with using the soap client trace debugging out
// display what was sent to the server (the request)
echo "Request :".htmlspecialchars($client->__getLastRequest()) ."
";
// display the response from the server
echo "Response:".htmlspecialchars($client->__getLastResponse())."
";
here is the full source code, save as zend_soap_client.php (it is not using any zend framework, but the server is)
1, // enable trace to view what is happening
"exceptions" => 0, // disable exceptions
"cache_wsdl" => 0) // disable any caching on the wsdl, encase you alter the wsdl server
);
// get a response from the WSDL zend server function getQuote for the day monday
echo $client->getQuote("monday");
// display what was sent to the server (the request)
echo "Request :".htmlspecialchars($client->__getLastRequest()) ."
";
// display the response from the server
echo "Response:".htmlspecialchars($client->__getLastResponse())."
";
?>
and here is the output on the web page
Monday's child is fair of face
Request :
monday
Response:
Monday's child is fair of face