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

Changeset 1871

Show
Ignore:
Timestamp:
07/01/07 15:36:45 (1 year ago)
Author:
nahi
Message:
  • under the earlier versions, we could use [] instead of CountryTargets?[]. from 1.5.6-GA it doesn't work. let LiteralRegistry? decide how the class should be mapped to according to the defined class in the parent complexType. closes #373.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/soap/mapping/literalregistry.rb

    r1857 r1871  
    3030  end 
    3131 
    32   def obj2soap(obj, qname
     32  def obj2soap(obj, qname, obj_class = nil
    3333    soap_obj = nil 
    3434    if obj.is_a?(SOAPElement) 
    3535      soap_obj = obj 
    3636    else 
    37       soap_obj = any2soap(obj, qname
     37      soap_obj = any2soap(obj, qname, obj_class
    3838    end 
    3939    return soap_obj if soap_obj 
     
    6868  MAPPING_OPT = { :no_reference => true } 
    6969 
    70   def any2soap(obj, qname) 
     70  def definedobj2soap(obj, definition) 
     71    obj2soap(obj, definition.elename, definition.mapped_class) 
     72  end 
     73 
     74  def any2soap(obj, qname, obj_class) 
    7175    ele = nil 
    7276    if obj.is_a?(SOAP::Mapping::Object) 
    7377      return mappingobj2soap(obj, qname) 
    7478    end 
    75     class_definition = schema_definition_from_class(obj.class) 
     79    class_definition = schema_definition_from_class(obj_class || obj.class) 
    7680    elename_definition = schema_definition_from_elename(qname) 
    7781    if !class_definition and !elename_definition 
     
    163167      elsif obj.respond_to?(:each) and definition.as_array? 
    164168        obj.each do |item| 
    165           ele.add(obj2soap(item, definition.elename)) 
     169          ele.add(definedobj2soap(item, definition)) 
    166170        end 
    167171      else 
     
    172176          if child.respond_to?(:each) and definition.as_array? 
    173177            child.each do |item| 
    174               ele.add(obj2soap(item, definition.elename)) 
     178              ele.add(definedobj2soap(item, definition)) 
    175179            end 
    176180          else 
    177             ele.add(obj2soap(child, definition.elename)) 
     181            ele.add(definedobj2soap(child, definition)) 
    178182          end 
    179183        end 
  • trunk/test/wsdl/document/array/test_array.rb

    r1852 r1871  
    127127    @client.wiredump_dev = STDOUT if $DEBUG 
    128128    double = [0.1, 0.2, 0.3] 
    129     arg = { 
    130       :ary => { 
    131         XSD::QName.new("http://tempuri.org/", "double") => double 
    132       } 
    133     } 
    134     assert_equal(double, @client.echo(arg).ary) 
     129    assert_equal(double, @client.echo(:ary => double).ary) 
    135130  end 
    136131end