How to create a web service with rails?

I have a silverlight app that needs to talk to a rails app to add an entry. I was able to get the Silverlight application to successfully complete the POST, considering that everything was going well. Now, however, I need to make it more reliable and make the rails application return error / success messages to the silverlight application in a format that it can read (maybe xml?). I can change the rails app and the Silverlight app as needed.

What is the best way to do this with rails?

+3
source share
2 answers

Rails handles most of this finished product.

reply_to

@list XML:

@list = Model.find(:all)
respond_to do |format|           
  format.html { render :action => "index" }
  format.xml  { render :xml => @list }
end             

http ( , ):

format.xml  { head :ok }

, Active Record :

format.xml  { render :xml => @model.errors, :status => :unprocessable_entity }
+6

, Rails.

, xml ( json, - , Silverlight ) . ( , HTML.)

+1

Source: https://habr.com/ru/post/1740704/


All Articles