Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • soap/mapping/wsdlencodedregistry.rb

Class/Module Index [+]

Quicksearch

SOAP::Mapping::WSDLEncodedRegistry

Attributes

definedelements[R]
definedtypes[R]
excn_handler_obj2soap[RW]
excn_handler_soap2obj[RW]

Public Class Methods

new(definedtypes = XSD::NamedElements::Empty) click to toggle source
 
               # File soap/mapping/wsdlencodedregistry.rb, line 28
def initialize(definedtypes = XSD::NamedElements::Empty)
  @definedtypes = definedtypes
  # @definedelements = definedelements  needed?
  @excn_handler_obj2soap = nil
  @excn_handler_soap2obj = nil
  # For mapping AnyType element.
  @rubytype_factory = RubytypeFactory.new(
    :allow_untyped_struct => true,
    :allow_original_mapping => true
  )
  @schema_element_cache = {}
end
            

Public Instance Methods

obj2soap(obj, qname = nil) click to toggle source
 
               # File soap/mapping/wsdlencodedregistry.rb, line 41
def obj2soap(obj, qname = nil)
  soap_obj = nil
  if type = @definedtypes[qname]
    soap_obj = obj2typesoap(obj, type)
  else
    soap_obj = any2soap(obj, qname)
  end
  return soap_obj if soap_obj
  if @excn_handler_obj2soap
    soap_obj = @excn_handler_obj2soap.call(obj) { |yield_obj|
      Mapping._obj2soap(yield_obj, self)
    }
    return soap_obj if soap_obj
  end
  if qname
    raise MappingError.new("cannot map #{obj.class.name} as #{qname}")
  else
    raise MappingError.new("cannot map #{obj.class.name} to SOAP/OM")
  end
end
            
soap2obj(node, obj_class = nil) click to toggle source

map anything for now: must refer WSDL while mapping. [ToDo]

 
               # File soap/mapping/wsdlencodedregistry.rb, line 63
def soap2obj(node, obj_class = nil)
  begin
    return any2obj(node, obj_class)
  rescue MappingError
  end
  if @excn_handler_soap2obj
    begin
      return @excn_handler_soap2obj.call(node) { |yield_node|
          Mapping._soap2obj(yield_node, self)
        }
    rescue Exception
    end
  end
  raise MappingError.new("cannot map #{node.type.name} to Ruby object")
end