Parent

Files

Class/Module Index [+]

Quicksearch

SOAP::Mapping::WSDLEncodedRegistry

Attributes

definedelements[R]
definedtypes[R]

Public Class Methods

new(definedtypes = XSD::NamedElements::Empty) click to toggle source
# File lib/soap/mapping/wsdlencodedregistry.rb, line 24
def initialize(definedtypes = XSD::NamedElements::Empty)
  super()
  @definedtypes = definedtypes
  # @definedelements = definedelements  needed?
  # For mapping AnyType element.
  @rubytype_factory = RubytypeFactory.new(
    :allow_untyped_struct => true,
    :allow_original_mapping => true
  )
end

Public Instance Methods

obj2soap(obj, qname = nil) click to toggle source
# File lib/soap/mapping/wsdlencodedregistry.rb, line 35
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 lib/soap/mapping/wsdlencodedregistry.rb, line 57
def soap2obj(node, obj_class = nil)
  cause = nil
  begin
    unless obj_class
      typestr = Mapping.safeconstname(node.elename.name)
      obj_class = Mapping.class_from_name(typestr)
    end
    return Mapping._soap2obj(node, Mapping::DefaultRegistry, obj_class)
  rescue MappingError
    cause = $!
  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", cause)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.