SOAP::Mapping::WSDLRegistry (Class)

In: soap/mapping/wsdlRegistry.rb
Parent: Object

Methods

Attributes

complextypes  [R] 

Included Modules

TraverseSupport

Public Class methods

[Source]

# File soap/mapping/wsdlRegistry.rb, line 23
  def initialize(complextypes, config = {})
    @complextypes = complextypes
    @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 68
  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 = @complextypes[type_qname])
      case type.compoundtype
      when :TYPE_STRUCT
        soap_obj = struct2soap(obj, type_qname, type)
      when :TYPE_ARRAY
        soap_obj = array2soap(obj, type_qname, type)
      end
    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 64
  def soap2obj(klass, node)
    raise RuntimeError.new("#{ self } is for obj2soap only.")
  end

[Validate]