how to create a web service

16,031

Solution 1

Have you Googled how to build web services in Ruby? Here are a few links that come up, all addressing exactly what you want to do:

http://www.tutorialspoint.com/ruby/ruby_web_services.htm

http://www.ibm.com/developerworks/opensource/library/os-ws-rubyrails/index.html

http://searchsoa.techtarget.com/tip/Web-services-with-Ruby-on-Rails

How about you take a look at some of those links, and come back to us if you have further questions.

I do have one elaboration:

My partner builds the flash application and he told me that the flash application interacts through WSDL file.

It sounds like your partner has an incomplete understanding of how Flash can access remote data services. Using a SOAP Web Service with a WSDL is one method, for sure, and here is some documentation on that.

A Flex / Flash application can also make standard HTTP calls, sometimes called REST Web Services. In many cases, REST Web Services will return an XML Document, but that is not required. Any data, including simple text data, can be returned from a REST Web Service.

What many people prefer to do is to use an AMF Gateway with RemoteObject. AMF is a binary format so you'll get much smaller file size transferred back and forth than the alternatives. It also provides for automatic object translation between your server side objects and client side objects. This can be a time saver in development because you don't have to parse data to turn it into something Flex can use easily. RubyAMF is one Ruby implementation of AMF.

Solution 2

You'll be going through more pain than you need to by using WSDL.

Instead, I recommend creating a REST interface that returns json (or xml) -- you'll find in rails it will just work.

So you'll have things like:

/books # returns a list of books. Also do Searching here
/books/1 # return the detail of a book with ID of 1

Search for "REST Rails" and you'll get examples of controllers that will return JSON and XML depending on what the client requests.

Share:
16,031
Oded Harth
Author by

Oded Harth

Updated on June 09, 2022

Comments

  • Oded Harth
    Oded Harth about 2 years

    I building a website with Ruby on Rails framework. The site will contain a flash application that will interact with the rails application using web service. My partner builds the flash application and he told me that the flash application interacts through WSDL file.

    I am new to web services. I would like to know how to create the WSDL file, and how to make the interaction between the rails application and the WSDL file.

    If you believe that there are better alternatives than SOAP/WDSL, I would like to hear them too.

    Thanks,

    Oded