Get response from soap using curb in ruby

I start working on ruby very recently. i written a small code for SOAP
client request and response using curb gem. But i am getting some error
in response XML.

Code:

require ‘curb’

c = Curl::Easy.new('http://api.abc.com/service.asmx?wsdl&apikey=’+key)
c.multipart_form_post = true
c.http_post(Curl::PostField.content(‘SOAPAction’,
http://api.abc.com/GetServices’))
c.http_post(Curl::PostField.content(‘Content-Type’,
‘application/soap+xml; charset=utf-8’))
c.http_post(Curl::PostField.content(‘Content-Length’, ‘200’))
c.http_post(Curl::PostField.file(‘xml’, ‘/path/data.xml’))
puts c.body_str

Error:

<soap:Text xml:lang=“en”>Server was unable to process request. —>
Data at the root level is invalid. Line 1, position 1.</soap:Text>

Thanks in advance

shivakumar paramesh wrote in post #1013667:

Error:

<soap:Text xml:lang=“en”>Server was unable to process request. —>
Data at the root level is invalid. Line 1, position 1.</soap:Text>

Translation: “The SOAP data you sent was invalid”.

But you didn’t show us the SOAP data you sent (contents of
/path/data.xml)

Perhaps you should make it work using the curl command line tool first,
then translate what you’ve done to ruby.