JSON RPC Implementation - Starting Point

175 views
Skip to first unread message

Phillip Verheyden

unread,
Apr 6, 2011, 3:00:38 PM4/6/11
to joomla-...@googlegroups.com
Hey everybody, I always like to start off emails to dev lists with a big thank you to the dev community for producing such a fantastically excellent piece of software.  I've used Joomla now for ~3.5 years and it's basically a dream come true.  When 1.5 came along I practically crapped myself.  We're hoping to upgrade to 1.6 soon, but we're waiting on a couple of components that we use to get up to speed.

Anyway, so now for the question.  I'm in the process of developing a mobile application that needs to interface with my Joomla site as well as most of the components that I use.  After doing quite a bit of research, there isn't a whole lot of Joomla core work for this functionality (except for this post which was 2 years ago) and it's definitely getting to be a necessity.  It looks like the only semi-core support is in the form of xml-rpc plugins which I discovered today how they work.

I would really like to do something with JSON though, since I can make the payload much smaller (theoretically) back and forth.  Since I'm developing for mobile (iPhone/Android) the smaller the payload the better since we're living with transfer limits (BLECH) and often-times slow connections.  I want to try to plug in a JSON-RPC framework in order to make this possible, but I'm a little confused as to how the existing XML-RPC framework works.  The best that I can tell is that if you go to http://www.example.com/xmlrpc and you have the "Web Services" option enabled, then that's the entry point for all of your RPC calls (which you can write plugins to handle).  So where should I start looking (and hacking) to make it to where you can visit http://www.example.com/jsonrpc and it hits whatever JSON-RPC library I want to add in?

As a side note, currently my site runs on 1.5 (as stated earlier, for compatibility reasons) but I obviously want to plan for the future (mainly because 1.6 is already stable ha) so I would hate to implement something that is going to be implemented in the near future.  Thoughts on this aspect?

Thanks so much for your help.
-Phillip

panda

unread,
Apr 12, 2011, 4:53:59 AM4/12/11
to Joomla! CMS Development
Hi Philip,

I have the same need as you have.
I'm using GWT on the client side and I have Joomla 1.5 on the server
side.
I'm building a JSON object on client and I need to send this object to
the server and request a service. I can do that in an old manner (that
I don't like) to send the JSON object in POST and that the URL
receiving the object handles the service implicitly. I would prefer to
request a service implemented by teh server and to send the parameters
for that service -> JSON-RPC on Joomla 1.5.

So, what did you discovered for that topic? I never tried the XML-RPC
neither so I don't have any idea how to work it out.

Kind regards,

panda

On Apr 6, 9:00 pm, Phillip Verheyden <pverhey...@gmail.com> wrote:
> Hey everybody, I always like to start off emails to dev lists with a big
> thank you to the dev community for producing such a fantastically excellent
> piece of software.  I've used Joomla now for ~3.5 years and it's basically a
> dream come true.  When 1.5 came along I practically crapped myself.  We're
> hoping to upgrade to 1.6 soon, but we're waiting on a couple of components
> that we use to get up to speed.
>
> Anyway, so now for the question.  I'm in the process of developing a mobile
> application that needs to interface with my Joomla site as well as most of
> the components that I use.  After doing quite a bit of research, there isn't
> a whole lot of Joomla core work for this functionality (except for
> this post<http://docs.joomla.org/Xml-rpc_changes_in_Joomla%21_1.6>which
> was 2 years ago) and it's definitely getting to be a necessity.  It
> looks like the only semi-core support is in the form of xml-rpc plugins
> which I discovered today how they work.
>
> I would really like to do something with JSON though, since I can make the
> payload much smaller (theoretically) back and forth.  Since I'm developing
> for mobile (iPhone/Android) the smaller the payload the better since we're
> living with transfer limits (BLECH) and often-times slow connections.  I
> want to try to plug in a JSON-RPC framework in order to make this possible,
> but I'm a little confused as to how the existing XML-RPC framework works.
> The best that I can tell is that if you go tohttp://www.example.com/xmlrpcandyou have the "Web Services" option
> enabled, then that's the entry point
> for all of your RPC calls (which you can write plugins to handle).  So where
> should I start looking (and hacking) to make it to where you can visithttp://www.example.com/jsonrpcand it hits whatever JSON-RPC library I want

Phillip Verheyden

unread,
Apr 12, 2011, 4:57:50 PM4/12/11
to joomla-...@googlegroups.com
Yeah after researching it quite a bit, it looks like RPC is the way to go with this one.  I think if you wanted to do JSON-RPC you need to add that library in and then maybe a root folder called /jsonrpc that serves as the front-end.  If you look at /xmlrpc/index.php then that has all the hooks for the xmlrpc library.

I think the main reason I'm going to use RPC is because there are more examples out there for me to use of it tying in to Joomla and it will require slightly less work on my end.  It's not my preferred choice because those requests/responses are pretty verbose.  It might be different for your JSON implementation though.  I'm actually looking to move to JSON anyway, so I'm interested to see what you come up with in adding that to Joomla.

The other reason I decided to go with RPC is because I saw that somebody wrote a plugin to drop that library into 1.6, since now you can manage those just like any other component (I'll link to it later; the bookmark is on another computer and I haven't set up FF sync).  Once again, in the realm of all scenarios being equal, the one that requires me to do less work is the better one :)

Let me know what you find.

Thanks,
Phillip

--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To post to this group, send an email to joomla-...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-cms?hl=en-GB.


panda

unread,
Apr 13, 2011, 4:54:00 AM4/13/11
to Joomla! CMS Development
I'm looking quickly in /libraries/phpxmlrpc/xmlrpc.php and I see
that's not so simple to make the JSON equivalent...
I will start looking for a library implementing JSON RPC in PHP. It'll
be easier to adapt it for importing as library in joomla 1.5 than
doing all by myself...
As you, for me the time is the problem. So I'll follow the fastest way
toward a solution. Maybe I'll start by sending my JSON object from the
client to the server via a POST only and let the php code located at
the indicated URL to handle the requste and compose the response... I
know that's not the best but if this php implementation of JSON RPC
is too heavy...

BY the way, did you have a strong motivation to go to Joomla 1.6? I
did some custiomizations on Joomla 1.5 and it becomes hard to migrate
because I will have to solve lots of problems. Then , in a general
manner, I don't care about being up-to-date with respect to the latest
Joomla version. What is opinion?

Kind regards,

panda

On Apr 12, 10:57 pm, Phillip Verheyden <pverhey...@gmail.com> wrote:
> Yeah after researching it quite a bit, it looks like RPC is the way to go
> with this one.  I think if you wanted to do JSON-RPC you need to add that
> library in and then maybe a root folder called /jsonrpc that serves as the
> front-end.  If you look at /xmlrpc/index.php then that has all the hooks for
> the xmlrpc library.
>
> I think the main reason I'm going to use RPC is because there are more
> examples out there for me to use of it tying in to Joomla and it will
> require slightly less work on my end.  It's not my preferred choice because
> those requests/responses are pretty verbose.  It might be different for your
> JSON implementation though.  I'm actually looking to move to JSON anyway, so
> I'm interested to see what you come up with in adding that to Joomla.
>
> The other reason I decided to go with RPC is because I saw that somebody
> wrote a plugin to drop that library into 1.6, since now you can manage those
> just like any other component (I'll link to it later; the bookmark is on
> another computer and I haven't set up FF sync).  Once again, in the realm of
> all scenarios being equal, the one that requires me to do less work is the
> better one :)
>
> Let me know what you find.
>
> Thanks,
> Phillip
>
> >www.example.com/xmlrpcandyouhave the "Web Services" option
> > > enabled, then that's the entry point
> > > for all of your RPC calls (which you can write plugins to handle).  So
> > where
> > > should I start looking (and hacking) to make it to where you can
> > visithttp://www.example.com/jsonrpcandit hits whatever JSON-RPC library I
Reply all
Reply to author
Forward
0 new messages