Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Ticket #450 (new defect)

Opened 1 year ago

Last modified 9 months ago

Dropping attributes in soap request to xsd2ruby generated class

Reported by: user Assigned to: nahi
Priority: normal Milestone: undefined
Component: soap4r Version: 1.5
Keywords: Cc:

Description

Generate ruby class from xsd2ruby.rb xsd required attr below shows up as xattr_attr in class definition send xml doc <ele attr=xxx></ele> in soap request attr is "lost" in translation, i.e.: document.xattr_attr always returns nil

also unbounded arrays only include first element - all others "lost"

ruby 1.8.6, rails 1.2.5, soap4r 1.5.8, mac osx Leopard (10.5)

Attachments

Project.xsd (5.8 kB) - added by user on 11/07/07 00:56:33.
project.xml (26.9 kB) - added by user on 11/07/07 00:57:14.
soap4r.log (36.5 kB) - added by user on 11/07/07 00:58:38.

Change History

11/07/07 00:56:33 changed by user

  • attachment Project.xsd added.

11/07/07 00:57:14 changed by user

  • attachment project.xml added.

11/07/07 00:58:38 changed by user

  • attachment soap4r.log added.

11/07/07 22:55:48 changed by user

I changed mapping/rubytypeFactory.rb, and this fixed the attribute issue. Might not be the right place to do this...

  def soap2obj(obj_class, node, info, map)
#p "smrtf: s2o entry", obj_class, node, info, map
    rubytype = node.extraattr[RubyTypeName]
    obj = nil
    if rubytype or node.type.namespace == RubyTypeNamespace
      obj = rubytype2obj(node, info, map, rubytype)
    elsif node.type == XSD::AnyTypeName or node.type == XSD::AnySimpleTypeName
      obj = anytype2obj(node, info, map)
    else
      obj = unknowntype2obj(node, info, map)
    end

# AEB
#p "smrtf: s2o node", node.extraattr, obj
      node.extraattr.each do |key, value|
        obj[1].__xmlattr[key] = value
      end

#p "smrtf: s2o exit", obj
    obj
  end

12/22/07 09:17:49 changed by user

I'm having the same problem with the same versions. And, the hack above didn't do the trick either.

None of my attributes make it through XSD::Mapping.obj2xml.

01/27/08 07:35:30 changed by user

+1 I've also had this problem.

The suggested fix for soap2obj listed above did not work for me either. This is reproducible on Mac and Windows.