Class | SOAP::Mapping::WSDLLiteralRegistry
In: | soap/mapping/wsdlliteralregistry.rb
Parent: | Registry

### Methods

new obj2soap soap2obj

### Constants

MAPPING_OPT | = | { :no_reference => true }

### 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)

[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)

[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)

node should be a SOAPElement

[Source]

    # 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

[Validate]