尝试使用soap4r使用soap服务时出现Xml处理器模块未找到错误

发布于 2024-12-29 05:28:37 字数 4002 浏览 1 评论 0原文

我正在尝试通过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)

我得到了回应。 我在罗德岛也尝试过同样的事情。

  1. 我在 rhodes 应用程序中添加了扩展文件夹。
  2. 我复制了里面的soap、wsdl、xsd和tags文件夹 \Ruby187\lib\ruby\gems\1.8\gems\soap4r-1.5.8\lib 在我的系统中。

  3. 我在我的build.yml 文件中添加了soap 作为扩展名

  4. 我需要以下内容

    需要“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.

  1. I add the extensions folder in rhodes app.
  2. 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.

  3. I added soap as extension in my build.yml file

  4. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

镜花水月 2025-01-05 05:28:37

我有同样的错误。按照这篇文章中的说明为我解决了这个问题:

在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

命比纸薄 2025-01-05 05:28:37

将行更改

  c.downcase == name


c.to_s.downcase ==

gems/soap4r-1.5.8/lib/xsd/xmlparser.rb 中的名称,第 76 行对我有用。可能旧版本将符号视为字符串。

Changing the line

  c.downcase == name

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..

汹涌人海 2025-01-05 05:28:37

我正在运行 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文