Advertisement

07.11.2008 at 01:45AM PDT, ID: 23556518 | Points: 50
[x]
Attachment Details

How do i post xml data to https url?

Asked by kaliyugkaarjun in Ruby Scripting Language, CGI Scripting, Extensible Markup Language (XML)

Tags: ,

Hiiiiii,

I am trying to post xml file to https link..
but i get the following error...

undefined method `strip' for []:Array

Please checkout  attached jpg for more details..

My Code contents are like this...

#Here is xml contents in @final_xml var
doc.write(@final_xml,2)

#Post url, to which i would like to post the xml file
post_url = "https://sandbox.doba.com/api/xml_retailer_api.php"

#Headers for xml format
headers["Content-Type"] = "application/atom+xml"

#Post function to pass the url, xml and headers
@post_response = post(post_url,@final_xml,headers)

#Here is the above post function
def post(uri, data, headers)
  uri = URI.parse(uri)
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true
  return http.post(uri.path, data, headers)
end

I would greatly appreciate it if someone can shine a light on this subject..
I am new to ruby on rails...

Thanks
Start Free Trial
Attachments:
 
Error snapshot
Error snapshot
 
[+][-]07.11.2008 at 02:08PM PDT, ID: 21986070

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.14.2008 at 04:01AM PDT, ID: 21996986

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628