# File soap/mapping/wsdlliteralregistry.rb, line 26 def initialize(definedtypes = XSD::NamedElements::Empty, definedelements = XSD::NamedElements::Empty) @definedtypes = definedtypes @definedelements = definedelements @excn_handler_obj2soap = nil @excn_handler_soap2obj = nil @schema_element_cache = {} @schema_attribute_cache = {} end
# File soap/mapping/wsdlliteralregistry.rb, line 36 def obj2soap(obj, qname) soap_obj = nil if ele = @definedelements[qname] soap_obj = obj2elesoap(obj, ele) elsif type = @definedtypes[qname] soap_obj = obj2typesoap(obj, type, true) 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, nil, nil, MAPPING_OPT) } return soap_obj if soap_obj end raise MappingError.new("cannot map #{obj.class.name} as #{qname}") end
node should be a SOAPElement
# File soap/mapping/wsdlliteralregistry.rb, line 56 def soap2obj(node, obj_class = nil) # obj_class is given when rpc/literal service. but ignored for now. begin return any2obj(node) rescue MappingError end if @excn_handler_soap2obj begin return @excn_handler_soap2obj.call(node) { |yield_node| Mapping.soap2obj(yield_node, nil, nil, MAPPING_OPT) } rescue Exception end end if node.respond_to?(:type) raise MappingError.new("cannot map #{node.type.name} to Ruby object") else raise MappingError.new("cannot map #{node.elename.name} to Ruby object") end end