Class SOAP::Mapping::WSDLRegistry
In: soap/mapping/wsdlRegistry.rb
Parent: Object

Methods

Included Modules

TraverseSupport

Attributes

definedtypes  [R] 

Public Class methods

[Source]

# File soap/mapping/wsdlRegistry.rb, line 23
  def initialize(definedtypes, config = {})
    @definedtypes = definedtypes
    @config = config
    @excn_handler_obj2soap = nil
    # For mapping AnyType element.

    @rubytype_factory = RubytypeFactory.new(
      :allow_untyped_struct => true,
      :allow_original_mapping => true
    )
  end

Public Instance methods

[Source]

# File soap/mapping/wsdlRegistry.rb, line 61
  def excn_handler_obj2soap=(handler)
    @excn_handler_obj2soap = handler
  end

[Source]

# File soap/mapping/wsdlRegistry.rb, line 34
  def obj2soap(klass, obj, type_qname)
    soap_obj = nil
    if obj.nil?
      soap_obj = SOAPNil.new
    elsif obj.is_a?(XSD::NSDBase)
      soap_obj = soap2soap(obj, type_qname)
    elsif type = @definedtypes[type_qname]
      soap_obj = obj2type(obj, type)
    elsif (type = TypeMap[type_qname])
      soap_obj = base2soap(obj, type)
    elsif type_qname == XSD::AnyTypeName
      soap_obj = @rubytype_factory.obj2soap(nil, obj, nil, nil)
    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)
      }
    end
    return soap_obj if soap_obj
    raise MappingError.new("Cannot map #{ klass.name } to SOAP/OM.")
  end

[Source]

# File soap/mapping/wsdlRegistry.rb, line 57
  def soap2obj(klass, node)
    raise RuntimeError.new("#{ self } is for obj2soap only.")
  end

[Validate]