Hi All,
I need to post some xml to a webservice and I'm trying to use HTTParty. Can someone provide an example as to how I go about doing so?
Here is the format of the XML I need to post:
<Candidate xmlns="com.mysite/2010/10/10" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<FirstName></FirstName>
<LastName></LastName>
<Email></Email>
<Gender></Gender>
</Candidate>
Here is my class so far:
require 'httparty'
class Webservice
include HTTParty
format :xml
base_uri 'mysite.com'
default_params :authorization => 'xxxxxxx'
def self.add_candidate(first_name,last_name,email,gender)
post('/test.xml', :body => "")
end
end
I'm not quite sure how to flesh out add_candidate.
Any help would be appreciated.
Thanks.