Module: SOAP::Marshal
- Defined in:
- lib/action_web_service/soap/marshal.rb
Constant Summary collapse
- MarshalMappingRegistry =
Trying xsd:dateTime data to be recovered as aTime.
Mapping::Registry.new( :allow_original_mapping => true)
Class Method Summary collapse
- .dump(obj, io = nil) ⇒ Object
- .load(stream) ⇒ Object
- .marshal(obj, mapping_registry = MarshalMappingRegistry, io = nil) ⇒ Object
- .unmarshal(stream, mapping_registry = MarshalMappingRegistry) ⇒ Object
Class Method Details
.dump(obj, io = nil) ⇒ Object
28 29 30 |
# File 'lib/action_web_service/soap/marshal.rb', line 28 def dump(obj, io = nil) marshal(obj, MarshalMappingRegistry, io) end |
.load(stream) ⇒ Object
32 33 34 |
# File 'lib/action_web_service/soap/marshal.rb', line 32 def load(stream) unmarshal(stream, MarshalMappingRegistry) end |
.marshal(obj, mapping_registry = MarshalMappingRegistry, io = nil) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/action_web_service/soap/marshal.rb', line 36 def marshal(obj, mapping_registry = MarshalMappingRegistry, io = nil) elename = Mapping.name2elename(obj.class.to_s) soap_obj = Mapping.obj2soap(obj, mapping_registry) body = SOAPBody.new body.add(elename, soap_obj) env = SOAPEnvelope.new(nil, body) SOAP::Processor.marshal(env, {}, io) end |
.unmarshal(stream, mapping_registry = MarshalMappingRegistry) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/action_web_service/soap/marshal.rb', line 45 def unmarshal(stream, mapping_registry = MarshalMappingRegistry) env = SOAP::Processor.unmarshal(stream) if env.nil? raise ArgumentError.new("Illegal SOAP marshal format.") end Mapping.soap2obj(env.body.root_node, mapping_registry) end |