How to handle webservices provided by zendframework

Source: Internet
Author: User
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 !!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.