Class: SOAP::Mapping::WSDLEncodedRegistry
- Inherits:
-
EncodedRegistry
- Object
- EncodedRegistry
- SOAP::Mapping::WSDLEncodedRegistry
- Defined in:
- lib/soap/mapping/wsdlencodedregistry.rb
Constant Summary
Constants inherited from EncodedRegistry
EncodedRegistry::ArrayFactory, EncodedRegistry::Base64Factory, EncodedRegistry::BasetypeFactory, EncodedRegistry::DateTimeFactory, EncodedRegistry::FixnumFactory, EncodedRegistry::HashFactory, EncodedRegistry::RubyOriginalMap, EncodedRegistry::SOAPBaseMap, EncodedRegistry::StringFactory, EncodedRegistry::TypedArrayFactory, EncodedRegistry::TypedStructFactory, EncodedRegistry::URIFactory
Instance Attribute Summary collapse
-
#definedelements ⇒ Object
readonly
Returns the value of attribute definedelements.
-
#definedtypes ⇒ Object
readonly
Returns the value of attribute definedtypes.
Attributes inherited from EncodedRegistry
#default_factory, #excn_handler_obj2soap, #excn_handler_soap2obj
Instance Method Summary collapse
-
#initialize(definedtypes = XSD::NamedElements::Empty) ⇒ WSDLEncodedRegistry
constructor
A new instance of WSDLEncodedRegistry.
- #obj2soap(obj, qname = nil) ⇒ Object
-
#soap2obj(node, obj_class = nil) ⇒ Object
map anything for now: must refer WSDL while mapping.
Methods inherited from EncodedRegistry
#add, #find_mapped_obj_class, #find_mapped_soap_class
Methods included from RegistrySupport
#add_attributes2soap, #add_definedattributes2soap, #base2obj, #base2soap, #elename_schema_definition_from_class, #find_node_definition, #find_schema_definition, #get_xmlattr_value, #is_stubobj_elements_for_array, #register, #schema_definition_from_class, #schema_definition_from_elename, #schema_definition_from_type
Methods included from TraverseSupport
#mark_marshalled_obj, #mark_unmarshalled_obj
Constructor Details
#initialize(definedtypes = XSD::NamedElements::Empty) ⇒ WSDLEncodedRegistry
Returns a new instance of WSDLEncodedRegistry.
24 25 26 27 28 29 30 31 32 33 |
# 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 |
Instance Attribute Details
#definedelements ⇒ Object (readonly)
Returns the value of attribute definedelements.
21 22 23 |
# File 'lib/soap/mapping/wsdlencodedregistry.rb', line 21 def definedelements @definedelements end |
#definedtypes ⇒ Object (readonly)
Returns the value of attribute definedtypes.
22 23 24 |
# File 'lib/soap/mapping/wsdlencodedregistry.rb', line 22 def definedtypes @definedtypes end |
Instance Method Details
#obj2soap(obj, qname = nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# 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) ⇒ Object
map anything for now: must refer WSDL while mapping. [ToDo]
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# 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 |