Implementing a web service in rails

Hi all,

I need to implement a web service in rails with the following signature:

string ReceiveEvents (string A, string B, string C).

As you can see, it is basically a method that takes in three strings and
returns a string. I'm 99% sure the call is made via SOAP.

I've spent all day searching around (SOAP4R, AWS, . . .) but have not
been able to find any compelling help.

Any advice is appreciated. Thanks!

Help and advice for what? I can't find a question in there.


Ryan Leary wrote:

To clear things up:

I do not know where to get started making this SOAP web service in Rails.
I'm looking for some preliminary advice or a tutorial on creating a soap
webservice in rails. I know I should be moving to REST, but a platform
our system must interact with uses SOAP and I absolutely must support
this call.

I'm a little confused; Are you wanting to provide the web service or
consume an existing web service.

If it's the former then I would recommend forgetting about SOAP and
implement a REST web service for your client. Basically just build a
Rails application the normal Rails 2.x way by providing the proper
response formats for exposing actions as web services.

If it's the later, and the service you're trying to consume is a SOAP
service, then you stuck and have to use SOAP.

I'm guessing what your showing there is likely an existing web service,
probably written in Java, since most Java people haven't yet figured out
that REST is the future of web services.

If my assumption is correct then take a look here:

I have not used this, but this question keeps getting posted
over-and-over and this is the canned answer to the "I need SOAP web
services" question. However, if you ever get deep into SOAP you'll
quickly begin to realize why it is so far off the radar of typical Rails

Also, just so you know, I'm forced to deal with SOAP on an almost daily
basis (in Java) so I'm not speaking from inexperience.

P.S. Since the the original acronym for SOAP complete fell apart over
the years, I propose we redefine SOAP (Simple Object Access Protocol) as
(Supremely Over-engineered Abstraction Protocol).

Ryan Leary wrote:

Thanks Robert,

I'll look into your tips tomorrow and let you know how it goes.

I actually need to provide the web service. I would like to use REST,
but my web service must fit the signature above. The client that wants
to consume this web service uses SOAP. I've had no problem consuming
SOAP webservices...but need to figure out how to provide one with that
signature (or if there is a way in REST to match that signature).

String receiveEvents (String a, String b, String c); // Assuming Java
style syntax


Response would then contain PO-XML something like:
<?xml version="1.0" encoding="UTF-8" ?>
    <attribute-1 />
    <attribute-2 />
    <attribute-3 />
    <attribute-4 />
    <attribute-1 />
    <attribute-2 />
    <attribute-3 />
    <attribute-4 />
    <attribute-1 />
    <attribute-2 />
    <attribute-3 />
    <attribute-4 />

Or in case of error you get back an HTTP error response.

Basically it just HTTP like any other web resource. Also the .xml is not
required if the ACCEPTS header is set properly in the HTTP request. But,
you can read up on REST how how it works on you own. It can't easily be
fully explained in the context of a forum.

However, I'm pretty sure that's not what your consumer is going to want
to hear. They likely won't understand that REST actually does work.