how to create a web service

前端 未结 2 557
伪装坚强ぢ
伪装坚强ぢ 2020-12-29 00:22

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 buil

相关标签:
2条回答
  • 2020-12-29 00:46

    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.

    0 讨论(0)
  • 2020-12-29 01:00

    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.

    0 讨论(0)
提交回复
热议问题