尝试使用soap4r使用soap服务时出现Xml处理器模块未找到错误
我正在尝试通过soap4r gem 使用soap web 服务。我正在使用
ryby 1.8.7
rails 2.3.4
soap4r 1.5.8
rhodes 3.2.3
IRB 中尝试了以下操作。
require "rubygems"
require "soap/wsdlDriver"
wsdl = "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl"
driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
driver.wiredump_dev = STDOUT
params = {
"Celsius" => 32
}
driver.CelsiusToFahrenheit(params)
我得到了回应。 我在罗德岛也尝试过同样的事情。
- 我在 rhodes 应用程序中添加了扩展文件夹。
我复制了里面的soap、wsdl、xsd和tags文件夹
\Ruby187\lib\ruby\gems\1.8\gems\soap4r-1.5.8\lib
在我的系统中。我在我的build.yml 文件中添加了soap 作为扩展名
我需要以下内容
需要“soap/soap” 需要“soap/wsdlDriver”
我得到以下内容。
I 01/25/2012 11:07:08:059 000015ac RhoRuby| require_compiled: Product/product_controller
I 01/25/2012 11:07:08:060 000015ac RhoRuby| require_compiled: soap/soap
I 01/25/2012 11:07:08:062 000015ac RhoRuby| require_compiled: xsd/qname
I 01/25/2012 11:07:08:063 000015ac RhoRuby| require_compiled: xsd/charset
I 01/25/2012 11:07:08:065 000015ac RhoRuby| require_compiled: xsd/iconvcharset
E 01/25/2012 11:07:08:066 000015ac RhoRuby| require_compiled: error: can not find iconv
E 01/25/2012 11:07:08:067 000015ac RhoRuby| require_compiled: error: can not find nkf
E 01/25/2012 11:07:08:067 000015ac RhoRuby| require_compiled: error: can not find uconv
I 01/25/2012 11:07:08:067 000015ac RhoRuby| require_compiled: soap/nestedexception
I 01/25/2012 11:07:08:069 000015ac RhoRuby| require_compiled: soap/wsdlDriver
I 01/25/2012 11:07:08:074 000015ac RhoRuby| require_compiled: wsdl/parser
I 01/25/2012 11:07:08:076 000015ac RhoRuby| require_compiled: xsd/datatypes
I 01/25/2012 11:07:08:085 000015ac RhoRuby| require_compiled: date
I 01/25/2012 11:07:08:086 000015ac RhoRuby| require_compiled: dateOrig
I 01/25/2012 11:07:08:100 000015ac RhoRuby| require_compiled: date/format
I 01/25/2012 11:07:08:112 000015ac RhoRuby| require_compiled: xsd/xmlparser
I 01/25/2012 11:07:08:114 000015ac RhoRuby| require_compiled: xsd/xmlparser/parser
I 01/25/2012 11:07:08:115 000015ac RhoRuby| require_compiled: xsd/ns
I 01/25/2012 11:07:08:117 000015ac RhoRuby| require_compiled: xsd/xmlparser/xmlparser
E 01/25/2012 11:07:08:118 000015ac RhoRuby| require_compiled: error: can not find xml/parser
I 01/25/2012 11:07:08:118 000015ac RhoRuby| require_compiled: xsd/xmlparser/xmlscanner
E 01/25/2012 11:07:08:120 000015ac RhoRuby| require_compiled: error: can not find xmlscan/scanner
I 01/25/2012 11:07:08:120 000015ac RhoRuby| require_compiled: xsd/xmlparser/rexmlparser
E 01/25/2012 11:07:08:121 000015ac RhoRuby| require_compiled: error: can not find rexml/streamlistener
I 01/25/2012 11:07:08:121 000015ac APP| App error: XML processor module not found.
C:/Spritle/Projects/mobile_projects/netHTTPtrial/extensions/soap/xsd/xmlparser.rb:74:in `<top (required)>'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/extensions/soap/wsdl/parser.rb:12:in `require'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/extensions/soap/wsdl/parser.rb:12:in `<top (required)>'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/extensions/soap/soap/wsdlDriver.rb:9:in `require'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/extensions/soap/soap/wsdlDriver.rb:9:in `<top (required)>'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/app/Product/product_controller.rb:3:in `require'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/app/Product/product_controller.rb:3:in `<top (required)>'
调用 xmlParser 后仅抛出错误。我不知道。 如果你认识某人请帮助我。
I am trying to consume soap web service by soap4r gem. I am using
ryby 1.8.7
rails 2.3.4
soap4r 1.5.8
rhodes 3.2.3
I tried the following in IRB.
require "rubygems"
require "soap/wsdlDriver"
wsdl = "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl"
driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
driver.wiredump_dev = STDOUT
params = {
"Celsius" => 32
}
driver.CelsiusToFahrenheit(params)
I got the response.
I tried the same in rhodes.
- I add the extensions folder in rhodes app.
I copied the soap,wsdl,xsd and tags folders inside
\Ruby187\lib\ruby\gems\1.8\gems\soap4r-1.5.8\lib
in my system.I added soap as extension in my build.yml file
I required the following
require 'soap/soap' require 'soap/wsdlDriver'
I am getting the following.
I 01/25/2012 11:07:08:059 000015ac RhoRuby| require_compiled: Product/product_controller
I 01/25/2012 11:07:08:060 000015ac RhoRuby| require_compiled: soap/soap
I 01/25/2012 11:07:08:062 000015ac RhoRuby| require_compiled: xsd/qname
I 01/25/2012 11:07:08:063 000015ac RhoRuby| require_compiled: xsd/charset
I 01/25/2012 11:07:08:065 000015ac RhoRuby| require_compiled: xsd/iconvcharset
E 01/25/2012 11:07:08:066 000015ac RhoRuby| require_compiled: error: can not find iconv
E 01/25/2012 11:07:08:067 000015ac RhoRuby| require_compiled: error: can not find nkf
E 01/25/2012 11:07:08:067 000015ac RhoRuby| require_compiled: error: can not find uconv
I 01/25/2012 11:07:08:067 000015ac RhoRuby| require_compiled: soap/nestedexception
I 01/25/2012 11:07:08:069 000015ac RhoRuby| require_compiled: soap/wsdlDriver
I 01/25/2012 11:07:08:074 000015ac RhoRuby| require_compiled: wsdl/parser
I 01/25/2012 11:07:08:076 000015ac RhoRuby| require_compiled: xsd/datatypes
I 01/25/2012 11:07:08:085 000015ac RhoRuby| require_compiled: date
I 01/25/2012 11:07:08:086 000015ac RhoRuby| require_compiled: dateOrig
I 01/25/2012 11:07:08:100 000015ac RhoRuby| require_compiled: date/format
I 01/25/2012 11:07:08:112 000015ac RhoRuby| require_compiled: xsd/xmlparser
I 01/25/2012 11:07:08:114 000015ac RhoRuby| require_compiled: xsd/xmlparser/parser
I 01/25/2012 11:07:08:115 000015ac RhoRuby| require_compiled: xsd/ns
I 01/25/2012 11:07:08:117 000015ac RhoRuby| require_compiled: xsd/xmlparser/xmlparser
E 01/25/2012 11:07:08:118 000015ac RhoRuby| require_compiled: error: can not find xml/parser
I 01/25/2012 11:07:08:118 000015ac RhoRuby| require_compiled: xsd/xmlparser/xmlscanner
E 01/25/2012 11:07:08:120 000015ac RhoRuby| require_compiled: error: can not find xmlscan/scanner
I 01/25/2012 11:07:08:120 000015ac RhoRuby| require_compiled: xsd/xmlparser/rexmlparser
E 01/25/2012 11:07:08:121 000015ac RhoRuby| require_compiled: error: can not find rexml/streamlistener
I 01/25/2012 11:07:08:121 000015ac APP| App error: XML processor module not found.
C:/Spritle/Projects/mobile_projects/netHTTPtrial/extensions/soap/xsd/xmlparser.rb:74:in `<top (required)>'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/extensions/soap/wsdl/parser.rb:12:in `require'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/extensions/soap/wsdl/parser.rb:12:in `<top (required)>'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/extensions/soap/soap/wsdlDriver.rb:9:in `require'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/extensions/soap/soap/wsdlDriver.rb:9:in `<top (required)>'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/app/Product/product_controller.rb:3:in `require'
C:/Spritle/Projects/mobile_projects/netHTTPtrial/app/Product/product_controller.rb:3:in `<top (required)>'
After calling the xmlParser
only throwing an error. I don't have any idea.
If u know someone please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我有同样的错误。按照这篇文章中的说明为我解决了这个问题:
在soap4r/xsd/charset的开头。 RB
@internal_encoding = (RUBY_VERSION.to_f >= 1.9) ? 'UTF8' : $KCODE
然后更改 /soap4r-1.5.8/lib/xsd/xmlparser.rb 中的第 66 行
进入
c.to_s.downcase == 名称
I had the same error. Following the instructions in this post solved the problem for me:
At The beginning of soap4r/xsd/charset.rb
@internal_encoding = (RUBY_VERSION.to_f >= 1.9) ? 'UTF8' : $KCODE
Then Change line 66 in /soap4r-1.5.8/lib/xsd/xmlparser.rb
into
c.to_s.downcase == name
将行更改
为
c.to_s.downcase ==
gems/soap4r-1.5.8/lib/xsd/xmlparser.rb 中的名称,第 76 行对我有用。可能旧版本将符号视为字符串。
Changing the line
to
c.to_s.downcase == name
in gems/soap4r-1.5.8/lib/xsd/xmlparser.rb, line76 worked for me. May be the older version treated a symbol as a string..
我正在运行 ruby-1.8。
我也必须执行 name.downcase 才能使其正常工作。
c.to_s.downcase == name.downcase
I am running ruby-1.8.
I had to do name.downcase too to get this working.
c.to_s.downcase == name.downcase