In Files

  • soap/mapping/wsdlliteralregistry.rb

Class/Module Index [+]

Quicksearch

SOAP::Mapping::WSDLLiteralRegistry

Constants

MAPPING_OPT

Attributes

definedelements[R]
definedtypes[R]
excn_handler_obj2soap[RW]
excn_handler_soap2obj[RW]

Public Class Methods

new(definedtypes = XSD::NamedElements::Empty, definedelements = XSD::NamedElements::Empty) click to toggle source
 
               # File soap/mapping/wsdlliteralregistry.rb, line 26
def initialize(definedtypes = XSD::NamedElements::Empty,
    definedelements = XSD::NamedElements::Empty)
  @definedtypes = definedtypes
  @definedelements = definedelements
  @excn_handler_obj2soap = nil
  @excn_handler_soap2obj = nil
  @schema_element_cache = {}
  @schema_attribute_cache = {}
end
            

Public Instance Methods

obj2soap(obj, qname) click to toggle source
 
               # File soap/mapping/wsdlliteralregistry.rb, line 36
def obj2soap(obj, qname)
  soap_obj = nil
  if ele = @definedelements[qname]
    soap_obj = obj2elesoap(obj, ele)
  elsif type = @definedtypes[qname]
    soap_obj = obj2typesoap(obj, type, true)
  else
    soap_obj = any2soap(obj, qname)
  end
  return soap_obj if soap_obj
  if @excn_handler_obj2soap
    soap_obj = @excn_handler_obj2soap.call(obj) { |yield_obj|
      Mapping.obj2soap(yield_obj, nil, nil, MAPPING_OPT)
    }
    return soap_obj if soap_obj
  end
  raise MappingError.new("cannot map #{obj.class.name} as #{qname}")
end
            
soap2obj(node, obj_class = nil) click to toggle source

node should be a SOAPElement

 
               # File soap/mapping/wsdlliteralregistry.rb, line 56
def soap2obj(node, obj_class = nil)
  # obj_class is given when rpc/literal service.  but ignored for now.
  begin
    return any2obj(node)
  rescue MappingError
  end
  if @excn_handler_soap2obj
    begin
      return @excn_handler_soap2obj.call(node) { |yield_node|
          Mapping.soap2obj(yield_node, nil, nil, MAPPING_OPT)
        }
    rescue Exception
    end
  end
  if node.respond_to?(:type)
    raise MappingError.new("cannot map #{node.type.name} to Ruby object")
  else
    raise MappingError.new("cannot map #{node.elename.name} to Ruby object")
  end
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus