Hi.
I've been reading the excellent tutorial at
http://devzone.zend.com/node/view/id/689 but I've a trouble.
client.php
$client = new SoapClient("stockquote.wsdl");
try {
echo "<pre>\n";
print($client->getQuote("ibm"));
echo "\n";
print($client->getQuote("microsoft"));
echo "\n</pre>\n";
} catch (SoapFault $exception) {
echo $exception;
}
server.php
class QuoteService {
private $quotes = array("ibm" => 98.42);
function getQuote($symbol) {
if (isset($this->quotes[$symbol])) {
return $this->quotes[$symbol];
} else {
throw new SoapFault("Server","Unknown Symbol '$symbol'.");
}
}
}
$server = new SoapServer("stockquote.wsdl");
$server->setClass("QuoteService");
$server->handle();
stockquote.wsdl
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='StockQuote'
targetNamespace='http://example.org/StockQuote'
xmlns:tns=' http://example.org/StockQuote '
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
<message name='getQuoteRequest'>
<part name='symbol' type='xsd:string'/>
</message>
<message name='getQuoteResponse'>
<part name='Result' type='xsd:float'/>
</message>
<portType name='StockQuotePortType'>
<operation name='getQuote'>
<input message='tns:getQuoteRequest'/>
<output message='tns:getQuoteResponse'/>
</operation>
</portType>
<binding name='StockQuoteBinding' type='tns:StockQuotePortType'>
<soap:binding style='rpc'
transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getQuote'>
<soap:operation soapAction='urn:xmethods-delayed-quotes#getQuote'/>
<input>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>
<service name='StockQuoteService'>
<port name='StockQuotePort' binding='StockQuoteBinding'>
<soap:address location='http://www.blogial.net/test/soap/server.php'/>
</port>
</service>
</definitions>
when I go at
http://www.blogial.net/test/soap/client.php
I've got this error:
SoapFault exception: [HTTP] Not Found in /mounted-storage/home50a/sub001/sc19485-LOWM/www/test/soap/client.php:5
Stack trace:
#0 [internal function]: SoapClient->doRequest('call('getQuote', Array)
#2 /mounted-storage/home51a/sub-001/svc195485-LOWM/www/test/soap/client.php(5): SoapClient->getQuote('ibm')
#3 {main}
Could you help me, please ?
Bye.