Methods
Attributes
[R] | namespace | |
[R] | registry |
Class Public methods
Source: show
# File rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb, line 23 def initialize(namespace=nil) @namespace = namespace || 'urn:ActionWebService' @registry = Registry.new @type2binding = {} register_static_factories end
Instance Public methods
Source: show
# File rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb, line 72 def annotate_arrays(binding, value) if value.nil? return elsif binding.type.array? mark_typed_array(value, binding.element_binding.qname) if binding.element_binding.type.custom? value.each do |element| annotate_arrays(binding.element_binding, element) end end elsif binding.type.structured? binding.type.each_member do |name, type| member_binding = register_type(type) member_value = value.respond_to?('[]') ? value[name] : value.send(name) annotate_arrays(member_binding, member_value) if type.custom? end end end
Also aliased as: lookup_type
Source: show
# File rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb, line 40 def register_type(type) return @type2binding[type] if @type2binding.has_key?(type) if type.array? array_mapping = @registry.find_mapped_soap_class(Array) qname = XSD::QName.new(@namespace, soap_type_name(type.element_type.type_class.name) + 'Array') element_type_binding = register_type(type.element_type) @type2binding[type] = SoapBinding.new(self, qname, type, array_mapping, element_type_binding) elsif (mapping = @registry.find_mapped_soap_class(type.type_class) rescue nil) qname = mapping[2] ? mapping[2][:type] : nil qname ||= soap_base_type_name(mapping[0]) @type2binding[type] = SoapBinding.new(self, qname, type, mapping) else qname = XSD::QName.new(@namespace, soap_type_name(type.type_class.name)) @registry.add(type.type_class, SOAP::SOAPStruct, typed_struct_factory(type.type_class), { :type => qname }) mapping = @registry.find_mapped_soap_class(type.type_class) @type2binding[type] = SoapBinding.new(self, qname, type, mapping) end if type.structured? type.each_member do |m_name, m_type| register_type(m_type) end end @type2binding[type] end
Source: show
# File rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb, line 34 def ruby_to_soap(obj) soap = SOAP::Mapping.obj2soap(obj, @registry) soap.elename = XSD::QName.new if SOAP::Version >= "1.5.5" && soap.elename == XSD::QName::EMPTY soap end
Source: show
# File rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb, line 30 def soap_to_ruby(obj) SOAP::Mapping.soap2obj(obj, @registry) end