โค๊ดส่วนแรกจะเป็นส่วนของการเจ็นโค๊ดเป็นWSDL
โค้ด: เลือกทั้งหมด
require('Zend/Soap/AutoDiscover.php');
/**
* Returns Hello World as a string.
*
* @return string
*/
function hello() {
return "Hello World";
}
$autodiscover = new Zend_Soap_AutoDiscover();
$autodiscover->addFunction('hello');
$autodiscover->handle();
โค้ด: เลือกทั้งหมด
require('Zend/Soap/Server.php');
function hello() {
return "Hello World";
}
$options = array('actor' => 'http://localhost/web-servicesLab/testzendsoap.php');
$server = new Zend_Soap_Server(null, null);
$server->setWsdl('http://localhost/web-servicesLab/testzendsoap.php?wsdl');
$server->setOptions($options);
$server->addFunction('hello');
$server->handle();
โค้ด: เลือกทั้งหมด
require('Zend/Soap/Client.php');
$client = new Zend_Soap_Client("http://localhost/web-servicesLab/testzendsoapServer.php?wsdl", array('location' => "http://localhost/web-servicesLab/testzendsoapClient.php",
'compression' => SOAP_COMPRESSION_ACCEPT));
echo $client->hello();
http://framework.zend.com/manual/en/zend.soap.htmlนี่เป็นลิงค์ของ reference ที่ผมศีกษาครับ