NameError:未初始化的常量OpenSSL :: SSL :: SSLContext :: METHODS for SAVON gem

时间:2015-03-24 10:04:25

标签: ruby ssl savon

我正在使用RUBY 1.8.6Rails 2.0.2

我安装了Savon gem,当我尝试在我的控制台中运行以下内容时:

client = Savon.client(:wsdl => "http://www.webservicex.net/uszip.asmx?WSDL",
                      :pretty_print_xml => true,
                      :log_level => :debug, 
                      :log => true
                     )

我收到错误消息' uninitalized constant'。

然后我尝试了require 'savon'

NameError: uninitialized constant OpenSSL::SSL::SSLContext::METHODS

1 个答案:

答案 0 :(得分:0)

来自Savon的网站(www.savonrb.com)

Supported Ruby versions

MRI 1.8.7, 1.9.2, 1.9.3 and 2.0
Ruby Enterprise Edition
JRuby (1.8 and 1.9 mode)
Rubinius (1.8 and 1.9 mode)

我猜你的版本不受支持。 以下脚本适用于Windows和Raspbian上的MRI 1.9.3:

#!/usr/bin/env ruby

require 'savon'
require 'awesome_print'

client = Savon.client(wsdl: "http://www.webservicex.net/uszip.asmx?wsdl",
                      pretty_print_xml: true,
                      log_level: :debug,
                      log: true
  )

ap client.operations