mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ff1b89a96d
* lib/soap/{attachment.rb,baseData.rb,encodingstyle/soapHandler.rb}: introduce SOAPExternalReference class as a referenct to SOAPEnvelope external content. * lib/soap/{attachment.rb,mimemessage.rb}: great SwA (SOAP messages with Attachments) support code by Jamie Herre. * lib/soap/{element.rb,marshal.rb,parser.rb,processor.rb, streamHandler.rb,wsdlDriver.rb}: SwA support. * lib/soap/rpc/{cgistub.rb,driver.rb,element.rb,proxy.rb,router.rb, soaplet.rb}: SwA support and refactoring. * lib/soap/generator.rb, lib/soap/mapping/mapping.rb: follow SOAPReference#initialize signature change. * lib/soap/mapping/factory.rb: deleted unused methods. * lib/soap/mapping/rubytypeFactory.rb: do no ignore case while xsi:type string <-> Ruby class name matching. * lib/xsd/datatypes.rb: check the smallest positive non-zero single-precision float exactly instead of packing with "f". [ruby-talk:88822] * test/soap/test_basetype.rb, test/xsd/test_xsd.rb: use 1.402e-45, not 1.4e-45. 1.4e-45 is smaller than 2 ** -149... * test/soap/test_basetype.rb, test/soap/marshal/test_marshal.rb, test/xsd/test_xsd.rb: use "(-1.0 / (1.0 / 0.0))" instead of "-0.0". * test/soap/test_streamhandler.rb: revert to the previous test that warns "basic_auth unsupported under net/http". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
58 lines
1.5 KiB
Ruby
58 lines
1.5 KiB
Ruby
# SOAP4R - Marshalling/Unmarshalling Ruby's object using SOAP Encoding.
|
|
# Copyright (C) 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
|
|
|
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
|
# redistribute it and/or modify it under the same terms of Ruby's license;
|
|
# either the dual license version in 2003, or any later version.
|
|
|
|
|
|
require "soap/mapping"
|
|
require "soap/processor"
|
|
|
|
|
|
module SOAP
|
|
|
|
|
|
module Marshal
|
|
# Trying xsd:dateTime data to be recovered as aTime. aDateTime if it fails.
|
|
MarshalMappingRegistry = Mapping::Registry.new(:allow_original_mapping => true)
|
|
MarshalMappingRegistry.add(
|
|
Time,
|
|
::SOAP::SOAPDateTime,
|
|
::SOAP::Mapping::Registry::DateTimeFactory
|
|
)
|
|
|
|
class << self
|
|
public
|
|
def dump(obj, io = nil)
|
|
marshal(obj, MarshalMappingRegistry, io)
|
|
end
|
|
|
|
def load(stream)
|
|
unmarshal(stream, MarshalMappingRegistry)
|
|
end
|
|
|
|
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
|
|
|
|
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
|
|
end
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
SOAPMarshal = SOAP::Marshal
|