2009年1月22日星期四

RE: [fw-webservices] Is it possible to write the Xmlrpc server code as an action inside a cotroller?

Hi,

I read your blog post and it makes perfect sense.

Unfortunately I made this mistake as well and am looking to correct this.

I have a question however:
In my case it's a SOAP server that's being instantiated inside a controller. In that controller I load the config settings from registry that were loaded in my bootstrap file. How would you load those settings in a page controller that knows nothing of my MVC application?

You must face the similar problem I guess? How did you solve it? ;)

Regards,
Dieter

-----Original Message-----
From: Benjamin Eberlei [mailto:kontakt@beberlei.de]
Sent: donderdag 22 januari 2009 11:56
To: fw-webservices@lists.zend.com
Subject: Re: [fw-webservices] Is it possible to write the Xmlrpc server code as an action inside a cotroller?


It is possible, but i wouldnt say recommended!

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.


No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.176 / Virus Database: 270.10.12/1908 - Release Date: 22/01/2009 7:08

没有评论: