|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
JSON-RPC service introspectionHello, I just committed a change to the RpcPhp server trunk that allows service introspection similar to the one found in XMLRPC: http://xmlrpc-c.sourceforge.net/introspection.html In contrast to the XMLRPC standard, the methods "listMethods", "methodSignature" and "methodHelp" are not methods of a virtual service "system", but are made available as parts of the service class itself. In PHP, this is achieved by extending the ServiceIntrospection class (which is automatically included by the server) or by implementing methods that forward to the API methods like so: function method_methodSignature( $method ) { return new ServiceIntrospection( $this )->method_methodSignature( $method ); } Thus, you have full control over whether to allow introspection or not. The details of the implementation can be viewed here: http://qooxdoo-contrib.svn.sourceforge.net/viewvc/qooxdoo-contrib/trunk/qooxdoo-contrib/RpcPhp/trunk/services/server/ServiceIntrospection.php?view=markup You can see a demo of the three methods here: http://www.qxtransformer.org/qooxdoo/RpcConsole/trunk/demo/default/build/?serverUrl=http://www.qxtransformer.org/qooxdoo/RpcPhp/trunk/services/&runTest=listMethods http://www.qxtransformer.org/qooxdoo/RpcConsole/trunk/demo/default/build/?serverUrl=http://www.qxtransformer.org/qooxdoo/RpcPhp/trunk/services/&runTest=methodSignature http://www.qxtransformer.org/qooxdoo/RpcConsole/trunk/demo/default/build/?serverUrl=http://www.qxtransformer.org/qooxdoo/RpcPhp/trunk/services/&runTest=methodHelp I would like to propose that the other backends implement this simple introspection as well. Of course, I am open to changes to the introspection API in order to achieve interoperability. Best, Christian -- View this message in context: http://n2.nabble.com/JSON-RPC-service-introspection-tp3917779p3917779.html Sent from the qooxdoo mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: JSON-RPC service introspectionOn Fri, Oct 30, 2009 at 05:05, panyasan <info@...> wrote:
... I would like to propose that the other backends implement this simple Chrisitan, this looks really nice. Based on the very few issues that have been raised regarding the PHP trunk server, I believe that it is getting to the point of being pretty stable (or maybe it's just that few are using it?), so I'm not going to enhance the 1.0.x server with this functionality unless you are less certain about the stability of trunk. Derrell ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: JSON-RPC service introspection
Christian,
So this new introspection functionality is completely contained within the updated RPCPHP contrib code and doesn't require anything special in the remote service classes themselves? I looked through the materials you provided, and it's not clear but appears that way to me. I think the code you added uses PHP methods to gather knowledge about the called PHP code, or am I misinterpreting how the service introspection will function? Thanks, Gene On Fri, 2009-10-30 at 02:05 -0700, panyasan wrote: Hello, I just committed a change to the RpcPhp server trunk that allows service introspection similar to the one found in XMLRPC: http://xmlrpc-c.sourceforge.net/introspection.html In contrast to the XMLRPC standard, the methods "listMethods", "methodSignature" and "methodHelp" are not methods of a virtual service "system", but are made available as parts of the service class itself. In PHP, this is achieved by extending the ServiceIntrospection class (which is automatically included by the server) or by implementing methods that forward to the API methods like so: function method_methodSignature( $method ) { return new ServiceIntrospection( $this )->method_methodSignature( $method ); } Thus, you have full control over whether to allow introspection or not. The details of the implementation can be viewed here: http://qooxdoo-contrib.svn.sourceforge.net/viewvc/qooxdoo-contrib/trunk/qooxdoo-contrib/RpcPhp/trunk/services/server/ServiceIntrospection.php?view=markup You can see a demo of the three methods here: http://www.qxtransformer.org/qooxdoo/RpcConsole/trunk/demo/default/build/?serverUrl=http://www.qxtransformer.org/qooxdoo/RpcPhp/trunk/services/&runTest=listMethods http://www.qxtransformer.org/qooxdoo/RpcConsole/trunk/demo/default/build/?serverUrl=http://www.qxtransformer.org/qooxdoo/RpcPhp/trunk/services/&runTest=methodSignature http://www.qxtransformer.org/qooxdoo/RpcConsole/trunk/demo/default/build/?serverUrl=http://www.qxtransformer.org/qooxdoo/RpcPhp/trunk/services/&runTest=methodHelp I would like to propose that the other backends implement this simple introspection as well. Of course, I am open to changes to the introspection API in order to achieve interoperability. Best, Christian ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: JSON-RPC service introspectionOn Fri, Oct 30, 2009 at 09:01, Gene Amtower <gene@...> wrote:
Although I haven't inspected Christian's implementation in detail, it looks like the service class simply needs to be changed to extend his introspection class. It appears no other changes are required. Derrell ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: JSON-RPC service introspectionGene Amtower wrote: > > Christian, > > So this new introspection functionality is completely contained within > the updated RPCPHP contrib code and doesn't require anything special in > the remote service classes themselves? > > I looked through the materials you provided, and it's not clear but > appears that way to me. I think the code you added uses PHP methods to > gather knowledge about the called PHP code, or am I misinterpreting how > the service introspection will function? > > have a look at http://qooxdoo-contrib.svn.sourceforge.net/viewvc/qooxdoo-contrib/trunk/qooxdoo-contrib/RpcPhp/trunk/services/class/qooxdoo/test.php?view=markup Your class doesn't need to do anything except extend the ServiceIntrospection class (which is loaded automatically by the server script - no need to include it manually). If this isn't possible becaus your inheritance chain doesn't allow it, you can "mixin" the methods by defining proxy methods (see the first posting in this thread). Cheers, Christian -- View this message in context: http://n2.nabble.com/JSON-RPC-service-introspection-tp3917779p3919008.html Sent from the qooxdoo mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: JSON-RPC service introspectionDerrell Lipman wrote: > > On Fri, Oct 30, 2009 at 05:05, panyasan <info@...> wrote: > >> >> Hello, >> >> I just committed a change to the RpcPhp server trunk that allows service >> introspection >> > ... > >> I would like to propose that the other backends implement this simple >> introspection as well. Of course, I am open to changes to the >> introspection >> API in order to achieve interoperability. > > Chrisitan, this looks really nice. Based on the very few issues that have > been raised regarding the PHP trunk server, I believe that it is getting > to > the point of being pretty stable (or maybe it's just that few are using > it?), so I'm not going to enhance the 1.0.x server with this functionality > unless you are less certain about the stability of trunk. > > Derrell > > Hi Derrell, I am all in favor of releasing the trunk as the next stable - has worked for me without any issues. It would also be good to release it as the last version that supports PHP4 - then we can drop support for that and can get rid of the wierd coding style that is required when one tries to support PHP4-5.3. So what about releasing it as 1.5 and then a PHP5.0-only 2.0? Thanks, Christian -- View this message in context: http://n2.nabble.com/JSON-RPC-service-introspection-tp3917779p3919027.html Sent from the qooxdoo mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: JSON-RPC service introspectionOn Fri, Oct 30, 2009 at 09:57, panyasan <info@...> wrote:
I'd prefer not to skip from 1.0 to 1.5. Instead, I'd release it as 1.1.0 (keeping the existing 3-level numbering that allows for bug fixes with no change of functionality). If we never release a 1.2.x and go right to 2.0.0 for the PHP5-only version, that's fine too. I've still not had a chance to work with the trunk PHP server, but based (again) on the lack of bug reports, if you're satisfied that it's stable, go ahead and release it. Derrell ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: JSON-RPC service introspection...which reminded me of my promise some month ago that I would test the PHP4 backend and report my experiences... So hi there, I just got trunk and packed it onto my PHP4 test server (W2K with PHP4.4.8), this is what came out (used FF3.5.4 with firebug): 1. The first rpc threw: { error: { "origin":1, "code":-1, "message":"Fatal PHP Error: Call to undefined function: json_decode() in C:\\Inetpub\\wwwroot\\rpctestproj\\rpc\\services\\server\\lib\\JsonWrapper.php on line 63 "}} I was able to fix this by changing line 19 in JsonWrapper.php to function JsonWrapper() so that the method becomes a PHP4 constructor, thus $this->_json gets created. 2. After the json issue got fixed, next issue was: {"error":{"origin":2,"code":2,"message":"Service `rpctestproj.testclass` not found."},"id":1} This got me stuck; needless to say, the service is there (testclass.php in rpctestproj directory, within the rpc/services dir); I left the directory structure untouched for this test, so I wonder if I forgot some step? Is there some additional configuration necessary for the new server? Christian, I would appreciate if you could help me get started with RpcPHP trunk (the only version I tested before was Derrell's server, which I use a lot, sometimes in the php4-hacked version). Apart from that, I think service introspection is a great idea, will make bigger projects way easier, esp. when frontend and backend are developed independently. Greetings, Stefan Derrell Lipman wrote: > On Fri, Oct 30, 2009 at 05:05, panyasan <info@... > <mailto:info@...>> wrote: > > > Hello, > > I just committed a change to the RpcPhp server trunk that allows service > introspection > > ... > > I would like to propose that the other backends implement this simple > introspection as well. Of course, I am open to changes to the > introspection > API in order to achieve interoperability. > > > Chrisitan, this looks really nice. Based on the very few issues that > have been raised regarding the PHP trunk server, I believe that it is > getting to the point of being pretty stable (or maybe it's just that few > are using it?), so I'm not going to enhance the 1.0.x server with this > functionality unless you are less certain about the stability of trunk. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: JSON-RPC service introspectionHi Stefan, thanks for taking time to test the trunk. Stefan Volbers wrote: > > > ...which reminded me of my promise some month ago that I would test the > PHP4 backend and report my experiences... > > So hi there, I just got trunk and packed it onto my PHP4 test server > (W2K with PHP4.4.8), this is what came out (used FF3.5.4 with firebug): > > 1. The first rpc threw: > { error: { "origin":1, "code":-1, "message":"Fatal PHP Error: > Call to undefined function: json_decode() in > C:\\Inetpub\\wwwroot\\rpctestproj\\rpc\\services\\server\\lib\\JsonWrapper.php > on line 63 "}} > > I was able to fix this by changing line 19 in JsonWrapper.php to > function JsonWrapper() > so that the method becomes a PHP4 constructor, thus $this->_json gets > created. > Thanks, this was indeed a bug, fixed in rev. 19458 Stefan Volbers wrote: > > > 2. After the json issue got fixed, next issue was: > {"error":{"origin":2,"code":2,"message":"Service `rpctestproj.testclass` > not found."},"id":1} > > This got me stuck; needless to say, the service is there (testclass.php > in rpctestproj directory, within the rpc/services dir); I left the > directory structure untouched for this test, so I wonder if I forgot > some step? Is there some additional configuration necessary for the new > server? > In the trunk version, the service classes go into the "class" directory, so that they are cleanly separated from the services. You can also specify a different location with the "servicePathPrefix" constant in the global_settings.php file. So if your namespace is on the services folder, setting it to "" should do the trick (untested). /* * if the service classes are not in the class/ folder, * customize the service path prefix here (trailing slash required) */ define( "servicePathPrefix", "/your/custom/location/" ); -- View this message in context: http://n2.nabble.com/JSON-RPC-service-introspection-tp3917779p3920433.html Sent from the qooxdoo mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
|
|
Re: JSON-RPC service introspectionHi Christian,
thanks for your answer. Actually moving the folder of the rpc class into the "class" directory did it, while the empty servicePathPrefix config var didn't (and yes, I did remove the comment slashes...;-) So regarding this quick test, I got the backend running. Haven't yet had time to test the new introspection feature though. Seems like we both were the only sad ones who still have to support php4 server systems.. in my case, I'm happy at least one of my customers' servers will probably soon be updated to php5; having a stable backend which is able to serve php4 AND php5 is invaluable in my case. Thanks again for your workings on the php backend, greetings, Stefan panyasan wrote: > Hi Stefan, > > thanks for taking time to test the trunk. > > > Stefan Volbers wrote: >> >> ...which reminded me of my promise some month ago that I would test the >> PHP4 backend and report my experiences... >> >> So hi there, I just got trunk and packed it onto my PHP4 test server >> (W2K with PHP4.4.8), this is what came out (used FF3.5.4 with firebug): >> >> 1. The first rpc threw: >> { error: { "origin":1, "code":-1, "message":"Fatal PHP Error: >> Call to undefined function: json_decode() in >> C:\\Inetpub\\wwwroot\\rpctestproj\\rpc\\services\\server\\lib\\JsonWrapper.php >> on line 63 "}} >> >> I was able to fix this by changing line 19 in JsonWrapper.php to >> function JsonWrapper() >> so that the method becomes a PHP4 constructor, thus $this->_json gets >> created. >> > > Thanks, this was indeed a bug, fixed in rev. 19458 > > > Stefan Volbers wrote: >> >> 2. After the json issue got fixed, next issue was: >> {"error":{"origin":2,"code":2,"message":"Service `rpctestproj.testclass` >> not found."},"id":1} >> >> This got me stuck; needless to say, the service is there (testclass.php >> in rpctestproj directory, within the rpc/services dir); I left the >> directory structure untouched for this test, so I wonder if I forgot >> some step? Is there some additional configuration necessary for the new >> server? >> > > In the trunk version, the service classes go into the "class" directory, so > that they are cleanly separated from the services. You can also specify a > different location with the "servicePathPrefix" constant in the > global_settings.php file. So if your namespace is on the services folder, > setting it to "" should do the trick (untested). > > /* > * if the service classes are not in the class/ folder, > * customize the service path prefix here (trailing slash required) > */ > define( "servicePathPrefix", "/your/custom/location/" ); > ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel |
| Free embeddable forum powered by Nabble | Forum Help |