Ryan Smith
2007-Mar-28 23:06 UTC
using ruby to submit an http form - either im confused ...
Hi All: I have a rails application (we''ll call it ''FrontApp'')that is using REST routes. I have tested this with curl and its behaves as expected. I also have a second independent rails application on the same server. Also using REST routes. (we''ll call this app ''BackApp''). I want to beable to call and submit a form in BackApp from FrontApp and I think im going about it the wrong way. Should I be using web service apis on BackApp and simply invoking the service calls from FrontApp or can i (and it is good design) to try and post the form in BackApp from FrontApp? Below is a snippet of a test script ive been using to attempt to post the above mentioned form in BackApp using ruby. All i get back is the details of the form but the event (an email sent) is not occurring as if i were submitting the form in the BackApp application. Net::HTTP.new(''backapp.mydomain.com'', 80).start do |http| test_email_req = Net::HTTP::Post.new(''/notification/email_request'') test_email_lic_req.set_form_data(''email_request[email_request]''=>''me-WB98PguNJMdBDgjK7y7TUQ@public.gmane.org'') test_email_req.add_field ''Accept'', ''application/xml'' response = http.request(test_email_req) case response when Net::HTTPSuccess puts "Code: #{response.code}" puts "Message: #{response.message}" puts "Body:\n #{response.body}" else # Throw exception response.error! end end any help would be appreciated Thanks Ryan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---