我正在使用带有 rails 2.3.11、savon 1.1.0、芥末 2.5.0、httpi 1.1.1 和 httpclient 2.2.7 的 ruby 1.8.7
每当我运行我的脚本时:
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'savon'
client = Savon::Client.new do |wdsl, http|
wdsl.document = 'https://www.atmosfair.de:8443/service/AtmosfairEmissionService3?wsdl'
http.auth.ssl.verify_mode = :none
http.auth.basic "user", "password"
end
client.request :wdsl, "getFlightEmission" do
soap.body = {
:departure => "VIE",
:arrival => "DUB"
}
end
我明白了:
HTTPI 使用 httpclient 适配器执行 HTTP GET /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient/session.rb:300:in `connect': SSL_connect 返回=1 errno=0 state=SSLv2/v3 读取服务器问候 A:sslv3 警报意外消息 (OpenSSL::SSL::SSLError)
来自 /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient/session.rb:300:in
ssl_connect' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient/session.rb:757:in
connect' 来自 /usr/local/rvm/gems/ruby -1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient/timeout.rb:131:intimeout' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient/session.rb:748:in
connect' 来自 /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient- 2.2.7/lib/httpclient/session.rb:606:inquery' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient/session.rb:161:in
query' 来自 /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient.rb:1070 :indo_get_block' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient.rb:873:in
do_request' 来自 /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient.rb:966:inprotect_keep_alive_disconnected' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient.rb:872:in
do_request' 来自 /usr/local/rvm/gems /ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient.rb:760:inrequest' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpclient-2.2.7/lib/httpclient.rb:663:in
get' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpi- 1.1.1/lib/httpi/adapter/httpclient.rb:24:inget' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpi-1.1.1/lib/httpi/adapter/httpclient.rb:64:in
do_request' 来自 /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpi-1.1.1/lib/httpi/adapter/httpclient.rb:23:inget' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpi-1.1.1/lib/httpi.rb:86:in
get' 来自 /usr/local/rvm /gems/ruby-1.8.7-p370/gems/httpi-1.1.1/lib/httpi.rb:193:inwith_adapter' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/httpi-1.1.1/lib/httpi.rb:84:in
get' 从 /usr/local/rvm/gems/ruby-1.8.7-p370/gems/ savon-1.1.0/lib/savon/wasabi/document.rb:34:inresolve_document' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/savon-1.1.0/lib/savon/wasabi/document.rb:15:in
xml' 来自 /usr/local/rvm/gems/ruby-1.8.7-p370/gems/wasabi-2.5.0/lib/wasabi /document.rb:131:inparse' from /usr/local/rvm/gems/ruby-1.8.7-p370/gems/wasabi-2.5.0/lib/wasabi/document.rb:118:in
parser' 来自 /usr/local/rvm/gems/ruby-1.8.7-p370/gems/wasabi-2.5.0/lib/wasabi/document.rb:61:in `soap_actions'来自脚本/atmosfair.rb:28
而 SoapUI 给了我:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns1:FlightEmission xsi:type="ns1:FlightEmissionData" xmlns:ns1="http://www.atmosfair.de/2009/07/travel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CO2>0.19</CO2>
<offset>5.0</offset>
<distance>1733</distance>
<CO2PerPkm>0.0</CO2PerPkm>
<CO2InCriticalAltitudes>0.13</CO2InCriticalAltitudes>
<CO2RFI2>0.32</CO2RFI2>
<CO2RFI27>0.41</CO2RFI27>
<CO2RFI3>0.45</CO2RFI3>
<CO2RFI4>0.59</CO2RFI4>
<keroseneConsumption>0.06</keroseneConsumption>
<keroseneConsumptionInCriticalAltitudes>0.04</keroseneConsumptionInCriticalAltitudes>
<specificFuelConsumptionAverage>4.31</specificFuelConsumptionAverage>
<offsetCO2RFI2>8.0</offsetCO2RFI2>
<offsetCO2RFI27>11.0</offsetCO2RFI27>
<offsetCO2RFI3>11.0</offsetCO2RFI3>
<offsetCO2RFI4>15.0</offsetCO2RFI4>
</ns1:FlightEmission>
</soapenv:Body>
</soapenv:Envelope>
任何想法,我做错了什么?