【发布时间】:2016-06-18 10:08:45
【问题描述】:
我尝试将 xml 文件发送到 Web 服务,但它不起作用。 Web 服务供应商不知道。
如果您阅读错误消息,似乎使用了错误的soap版本,但供应商使用相同的xml文件进行了尝试,他对此文件没有任何问题。我不知道出了什么问题。
代码:
#Declaration
host = "bar.foo.nl";
path = "/services/setu.asmx";
port = 443;
username = "xxx"
password = "yyy";
ssl = true;
#Create connection
req = Net::HTTP::Post.new(path)
req.basic_auth(username, password)
http = Net::HTTP.new(host, port)
http.use_ssl = ssl
#send file
res = http.request(req, 'D:/test.xml')
#show result
puts res.code
puts res.body
编辑:xml 文件:XML FILE
错误(500代码):
可能的 SOAP 版本不匹配:信封命名空间 http://ns.hr-xml.org/2007-04-15 出乎意料。期待 http://schemas.xmlsoap.org/soap/envelope/.
【问题讨论】:
-
你的文件中是否定义了soap命名空间?
-
是的,我上传了xml文件。
标签: ruby-on-rails xml