我正在尝试使用一个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>'
最佳答案
Savon对http请求使用HTTPI。您应该能够提供如下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")