I wouldnt publish a webservice inside an action controller. The overhead is
considerable and they don't really match together, the front controller,
routing and execution of the action seems quite overhead for "finding" a
service that dispatches to subfunctions and methods, never uses any
fucntions from the Request and Response objects and disables the View
Renderer.
I have written a blog post on that:
http://www.whitewashing.de/blog/articles/106
When you are using the current .htaccess mod_rewrite out the controller
documentation, you can do as follows:
1. new file webservice/myservice/index.php in your projects document root.
2. publish webservice there
3. any request to webservice/myservice/ will be recognized to have a file
present and use the new file you generated.
4. if you need authentication build a proxy around your webservice that
includes the ACL and Auth (with HTTP Authentication) from your normal
application.
For this to work your bootstrapping mechanism needs to be sufficiently
configurable.
This is the way i would always build a webservice with ZF.
On Thu, 22 Jan 2009 02:40:06 -0800 (PST), anz_nabble <anz@feathersoft.de>
wrote:
>
> Is it possible to implement the Xml rpc server just like an action inside
> a
> Cotroller ?
>
> I mean, just like...
>
>
> function runXmlRpcAction()
> {
> Zend_Loader::loadClass('Zend_XmlRpc_Server');
>
>
> $server = new Zend_XmlRpc_Server(); // Initializes XMLRPC server
>
> require_once 'Listnews.php'; // Includes class files that attach to
> server
>
> $server->setClass('Listnews', 'news'); // Attaches class methods as
> XML-RPC method handlers
>
> $response = $server->handle(); // Handle RPCs
>
> $response->setEncoding('UTF-8'); // Sets response character encoding
>
> header( 'Content-Type: text/xml; charset=UTF-8' ); // Sets HTTP header
>
> echo $response; // Outputs the response
>
>
>
> }
>
>
> Can anyone provide me the procedure to make a simple webservice using
> XMLRPC
> ?
> --
> View this message in context:
>
http://www.nabble.com/Is-it-possible-to-write-the-Xmlrpc-server-code-as-an-action-inside-a-cotroller--tp21601672p21601672.html
> Sent from the Zend Web Services mailing list archive at Nabble.com.
没有评论:
发表评论