Home > Backend Development > PHP Tutorial > zend framework 提供的webservices,该如何处理

zend framework 提供的webservices,该如何处理

WBOY
Release: 2016-06-13 11:07:11
Original
835 people have browsed it

zend framework 提供的webservices
谁有这样的完整的例子。用到Zend_Soap_Server 等zend framework提供的soap扩展的。
想学一下,哪位大侠给提供一些资料,例子的更好啊。最好是那种能运行的简单小例子,谢谢啦
------解决方案--------------------
application/controllers/WebServiceController.php

<br /><?php<br />class WebServiceController extends Zend_Controller_Action {<br />	public function init() {<br />    	$this->_helper->viewRenderer->setNoRender();<br />	}<br />	<br />	public function indexAction() {<br />		if (isset($_GET['wsdl'])) {<br />			$autodiscover = new Zend_Soap_AutoDiscover();	<br />		    $autodiscover->setClass('Service_Helloworld');<br />		    $autodiscover->handle();<br />		} else {<br />		    $soap = new Zend_Soap_Server("http://zf-demo.localhost/WebService/index/?wsdl");<br />		    $soap->setClass('Service_Helloworld');<br />		    $soap->handle();<br />		}<br />	}<br />	<br />	public function testAction() {<br />		$params = array(<br />			'name' => 'tom'<br />		);<br />		<br />		$client = new SoapClient("http://zf-demo.localhost/WebService/index/?wsdl", array('trace' => 1));<br />		echo $client->__soapCall('sayHello', $params);<br />	}<br />	<br />}<br />
Copy after login


application/services/Helloworld.php
<br /><?php<br />class Service_Helloworld {<br />	/**<br />	 * say hello<br />	 * @param string $name<br />	 * @return string<br />	 */<br />	public function sayHello($name) {<br />		return 'hello ' . $name;<br />	}<br />}<br />
Copy after login



请将http://zf-demo.localhost改为你自己的域名

------解决方案--------------------

引用:
高手们 还有吗?

1楼的不行吗?符合你要求啊,简单的小例子.
------解决方案--------------------
zend framework 英文版的用不习惯,不知道有没有汉化的,在此之前,我一直用的是EclipsePHP Studio ,还可以!!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template