Web services, xmlrpc, help!

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Web services, xmlrpc, help!

Synchro-2

I'm in dire need of any pointers to examples of building an xmlrpc
server and client in Cake (alongside a web interface). The docs mention
it briefly in the config page (of all places), but I can't make it
work, nor have I found any examples for any web services.

As an aside, is the round-trip time in these groups always this bad?
It's 8-12 hours for me.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Chris Hartjes

On 11/6/06, Synchro <[hidden email]> wrote:

>
> I'm in dire need of any pointers to examples of building an xmlrpc
> server and client in Cake (alongside a web interface). The docs mention
> it briefly in the config page (of all places), but I can't make it
> work, nor have I found any examples for any web services.
>
> As an aside, is the round-trip time in these groups always this bad?
> It's 8-12 hours for me.
>
>

Have you ever built one before but not with a framework?  The concepts
are actually quite simple.

--
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

John David Anderson (_psychic_)
In reply to this post by Synchro-2


On Nov 6, 2006, at 11:24 AM, Synchro wrote:

>
> I'm in dire need of any pointers to examples of building an xmlrpc
> server and client in Cake (alongside a web interface). The docs  
> mention
> it briefly in the config page (of all places), but I can't make it
> work, nor have I found any examples for any web services.

Care to provide some details? Let's have a look at what you did in  
order to see what didn't work and why.

> As an aside, is the round-trip time in these groups always this bad?
> It's 8-12 hours for me.

That's pretty good for free advice on free software. I realize, of  
course, that there is always room for improvement, but I don't think  
that there is much room for complaint given our current pricing  
schedule.

I think more concise, detailed questions would garner quicker answers  
as well.

-- John

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

cookxyz@gmail.com

Synchro,
I have just "finished" a woking implementation of SOAP on cake. It's
not RPC, but it's a place to start. I wrote a case study for the
Bakery, I'm still wating on a moderator to approve/reject the article.

If you're in a hurry, I could email the article to you.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

RE: Web services, xmlrpc, help!

realien

I'd like to see it too, we have to implement a REST based service but
may be able to borrow some concepts.

Grnat.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of [hidden email]
Sent: Monday, November 06, 2006 3:14 PM
To: Cake PHP
Subject: Re: Web services, xmlrpc, help!


Synchro,
I have just "finished" a woking implementation of SOAP on cake. It's
not RPC, but it's a place to start. I wrote a case study for the
Bakery, I'm still wating on a moderator to approve/reject the article.

If you're in a hurry, I could email the article to you.




--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Synchro-2
In reply to this post by John David Anderson (_psychic_)



On Nov 6, 1:35 pm, "John David Anderson (_psychic_)"
<[hidden email]> wrote:
> On Nov 6, 2006, at 11:24 AM, Synchro wrote:
> > it briefly in the config page (of all places), but I can't make it
> > work, nor have I found any examples for any web services.
> Care to provide some details? Let's have a look at what you did in  
> order to see what didn't work and why.

My earlier post had more on what I was trying:
http://groups-beta.google.com/group/cake-php/browse_thread/thread/8aa0b0465fbc2b67

A simple do-nothing example would be great - I'm just not clear on
where I should put what and what I should call it in order for it all
to line up with Cake's conventions (I do have the cakesheet, but I
don't get how I should set things up for xmlrpc, or any web service for
that matter).

> > As an aside, is the round-trip time in these groups always this bad?
> > It's 8-12 hours for me.
> That's pretty good for free advice on free software. I realize, of  
> course, that there is always room for improvement, but I don't think  
> that there is much room for complaint given our current pricing  
> schedule.

No, no, you misunderstood! I'm getting that delay between sending a
message and it actually appearing in the group. This last one seemed to
go quite a bit quicker, but my previous ones have taken that long.

I wouldn't dream of demanding responses, and I quite appreciate that
this is all a volunteer effort (I help out where I can).

Marcus


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

cookxyz@gmail.com
In reply to this post by realien

Let's wait one more day to see if the mods at the Bakery will publish
my article. The article is marked up (formatted) for display in the
Bakery and since it is four pages long I don't want to re-format it.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Synchro-2
In reply to this post by Chris Hartjes

On Nov 6, 1:29 pm, "Chris Hartjes" <[hidden email]> wrote:
> Have you ever built one before but not with a framework?  The concepts
> are actually quite simple.

I've built SOAP interfaces before, but not xmlrpc (which should be much
simpler). The trouble I'm having is really just getting it all lined up
in cake, and the lack of docs on the subject isn't helping. I'm happy
to write something for the bakery once it's sorted!

Marcus


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Chris Hartjes

On 11/6/06, Synchro <[hidden email]> wrote:

>
> On Nov 6, 1:29 pm, "Chris Hartjes" <[hidden email]> wrote:
> > Have you ever built one before but not with a framework?  The concepts
> > are actually quite simple.
>
> I've built SOAP interfaces before, but not xmlrpc (which should be much
> simpler). The trouble I'm having is really just getting it all lined up
> in cake, and the lack of docs on the subject isn't helping. I'm happy
> to write something for the bakery once it's sorted!
>
> Marcus
>

So then my explanation should make sense then:

1) create  your controller
2) create an action that will be the XMLRPC "server"
3) if you're sending an XML payload, then read the payload in
4) extract the XML
5) process the data
6) create an XML-based response
7) output that XML as the response

I guess you were having problems with steps 1 and 2 maybe?

Hope this helps (and that I haven't over-simplified the process)

--
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Synchro-2



On Nov 6, 9:36 pm, "Chris Hartjes" <[hidden email]> wrote:
> 1) create  your controller
> 2) create an action that will be the XMLRPC "server"
> 3) if you're sending an XML payload, then read the payload in
> 4) extract the XML
> 5) process the data
> 6) create an XML-based response
> 7) output that XML as the response
>
> I guess you were having problems with steps 1 and 2 maybe?

Well that's what I was trying in my original post:
http://groups-beta.google.com/group/cake-php/browse_thread/thread/8aa0b0465fbc2b67
Prior to getting any XML processing working, I can skip directly from
step 2 to 7 and just stuff nonsense data in, output some static XML
string. However, I'm getting this 404 for 'xmlrpc.txt', which is not
something that I mention anywhere in my code, when I call the action.

Marcus


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Chris Hartjes

On 11/6/06, Synchro <[hidden email]> wrote:
> Prior to getting any XML processing working, I can skip directly from
> step 2 to 7 and just stuff nonsense data in, output some static XML
> string. However, I'm getting this 404 for 'xmlrpc.txt', which is not
> something that I mention anywhere in my code, when I call the action.
>

Without seeing some code, it's pretty hard to fix it.  Can't imagine
why it's looking for xmlrpc.txt unless you're explicitly asking for
it.  Code sample are always welcome when diagnosing bugs.

I've always found that computers like to do what you tell them, not
what you think you've told them. :)

--
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

cookxyz@gmail.com

Rpc Example:
I have just posted an Rpc plugin on http://blog.itbytez.com/

The actual plugin code is very simple and quite brief.
You can use it as a plugin, or take the code and do your own thing

I am new to cake and new to Rpc, so beware...


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Synchro-2
In reply to this post by Chris Hartjes



On Nov 7, 1:39 am, "Chris Hartjes" <[hidden email]> wrote:
> Without seeing some code, it's pretty hard to fix it.  Can't imagine
> why it's looking for xmlrpc.txt unless you're explicitly asking for
> it.  Code sample are always welcome when diagnosing bugs.

Well I already posted the absolutely minimal (so minimal you probably
missed it!) example that was not working for me. With routing enabled
in core, this code results in a 404 for xmlrpc.txt:

The model is just an empty class. In
app/controllers/things_controller.php:

function xmlrpc_doSomething() {
  echo 'hello';
}

In app/views/things/xmlrpc/do_something.thtml:
blah

but when I hit /xmlrpc/things/do_something I get a 404 looking for
xmlrpc.txt. XML functionality doesn't enter into it if I can't stuff in
something and get something out.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Chris Hartjes

On 11/7/06, Synchro <[hidden email]> wrote:

>
> Well I already posted the absolutely minimal (so minimal you probably
> missed it!) example that was not working for me. With routing enabled
> in core, this code results in a 404 for xmlrpc.txt:
>
> The model is just an empty class. In
> app/controllers/things_controller.php:
>
> function xmlrpc_doSomething() {
>   echo 'hello';
> }

> In app/views/things/xmlrpc/do_something.thtml:
> blah
>
> but when I hit /xmlrpc/things/do_something I get a 404 looking for
> xmlrpc.txt. XML functionality doesn't enter into it if I can't stuff in
> something and get something out.
>

Okay, let's back up and help this cranky developer understand your problem.

First of all, are you using any XMLRPC or XML helpers?  I've never
used them so that could be causing the problem

Secondly, the correct call to the action you specified above should be:

/things/xmlrpc_doSomething

Because you have an action called 'xmlrpc_doSomething' as part of the
'things' controller.  My appologies if I'm misunderstanding things.

According to what you've posted above, if you call
/things/xmlrpc_doSomething in a browser we should see 'blah' outputted
in the browser window.

Other than this, I suggest that if you haven't already done so, set
DEBUG to 1 in order to prevent Cake from caching anything.

Hope that helps, and I'm interested in seeing what the solution to
this problem is.  It can't be this hard. :)

--
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Synchro-2



On Nov 7, 4:10 pm, "Chris Hartjes" <[hidden email]> wrote:
> First of all, are you using any XMLRPC or XML helpers?  I've never
> used them so that could be causing the problem

No.

> Secondly, the correct call to the action you specified above should be:
>
> /things/xmlrpc_doSomething
>
> Because you have an action called 'xmlrpc_doSomething' as part of the
> 'things' controller.  My appologies if I'm misunderstanding things.

Well, this is exactly the kind of confusion I'm having. I've been
following what it says in the configuration docs (the only mention I've
found of the built-in web services stuff). As far as I can see, if you
have WS enabled in core, then if you call /xmlrpc/things/doSomething it
will call xmlrpc_doSomething in the Thing controller, much as admin/x/y
will (apparently) call admin_y in controller x if the admin routing is
enabled. I was also under the impression that /doSomething may be
mapped to do_something() according to context, but from other posts in
here, that's wrong.

> According to what you've posted above, if you call
> /things/xmlrpc_doSomething in a browser we should see 'blah' outputted
> in the browser window.

Well, apart from the naming issues I just mentioned, yes. I just want
to make sure that the routing is right before trying to deal with the
XML side of things.

> Other than this, I suggest that if you haven't already done so, set
> DEBUG to 1 in order to prevent Cake from caching anything.

[hidden email] mentions in the notes for his RPC plugin linked above
that you should make sure debug is off as otherwise it can add
additional data that will trash the XML.

> It can't be this hard. :)

Well, quite! A web services page in the manual would go a long way.

Marcus


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Synchro-2
In reply to this post by cookxyz@gmail.com

That looks great, how it should be!

One thing I'm not clear on from an architectural point of view is to
use that it looks like my controllers have to inherit from the
Rpc5AppController and model, which implies to me that those controllers
become dedicated to rpc calls. I can't see how to prevent conflict
between web and rpc calls. In your example, you have a function called
'hello', but no way to distinguish it from a function with the same
name that would be called in a web interface. I think this is what the
routing features are about (I've not quite got my head around them
yet), so that a single controller can deal with both separate web and
xmlrpc functions with the same external name (e.g. /things/function and
/xmlrpc/things/function would call function() and xmlrpc_function()
respectively. Or is there some way of having two controllers for a
given model - one for web, one for rpc? I think I need to re-read the
routing manual...


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Web services, xmlrpc, help!

Synchro-2
In reply to this post by Synchro-2

On Nov 8, 6:00 pm, "Synchro" <[hidden email]> wrote:
> A web services page in the manual would go a long way.

A bit more careful reading of the config manual page revealed a couple
of errors in what I was thinking. Though admin actions like
/admin/thing/function get mapped to admin_function(), the same does NOT
apply to the web services. /xmlrpc/thing/function will still call
function(), but it will get given a different view from
views/thing/xml/function.thtml instead of views/thing/function.thtml.
That's OK, but I guess that means that you will always need to generate
and pass XML into your web view even though it will never be used - or
how can you find out how the function was called?

There is an underlying assumption that all the incoming XML is handled
automatically, which is great, but I'd like to find some documentation
on it.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---