Re: [Rails] Re: Call Rest webservice in Ruby on Rails

2011-03-04 Thread Marc Byrd
Allow me to second the recommendation to read up on ActiveResource - this is exactly what it's designed for, and in fact if you're also developing the ReST API, you can use ActiveResource to impose convention (over configuration) in your API - plus you'll have a nice test rig when you're done. Onl

[Rails] Re: Call Rest webservice in Ruby on Rails

2011-03-04 Thread exequiel
Hi, I never tried this, but it should be something like this: required_parameters = ["param1=value1", "param2=value2"] ... self.response_body = proc do |response, output| net_http.start do |http| http.get(uri.path + '?' + required_parameters.join('&')) case res ... Maybe,

[Rails] Re: Call Rest webservice in Ruby on Rails

2011-03-02 Thread gs84
On 1 mar, 19:32, exequiel wrote: > Hi, > > To send data from an action I do this: > > def send_mydata >   ... >   uri = URI.parse(link) >   net_http = Net::HTTP.new(uri.host, uri.port) >   net_http.open_timeout = timeout >   net_http.read_timeout = timeout >   net_http.use_ssl = (uri.scheme == '

[Rails] Re: Call Rest webservice in Ruby on Rails

2011-03-01 Thread exequiel
Hi, To send data from an action I do this: def send_mydata ... uri = URI.parse(link) net_http = Net::HTTP.new(uri.host, uri.port) net_http.open_timeout = timeout net_http.read_timeout = timeout net_http.use_ssl = (uri.scheme == 'https')# enable SSL/TLS if net_http.use_ssl? net_h

[Rails] Re: Call Rest webservice in Ruby on Rails

2011-03-01 Thread gs84
On 28 fév, 21:30, Bill Walton wrote: > I use the Ruby Net::HTTP library to construct requests. > > Best regards, > Bill > Thanks to all for your answer. Bill, can you show me please how you you use the NET::HTTP library to call web service. Because i have used the NET::HTTP libray like the fol

[Rails] Re: Call Rest webservice in Ruby on Rails

2011-02-28 Thread elitwin
On Feb 28, 8:03 am, gs84 wrote: > I use rest web service in my rails application for user's > authentication (user creation, login, ...) > Can someone explain me, how can i call a REST Web service  (not > developped in Rails, and deployed by Tomcat) in my rails application > via POST method. You

[Rails] Re: Call Rest webservice in Ruby on Rails

2011-02-28 Thread shireesh
Define a class like this in your models folder class MyUserWS < ActiveResource::Base self.site = "http://localhost/";# point this to the location of your web service self.format = :json # default format is xml. include this line if you want json self.element_name =