Multiple return values in action web service

Hi all,

Does anyone have any advice about returning multiple values from an
ActionWebService? That is, I’d like to implement something like the
following.

api_method :do_something,
:expects => [{:id => :string}],
:returns => [{:return_code => :int},
{:return_text => :string}]

The easy way to do it would be to wrap everything in a struct:

class ReturnStatus < ActionWebService::Struct
member :return_code, :int
member :return_text, :string
end

api_method :do_something,
:expects => [{:id => :string}],
:returns => [ReturnStatus]

Then I could implement do_something as follows:

def do_something
ReturnStatus.new(:return_code => 0,
:return_text => “Success”)
end

But, unfortunately, I’m trying to re-create an existing web service and
don’t have this option. The problem with a struct is that it translates
into another layer in the XML, and the existing clients won’t know how
to
parse it. Here’s an example of the return code (minus namespaces) if I
use
a struct.

<?xml version="1.0" encoding="UTF-8" ?> Success 0

But that object is getting in the way. What I’d like is:

<?xml version="1.0" encoding="UTF-8" ?> Success 0

I’ve looked a bit at the soap4r files, because if ActionWebService
doesn’t
work, I may have to switch to using that. But even there, I’m having
trouble understanding if I’ll be able to define a mapping that will keep
this extra layer from being created.

Thanks in advance for your input.

Jacob Maine