Who has such a complete example of the webservices provided by zendframework. Use Zend_Soap_Server & nbsp; and other soap extensions provided by zend & nbsp; framework. I would like to learn which man provides some materials. The example is better. It is better to use a simple example that can run. thank you. the webservices provided by applicati zend framework
Who has such a complete example. Use the soap extensions provided by zend framework, such as Zend_Soap_Server.
I would like to learn which man provides some materials. The example is better. It's better to use a simple example. thank you.
------ Solution --------------------
Application/controllers/WebServiceController. php
class WebServiceController extends Zend_Controller_Action {
public function init() {
$this->_helper->viewRenderer->setNoRender();
}
public function indexAction() {
if (isset($_GET['wsdl'])) {
$autodiscover = new Zend_Soap_AutoDiscover();
$autodiscover->setClass('Service_Helloworld');
$autodiscover->handle();
} else {
$soap = new Zend_Soap_Server("http://zf-demo.localhost/WebService/index/?wsdl");
$soap->setClass('Service_Helloworld');
$soap->handle();
}
}
public function testAction() {
$params = array(
'name' => 'tom'
);
$client = new SoapClient("http://zf-demo.localhost/WebService/index/?wsdl", array('trace' => 1));
echo $client->__soapCall('sayHello', $params);
}
}
Application/services/Helloworld. php
class Service_Helloworld {
/**
* say hello
* @param string $name
* @return string
*/
public function sayHello($name) {
return 'hello ' . $name;
}
}
Change http://zf-demo.localhost to your own domain name
------ Solution --------------------
Reference:
Are there other Masters?
Can't I do it on the first floor? Meet your requirements. A simple example is provided.
------ Solution --------------------
I am not used to using the English version of zend framework. I don't know if there is any Chinese version. Before that, I used EclipsePHP Studio !!