------art_286020_14916015.1177965115743
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 4/30/07, dt <daytues / yahoo.com> wrote:
>
> Hi,
>
>
> - How should I be able to make a service in Rails that uses HTTP GET
> instead of SOAP or XML methods? I would like both input and output to
> be configured not to adhere to SOAP protocol or to use XML. I could
> use query_parameters, however that would be ugly - native SOAP or
> plain XML calls to Web services are directly translating the
> parameters to the parameters in the method declaration.
>
> - While we are here, how/where are the parameters from SOAP or plain
> XML request translated into the method parameters? Any good text about
> this? This might give me some idea on how to approach this. For
> example, how could one make a protocol, logically similar to SOAP, and
> implement a Web service whose methods would get the parameters from
> the request in the same fashion they do it with SOAP.


Are you talking about just using URL-encoded query strings instead of
formats that are more elaborate but possibly more portable? If so, why?


- How can I use JSON with a Rails Web service? I would like to make
> some Ajax calls, however I wouldn't like to parse XML since JSON is
> much more natural JavaScript thing then parsing XML. I tried using
> render :json, but no success until now. JSON is much easier to work
> with in JavaScript then XML, so this seems like a nice feature if it's
> possible.


In the apps I've been writing lately, I've been making the server-side
generate nothing but very generalized XML. To convert it to JSON, procedural
JS code, XUL, XHTML, or even other XML representations, I've been using XSLT
*on the client.* Seems ugly but it turns out not to be as bad as it sounds.
And it certainly beats the alternative, which is to build server logic with
a particular presentation model in mind. And it also fits the canonical goal
of doing the work closest to where it will be used.

- Is there some non-trivial example of Rails Web services used
> dynamically (Ajax), especially not directly from a HTML page, but from
> e.g. XUL or Flex application? This is important because, as far as I
> understand, Rails is not made to directly support building such
> applications.


Again, speaking of my recent work, I've avoided Rails on the backend because
my HTTP servers now look a lot like generic service providers, rather than
"controllers" and "views" that integrate data with presentation logic. (They
also need very high performance, they must interface through messaging with
other backend service providers, and they can't block while processing any
given request, so Rails is a poor fit anyway.)

I assume this is interesting to other people, too. If not, let me know
> if this is the right approach - maybe there are much easier/better
> ways. The problem that needs to be solved is making a simple client-
> side application which uses Rails Web services to fetch the data (and
> other things - e.g. authentication). I am not constrained to anything
> on the client, but I suppose I will be doing it in XUL or similar
> (Flex maybe). I would use JavaScript for remotely calling (Ajax) the
> necessary Web services. They would return data only and as much
> processing as possible should be done on the client side (it's not
> much of a processing anyway).



Having gotten into XUL rather heavily lately, I have to say it's a very fine
approach but nets out as a near miss. The Gecko platform isn't quite stable
enough for prime time, and the tooling is very immature. For something
that's been around for quite a few years now, I expected more. I have a
colleague that's totally sold on Flex, though, and I'm planning to learn it
next, especially now that Adobe is planning to open-source more of it.

------art_286020_14916015.1177965115743--