与Savon进行HTTPS通话

时间:2012-08-16 19:22:59

标签: ruby soap savon

我正在尝试使用SOAP服务,该服务坚持使用HTTPS将凭据传递给他们的:login。

使用Savon,我没有看到如何设置HTTPS,因此它失败了。有人可以指出如何使用Savon通过HTTPS进行呼叫。

/Users/fizz/.rvm/gems/ruby-1.9.3-p194/gems/savon-1.1.0/lib/savon/soap/response.rb:107:in           `raise_errors': (soap:Server) Server was unable to process request. ---> Credentials can only be passed over secure connections (HTTPS) (Savon::SOAP::Fault)
from /Users/fizz/.rvm/gems/ruby-1.9.3-p194/gems/savon-1.1.0/lib/savon/soap/response.rb:18:in `initialize'
from /Users/fizz/.rvm/gems/ruby-1.9.3-p194/gems/savon-1.1.0/lib/savon/soap/request.rb:35:in `new'
from /Users/fizz/.rvm/gems/ruby-1.9.3-p194/gems/savon-1.1.0/lib/savon/soap/request.rb:35:in `response'
from /Users/fizz/.rvm/gems/ruby-1.9.3-p194/gems/savon-1.1.0/lib/savon/client.rb:84:in `request'
from ./soap.rb:14:in `<main>'

1 个答案:

答案 0 :(得分:1)

Savon使用HTTPI进行HTTP请求。您应该能够提供如下的HTTP凭据:

client = Savon.client("http://v1.example.com?wsdl")

# HTTP basic auth
client.http.auth.basic("username", "password")

# HTTP digest auth
client.http.auth.digest("username", "password")