From: Doug Livesey on
Hi -- it's possible that I'm getting all of this *entirely* wrong, so I
thought I'd post what I'm trying to do here & see what comes back.
Basically, I have a RoR web service that has bulk_create and bulk_update
methods in one of its controllers.
These take ActiveResource-style JSON hashes of potentially many objects
to create or update.
The service is JSON, so what I've been doing is using HTTParty to send
the post and put requests to the service url with the objects data to be
created or updated in the query string.
Naturally, I quickly ran into issues with the amount of data that I
could send that way, so I added compression with Zlib to the service,
and to the client calling it.
The client code, for example, looks a little like this:

My::Service( :put, "/objects/bulk_create.json", query: { objects_doc:
Zlib::Deflate.deflate( objects.to_json ) } )

This fixed the issue.
However, I'm now updating the service to run on Ruby 1.9.3, and am
running into encoding issues (apparently the bane of many a Ruby coder's
life at the moment, although I'm only upgrading from 1.9.1).
The error I'm actually getting is this: "invalid byte sequence in UTF-8
(ArgumentError)"
So I guess I have two questions:
1) How can I fix this so that it works again?
2) *Should* I fix it, or is there another way that I should be sending
data to my web service?
Cheers,
Doug.
--
Posted via http://www.ruby-forum.com/.