开发者

get response from soap using curb in ruby

开发者 https://www.devze.com 2023-03-23 22:11 出处:网络
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.

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('rovi', '/path/data.xml'))
puts c.body_str

Error:

<soap:Text xml:lang="en">Server was unable to process request. ---&gt; Data at the root level is invalid. Line 1, position 1.</soap:Text>

Thanks in advance


You should try http://savonrb.com/ - as far the best ruby library for soap.

0

精彩评论

暂无评论...
验证码 换一张
取 消