Class | SOAP::Mapping::HashFactory_
In: | soap/mapping/factory.rb
Parent: | Factory

### Methods

new obj2soap soap2obj

### Public Class methods

new(allow_original_mapping = false)

[Source]

    # File soap/mapping/factory.rb, line 304
      def initialize(allow_original_mapping = false)
        super()
        @allow_original_mapping = allow_original_mapping
      end

### Public Instance methods

obj2soap(soap_class, obj, info, map)

[Source]

    # File soap/mapping/factory.rb, line 309
      def obj2soap(soap_class, obj, info, map)
        if !@allow_original_mapping and !obj.instance_variables.empty?
          return nil
        end
        if !obj.default.nil? or
            (obj.respond_to?(:default_proc) and obj.default_proc)
          return nil
        end
        soap_obj = SOAPStruct.new(MapQName)
        mark_marshalled_obj(obj, soap_obj)
        obj.each do |key, value|
          elem = SOAPStruct.new
          elem.add("key", Mapping._obj2soap(key, map))
          elem.add("value", Mapping._obj2soap(value, map))
          # ApacheAxis allows only 'item' here.
          soap_obj.add("item", elem)
        end
        soap_obj
      end

soap2obj(obj_class, node, info, map)

[Source]

    # File soap/mapping/factory.rb, line 329
      def soap2obj(obj_class, node, info, map)
        unless node.type == MapQName
          return false
        end
        if node.class == SOAPStruct and node.key?('default')
          return false
        end
        obj = Mapping.create_empty_object(obj_class)
        mark_unmarshalled_obj(node, obj)
        if node.class == SOAPStruct
          node.each do |key, value|
            obj[Mapping._soap2obj(value['key'], map)] =
              Mapping._soap2obj(value['value'], map)
          end
        else
          node.each do |value|
            obj[Mapping._soap2obj(value['key'], map)] =
              Mapping._soap2obj(value['value'], map)
          end
        end
        return true, obj
      end

[Validate]