带有soap4r 1.5.8的Ruby 1.8.7不理解WSDL模式中的xml组元素

时间:2013-04-20 16:48:48

标签: ruby soap4r

定义我的SOAP API的WSDL文档定义了一个XML类型,比如'EchoRequest',它包含一个XML“group”元素。使用soap4r,如果我使用'EchoRequest'作为输入进行SOAP API调用,那么soap4r不理解group元素并在以下代码中给出错误。

如何让soap4r理解XML组元素?

我的ruby代码有点像这样 -

wsdlUrl = 'http://www.example.com/schema/Echo.wsdl'
...
svc = SOAP::WSDLDriverFactory.new(wsdlUrl).create_rpc_driver
...
result = svc.Echo(:messageId => '', :version => '', :echoInput => 'Hello World')
...

XSD大致是这样的 -

...
<xs:group name="EchoRequestParamGroup">
<xs:sequence>
<xs:element name="messageId" type="xs:string"/>
<xs:element name="version" type="xs:string"/>
<xs:element name="echoInput" type="xs:string"/>
</xs:sequence>
</xs:group>
...
<xs:element name="EchoRequest">
<xs:complexType>
<xs:complexContent>
<xs:sequence>
<xs:group ref="EchoRequestParamGroup"/>
</xs:sequence>
</xs:complexContent>
</xs:complexType>
</xs:element>
...

错误 -

SOAP::Mapping::MappingError: unknown type: #<WSDL::XMLSchema::Group:0x55845c>
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb:155:in `complexobj2sequencesoap'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/xsd/namedelements.rb:58:in `each'
    from org/jruby/RubyArray.java:1613:in `each'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/xsd/namedelements.rb:57:in `each'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb:140:in `complexobj2sequencesoap'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb:134:in `complexobj2soap'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb:111:in `obj2typesoap'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb:92:in `obj2elesoap'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb:37:in `obj2soap'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb:131:in `_obj2soap'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb:43:in `obj2soap'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb:592:in `protect_mapping'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb:565:in `protect_threadvars'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb:581:in `protect_mapping'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb:42:in `obj2soap'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb:513:in `request_doc_lit'
... 7 levels...
    from (eval):6:in `Echo'
    from org/jruby/RubyKernel.java:2090:in `send'
    from D:/mywork/jruby-1.7.3/lib/ruby/gems/shared/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb:139:in `Echo'
    from org/jruby/RubyProc.java:261:in `call'
    from (irb):32:in `evaluate'
    from org/jruby/RubyKernel.java:1061:in `eval'
    from D:/mywork/jruby-1.7.3/lib/ruby/1.8/irb.rb:158:in `eval_input'
    from D:/mywork/jruby-1.7.3/lib/ruby/1.8/irb.rb:271:in `signal_status'
    from D:/mywork/jruby-1.7.3/lib/ruby/1.8/irb.rb:155:in `eval_input'
    from org/jruby/RubyKernel.java:1409:in `loop'
    from org/jruby/RubyKernel.java:1160:in `catch'
    from D:/mywork/jruby-1.7.3/lib/ruby/1.8/irb.rb:154:in `eval_input'
    from D:/mywork/jruby-1.7.3/lib/ruby/1.8/irb.rb:71:in `start'
    from org/jruby/RubyKernel.java:1160:in `catch'
    from D:/mywork/jruby-1.7.3/lib/ruby/1.8/irb.rb:70:in `start'
    from D:\mywork\jruby-1.7.3\/bin/jirb_swing:54:in `(root)'

0 个答案:

没有答案