I'm trying to send the xml to another webserver through Restclient's http POST request.This is the code :
response = RestClient.post 'https://secure.rowebooks.co.uk/testorders/orders.aspx', :content_type => "text/xml", :myfile => File.read("#{Rails.root}/public/shared/#{@book}.xml")
But I'm getting this error
ERROR 2 Data at the root level is invalid. Line 1, position 1.ERROR3 Object reference not set to an instance of an object.
I've been told that I am receiving that error because the XML file is not in the content of the call. It must be in the content. I have no idea what does this mean.
Any suggestion / clue will be greatly appreciated.
Thanks
You should be doing it like this:
response = RestClient.post( 'https://secure.rowebooks.co.uk/testorders/orders.aspx',
File.read("#{Rails.root}/public/shared/#{@book}.xml"), 'Content-Type' => 'text/xml' )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With