我正在尝试在 Ruby 中构建一个 Web 服务客户端。
当我尝试调用以下soap4r ruby 脚本来生成Web 服务客户端代码时:
wsdl2ruby.rb --wsdl *[web_service_url]* --type client
我收到以下错误:
忽略 attr:{http://www.w3.org/2006/05/addressing/wsdl}Action I,[2011-06-09T17:16:01.012268 #10104] 信息——应用程序:创建类定义。我,[2011-06-09T17:16:01.012268 #10104] 信息——应用程序:创建文件“SessionServic e.rb”。F,[2011-06-09T17:16:01.014268 #10104] 致命 -- 应用程序:检测到异常。停止 ping ... 未定义方法
collect' for #<String:0x32260c8> (NoMethodError) C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb:2 39:in
trim_eol' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb:2 27:informat' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/codegen/commentdef.rb:2 7:in
dump_comment' C: /Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/codegen/classdef.rb:51: 在dump' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.r b:118:in
块中 dump_complextype' C:/Ruby192/lib/ruby/gems/1.9 .1/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.r b:116:incollect' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.r b:116:in
dump_complextype' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib /wsdl/soap/classDefCreator.r b:60:dump' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:77:i n
块在 create_classdef' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:171: 在block in write_file' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:170: in
打开' C:/Ruby192/lib/ruby /gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:170: 在write_file' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:76:i n
create_classdef' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5 .8/lib/wsdl/soap/wsdl2ruby.rb:62:create_file' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:42:i n
in run' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/bin/wsdl2ruby.rb:46:inrun' C:/Ruby192/lib/ruby/1.9.1/logger.rb:691:in
开始' C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/bin/wsdl2ruby.rb:137:in<top ( required)>' C:/Ruby192/bin/wsdl2ruby.rb:19:in
加载' C:/Ruby192/bin/wsdl2ruby.rb:19:in `' 我,[2011-06-09T17:16:01.016268 #10104] 信息——应用程序:应用程序结束。(状态:-1)
何时,我尝试调用以下代码来动态生成 Web 服务客户端:
require 'soap/wsdlDriver'
WSDL_URL = "http://*[web_service_url]*"
factory = SOAP::WSDLDriverFactory.new(WSDL_URL)
driver = factory.create_rpc_driver
我收到以下错误:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:in
initialize': The requested service provider could not be loaded or initialized. - socket(2) (http://*web_service_url*) (Errno::E10106) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:in
new' 来自 C:/Ruby192/lib/ruby/gems/1.9。 1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:increate_socket' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:705:in
block in connect' 来自 C:/Ruby192/lib/ruby/1.9.1/timeout.rb:57:intimeout' from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:87:in
timeout' 来自 C :/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:704:inconnect' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:568:in
query' 来自 C:/Ruby192/lib/ruby/gems/1.9.1 /gems/httpclient-2.2.1/lib/httpclient/session.rb:158:inquery' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:1057:in
do_get_block' 来自 C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient。 rb:866:inblock in do_request' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:953:in
protect_keep_alive_disconnected' 来自 C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:865:indo_request' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:938:in
follow_redirect 来自 C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:577:inget_content' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:73:in
fetch' 来自 C:/Ruby192/lib/ruby/gems/1.9 .1/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:36:inimport' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/importer.rb:18:in
import' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/ lib/soap/wsdlDriver.rb:146:inimport' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb:32:in
从 C:/DevProjects/application-development-environment/UwsSampleRuby/blah.rb:6:in 初始化new' from C:/DevProjects/application-development-environment/UwsSampleRuby/blah.rb:6:in
'
当我尝试调用上面相同的代码,但使用不同的 URL(生产 URL 而不是测试环境 URL)时,我得到一个不同的错误:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:in initialize': getaddrinfo: A non-recoverable error occurred during a database lookup. (https://[prod_url]:443) (SocketError)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:in
new' 来自 C:/Ruby192/lib/ruby/gems/1.9。 1/gems/httpclient-2.2.1/lib/httpclient/session.rb:748:in create_socket'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:705:in
block in connect' 来自 C:/Ruby192/lib/ruby/1.9.1/timeout.rb:57:in timeout'
from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:87:in
timeout' 来自 C :/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:704:in connect'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient/session.rb:568:in
query' 来自 C:/Ruby192/lib/ruby/gems/1.9.1 /gems/httpclient-2.2.1/lib/httpclient/session.rb:158:in query'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:1057:in
do_get_block' 来自 C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient。 rb:866:in block in do_request'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:953:in
protect_keep_alive_disconnected' 来自 C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:865:indo_request'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:938:in
follow_redirect 来自 C:/Ruby192/lib/ruby/gems/1.9.1/gems/httpclient-2.2.1/lib/httpclient.rb:577:in get_content'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:73:in
fetch' 来自 C:/Ruby192/lib/ruby/gems/1.9 .1/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:36:in import'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/importer.rb:18:in
import' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/ lib/soap/wsdlDriver.rb:146:inimport'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb:32:in
从 C:/DevProjects/application-development-environment/UwsSampleRuby/blah.rb:6:in 初始化new'
from C:/DevProjects/application-development-environment/UwsSampleRuby/blah.rb:6:in
'
为什么我会收到这些错误,我该如何解决它们?我知道 Web 服务已经启动并正常工作,因为我能够在 C# .Net 中构建 Web 服务客户端就好了。