### Home Classes Methods

### In Files

- lib/soap/attachment.rb
- lib/soap/mapping/wsdlencodedregistry.rb
- lib/soap/mapping/rubytypeFactory.rb
- lib/soap/mapping/wsdlliteralregistry.rb
- lib/soap/mapping/mapping.rb
- lib/soap/mapping/literalregistry.rb
- lib/soap/mapping/factory.rb
- lib/soap/mapping/schemadefinition.rb
- lib/soap/mapping/encodedregistry.rb
- lib/soap/mapping/registry.rb

### Namespace

- MODULE SOAP::Mapping::MappedException
- MODULE SOAP::Mapping::RegistrySupport
- MODULE SOAP::Mapping::SchemaComplexTypeDefinition
- MODULE SOAP::Mapping::TraverseSupport
- CLASS SOAP::Mapping::ArrayFactory_
- CLASS SOAP::Mapping::AttachmentFactory
- CLASS SOAP::Mapping::Base64Factory_
- CLASS SOAP::Mapping::BasetypeFactory_
- CLASS SOAP::Mapping::DateTimeFactory_
- CLASS SOAP::Mapping::EncodedRegistry
- CLASS SOAP::Mapping::Factory
- CLASS SOAP::Mapping::FixnumFactory_
- CLASS SOAP::Mapping::HashFactory_
- CLASS SOAP::Mapping::LiteralRegistry
- CLASS SOAP::Mapping::MappingError
- CLASS SOAP::Mapping::Object
- CLASS SOAP::Mapping::Registry
- CLASS SOAP::Mapping::RubytypeFactory
- CLASS SOAP::Mapping::SOAPException
- CLASS SOAP::Mapping::SchemaChoiceDefinition
- CLASS SOAP::Mapping::SchemaDefinition
- CLASS SOAP::Mapping::SchemaElementDefinition
- CLASS SOAP::Mapping::SchemaEmptyDefinition
- CLASS SOAP::Mapping::SchemaSequenceDefinition
- CLASS SOAP::Mapping::StringFactory_
- CLASS SOAP::Mapping::TypedArrayFactory_
- CLASS SOAP::Mapping::TypedStructFactory_
- CLASS SOAP::Mapping::URIFactory_
- CLASS SOAP::Mapping::WSDLEncodedRegistry
- CLASS SOAP::Mapping::WSDLLiteralRegistry

### Methods

- ::_obj2soap
- ::_soap2obj
- ::ary2md
- ::ary2soap
- ::class2element
- ::class2qname
- ::class_from_name
- ::const_from_name
- ::const_from_name_nonlenient
- ::create_empty_object
- ::create_schema_definition
- ::define_singleton_method
- ::elename2name
- ::external_ces
- ::fault2exception
- ::get_attribute
- ::get_attributes
- ::get_attributes_for_any
- ::module_from_name
- ::name2elename
- ::obj2element
- ::obj2soap
- ::objs2soap
- ::parse_schema_definition
- ::parse_schema_element_definition
- ::protect_threadvars
- ::reset_root_type_hint
- ::root_type_hint
- ::safeconstname
- ::safemethodname
- ::safevarname
- ::schema_attribute_definition
- ::schema_definition_classdef
- ::schema_element_definition
- ::schema_name_definition
- ::schema_ns_definition
- ::schema_qualified_definition
- ::schema_type_definition
- ::set_attributes
- ::soap2obj
- ::to_qname

### Files

- tags

### Class/Module Index

Quicksearch

- SOAP
- SOAP::ArrayIndexOutOfBoundsError
- SOAP::ArrayStoreError
- SOAP::Attachment
- SOAP::CGIStub
- SOAP::Charset
- SOAP::Driver
- SOAP::EmptyResponseError
- SOAP::EncodingStyle
- SOAP::EncodingStyle::ASPDotNetHandler
- SOAP::EncodingStyle::ASPDotNetHandler::SOAPTemporalObject
- SOAP::EncodingStyle::ASPDotNetHandler::SOAPUnknown
- SOAP::EncodingStyle::Handler
- SOAP::EncodingStyle::Handler::EncodingStyleError
- SOAP::EncodingStyle::LiteralHandler
- SOAP::EncodingStyle::SOAPHandler
- SOAP::EncodingStyle::SOAPHandler::SOAPTemporalObject
- SOAP::EncodingStyle::SOAPHandler::SOAPUnknown
- SOAP::Env
- SOAP::Error
- SOAP::FaultCode
- SOAP::FaultError
- SOAP::Filter
- SOAP::Filter::FilterChain
- SOAP::Filter::Handler
- SOAP::Filter::StreamHandler
- SOAP::Generator
- SOAP::Generator::FormatEncodeError
- SOAP::HTTPConfigLoader
- SOAP::HTTPStreamError
- SOAP::HTTPStreamHandler
- SOAP::HTTPStreamHandler::Client
- SOAP::HTTPStreamHandler::HttpPostRequestFilter
- SOAP::Header
- SOAP::Header::Handler
- SOAP::Header::HandlerSet
- SOAP::Header::MappingHandler
- SOAP::Header::SimpleHandler
- SOAP::MIMEMessage
- SOAP::MIMEMessage::Header
- SOAP::MIMEMessage::Headers
- SOAP::MIMEMessage::MIMEMessageError
- SOAP::MIMEMessage::Part
- SOAP::MPostUnavailableError
- SOAP::Mapping
- SOAP::Mapping::ArrayFactory_
- SOAP::Mapping::AttachmentFactory
- SOAP::Mapping::Base64Factory_
- SOAP::Mapping::BasetypeFactory_
- SOAP::Mapping::DateTimeFactory_
- SOAP::Mapping::EncodedRegistry
- SOAP::Mapping::EncodedRegistry::Map
- SOAP::Mapping::Factory
- SOAP::Mapping::FixnumFactory_
- SOAP::Mapping::HashFactory_
- SOAP::Mapping::LiteralRegistry
- SOAP::Mapping::MappedException
- SOAP::Mapping::MappingError
- SOAP::Mapping::Object
- SOAP::Mapping::Registry
- SOAP::Mapping::RegistrySupport
- SOAP::Mapping::RubytypeFactory
- SOAP::Mapping::SOAPException
- SOAP::Mapping::SchemaChoiceDefinition
- SOAP::Mapping::SchemaComplexTypeDefinition
- SOAP::Mapping::SchemaDefinition
- SOAP::Mapping::SchemaElementDefinition
- SOAP::Mapping::SchemaEmptyDefinition
- SOAP::Mapping::SchemaSequenceDefinition
- SOAP::Mapping::StringFactory_
- SOAP::Mapping::TraverseSupport
- SOAP::Mapping::TypedArrayFactory_
- SOAP::Mapping::TypedStructFactory_
- SOAP::Mapping::URIFactory_
- SOAP::Mapping::WSDLEncodedRegistry
- SOAP::Mapping::WSDLLiteralRegistry
- SOAP::Marshal
- SOAP::Marshal
- SOAP::Marshallable
- SOAP::NS
- SOAP::NestedException
- SOAP::NetHttpClient
- SOAP::NetHttpClient::Response
- SOAP::NetHttpClient::SessionManager
- SOAP::Parser
- SOAP::Parser::FormatDecodeError
- SOAP::Parser::ParseError
- SOAP::Parser::ParseFrame
- SOAP::Parser::ParseFrame::NodeContainer
- SOAP::Parser::UnexpectedElementError
- SOAP::PostUnavailableError
- SOAP::Processor
- SOAP::Property
- SOAP::Property::Util
- SOAP::RPC
- SOAP::RPC::CGIStub
- SOAP::RPC::CGIStub::SOAPFCGIRequest
- SOAP::RPC::CGIStub::SOAPRequest
- SOAP::RPC::CGIStub::SOAPStdinRequest
- SOAP::RPC::Driver
- SOAP::RPC::HTTPServer
- SOAP::RPC::MappingRegistry
- SOAP::RPC::MethodDefinitionError
- SOAP::RPC::ParameterError
- SOAP::RPC::Proxy
- SOAP::RPC::Proxy::Operation
- SOAP::RPC::RPCError
- SOAP::RPC::Router
- SOAP::RPC::Router::ApplicationScopeOperation
- SOAP::RPC::Router::Operation
- SOAP::RPC::Router::RequestScopeOperation
- SOAP::RPC::SOAPMethod
- SOAP::RPC::SOAPMethodRequest
- SOAP::RPC::SOAPMethodResponse
- SOAP::RPC::SOAPVoid
- SOAP::RPC::SOAPlet
- SOAP::RPC::StandaloneServer
- SOAP::RPCRoutingError
- SOAP::RPCUtils
- SOAP::ResponseFormatError
- SOAP::SOAPAnySimpleType
- SOAP::SOAPAnyURI
- SOAP::SOAPArray
- SOAP::SOAPAttachment
- SOAP::SOAPBase64
- SOAP::SOAPBasetype
- SOAP::SOAPBody
- SOAP::SOAPBoolean
- SOAP::SOAPByte
- SOAP::SOAPCompoundtype
- SOAP::SOAPDate
- SOAP::SOAPDateTime
- SOAP::SOAPDecimal
- SOAP::SOAPDouble
- SOAP::SOAPDuration
- SOAP::SOAPENTITIES
- SOAP::SOAPENTITY
- SOAP::SOAPElement
- SOAP::SOAPEnvelope
- SOAP::SOAPEnvelopeElement
- SOAP::SOAPExternalReference
- SOAP::SOAPFault
- SOAP::SOAPFloat
- SOAP::SOAPGDay
- SOAP::SOAPGMonth
- SOAP::SOAPGMonthDay
- SOAP::SOAPGYear
- SOAP::SOAPGYearMonth
- SOAP::SOAPHeader
- SOAP::SOAPHeaderItem
- SOAP::SOAPHexBinary
- SOAP::SOAPID
- SOAP::SOAPIDREF
- SOAP::SOAPIDREFS
- SOAP::SOAPInt
- SOAP::SOAPInteger
- SOAP::SOAPLanguage
- SOAP::SOAPLong
- SOAP::SOAPModuleUtils
- SOAP::SOAPNCName
- SOAP::SOAPNMTOKEN
- SOAP::SOAPNMTOKENS
- SOAP::SOAPName
- SOAP::SOAPNameAccessible
- SOAP::SOAPNegativeInteger
- SOAP::SOAPNil
- SOAP::SOAPNonNegativeInteger
- SOAP::SOAPNonPositiveInteger
- SOAP::SOAPNormalizedString
- SOAP::SOAPPositiveInteger
- SOAP::SOAPQName
- SOAP::SOAPREXMLElementWrap
- SOAP::SOAPRawData
- SOAP::SOAPRawString
- SOAP::SOAPReference
- SOAP::SOAPShort
- SOAP::SOAPString
- SOAP::SOAPStruct
- SOAP::SOAPTime
- SOAP::SOAPToken
- SOAP::SOAPType
- SOAP::SOAPUnsignedByte
- SOAP::SOAPUnsignedInt
- SOAP::SOAPUnsignedLong
- SOAP::SOAPUnsignedShort
- SOAP::StandaloneServer
- SOAP::StreamError
- SOAP::StreamHandler
- SOAP::StreamHandler::ConnectionData
- SOAP::UnhandledMustUnderstandHeaderError
- SOAP::WSDLDriver
- SOAP::WSDLDriver::Servant__
- SOAP::WSDLDriverFactory
- SOAP::WSDLDriverFactory::FactoryError
- WSDL
- WSDL::Binding
- WSDL::Definitions
- WSDL::Documentation
- WSDL::Error
- WSDL::Import
- WSDL::Importer
- WSDL::Info
- WSDL::Message
- WSDL::Operation
- WSDL::Operation::NameInfo
- WSDL::OperationBinding
- WSDL::Param
- WSDL::Parser
- WSDL::Parser::AttributeConstraintError
- WSDL::Parser::ElementConstraintError
- WSDL::Parser::FormatDecodeError
- WSDL::Parser::ParseError
- WSDL::Parser::ParseFrame
- WSDL::Parser::UnexpectedElementError
- WSDL::Parser::UnknownAttributeError
- WSDL::Parser::UnknownElementError
- WSDL::Part
- WSDL::Port
- WSDL::PortType
- WSDL::SOAP
- WSDL::SOAP::Address
- WSDL::SOAP::Binding
- WSDL::SOAP::Body
- WSDL::SOAP::CGIStubCreator
- WSDL::SOAP::ClassDefCreator
- WSDL::SOAP::ClassDefCreatorSupport
- WSDL::SOAP::ClassNameCreator
- WSDL::SOAP::ClientSkeltonCreator
- WSDL::SOAP::DriverCreator
- WSDL::SOAP::EncodedMappingRegistryCreator
- WSDL::SOAP::Fault
- WSDL::SOAP::Header
- WSDL::SOAP::HeaderFault
- WSDL::SOAP::LiteralMappingRegistryCreator
- WSDL::SOAP::MappingRegistryCreator
- WSDL::SOAP::MappingRegistryCreatorSupport
- WSDL::SOAP::MethodDefCreator
- WSDL::SOAP::Operation
- WSDL::SOAP::Operation::OperationInfo
- WSDL::SOAP::ServantSkeltonCreator
- WSDL::SOAP::ServletStubCreator
- WSDL::SOAP::StandaloneServerStubCreator
- WSDL::SOAP::WSDL2Ruby
- WSDL::Service
- WSDL::Types
- WSDL::XMLSchema
- WSDL::XMLSchema::All
- WSDL::XMLSchema::Annotation
- WSDL::XMLSchema::Any
- WSDL::XMLSchema::AnyAttribute
- WSDL::XMLSchema::Attribute
- WSDL::XMLSchema::AttributeGroup
- WSDL::XMLSchema::Choice
- WSDL::XMLSchema::ComplexContent
- WSDL::XMLSchema::ComplexExtension
- WSDL::XMLSchema::ComplexRestriction
- WSDL::XMLSchema::ComplexType
- WSDL::XMLSchema::Content
- WSDL::XMLSchema::Element
- WSDL::XMLSchema::Enumeration
- WSDL::XMLSchema::FractionDigits
- WSDL::XMLSchema::Group
- WSDL::XMLSchema::Import
- WSDL::XMLSchema::ImportHandler
- WSDL::XMLSchema::Importer
- WSDL::XMLSchema::Include
- WSDL::XMLSchema::Length
- WSDL::XMLSchema::List
- WSDL::XMLSchema::MaxExclusive
- WSDL::XMLSchema::MaxInclusive
- WSDL::XMLSchema::MaxLength
- WSDL::XMLSchema::MinExclusive
- WSDL::XMLSchema::MinInclusive
- WSDL::XMLSchema::MinLength
- WSDL::XMLSchema::Parser
- WSDL::XMLSchema::Parser::AttributeConstraintError
- WSDL::XMLSchema::Parser::ElementConstraintError
- WSDL::XMLSchema::Parser::FormatDecodeError
- WSDL::XMLSchema::Parser::ParseError
- WSDL::XMLSchema::Parser::ParseFrame
- WSDL::XMLSchema::Parser::UnexpectedElementError
- WSDL::XMLSchema::Parser::UnknownAttributeError
- WSDL::XMLSchema::Parser::UnknownElementError
- WSDL::XMLSchema::Pattern
- WSDL::XMLSchema::Schema
- WSDL::XMLSchema::Sequence
- WSDL::XMLSchema::SimpleContent
- WSDL::XMLSchema::SimpleExtension
- WSDL::XMLSchema::SimpleRestriction
- WSDL::XMLSchema::SimpleType
- WSDL::XMLSchema::TotalDigits
- WSDL::XMLSchema::Union
- WSDL::XMLSchema::Unique
- WSDL::XMLSchema::WhiteSpace
- WSDL::XMLSchema::XSD2Ruby
- XSD
- XSD::Charset
- XSD::Charset::CharsetConversionError
- XSD::Charset::CharsetError
- XSD::Charset::UnknownCharsetError
- XSD::Charset::XSDError
- XSD::CodeGen
- XSD::CodeGen::ClassDef
- XSD::CodeGen::CommentDef
- XSD::CodeGen::GenSupport
- XSD::CodeGen::MethodDef
- XSD::CodeGen::ModuleDef
- XSD::Error
- XSD::FloatConstants
- XSD::IconvCharset
- XSD::Mapping
- XSD::Mapping::Mapper
- XSD::NS
- XSD::NS::Assigner
- XSD::NS::FormatError
- XSD::NSDBase
- XSD::NamedElements
- XSD::QName
- XSD::ValueSpaceError
- XSD::XMLParser
- XSD::XMLParser::Parser
- XSD::XMLParser::Parser::ElementConstraintError
- XSD::XMLParser::Parser::FormatDecodeError
- XSD::XMLParser::Parser::ParseError
- XSD::XMLParser::Parser::ParserError
- XSD::XMLParser::Parser::UnexpectedElementError
- XSD::XMLParser::Parser::UnknownAttributeError
- XSD::XMLParser::Parser::UnknownElementError
- XSD::XMLParser::REXMLParser
- XSD::XMLParser::XMLParser
- XSD::XMLParser::XMLParser::Listener
- XSD::XMLParser::XMLScanner
- XSD::XSDAnySimpleType
- XSD::XSDAnyURI
- XSD::XSDBase64Binary
- XSD::XSDBoolean
- XSD::XSDByte
- XSD::XSDDate
- XSD::XSDDateTime
- XSD::XSDDateTimeImpl
- XSD::XSDDecimal
- XSD::XSDDouble
- XSD::XSDDuration
- XSD::XSDENTITIES
- XSD::XSDENTITY
- XSD::XSDFloat
- XSD::XSDGDay
- XSD::XSDGMonth
- XSD::XSDGMonthDay
- XSD::XSDGYear
- XSD::XSDGYearMonth
- XSD::XSDHexBinary
- XSD::XSDID
- XSD::XSDIDREF
- XSD::XSDIDREFS
- XSD::XSDInt
- XSD::XSDInteger
- XSD::XSDLanguage
- XSD::XSDLong
- XSD::XSDNCName
- XSD::XSDNMTOKEN
- XSD::XSDNMTOKENS
- XSD::XSDName
- XSD::XSDNegativeInteger
- XSD::XSDNil
- XSD::XSDNonNegativeInteger
- XSD::XSDNonPositiveInteger
- XSD::XSDNormalizedString
- XSD::XSDPositiveInteger
- XSD::XSDQName
- XSD::XSDShort
- XSD::XSDString
- XSD::XSDTime
- XSD::XSDToken
- XSD::XSDUnsignedByte
- XSD::XSDUnsignedInt
- XSD::XSDUnsignedLong
- XSD::XSDUnsignedShort
- Object
- Object::SOAPMarshal
- WEBrick
- WEBrick::Log
- Enumerable
- Kernel

No matching classes.

# SOAP::Mapping

### Constants

ApacheSOAPTypeNamespace
DefaultRegistry
EMPTY_ATTRIBUTES
EMPTY_OPT
MARSHAL_TAG
MapQName
Registry
RubyCustomTypeNamespace
RubyExtendName
RubyIVarName
RubyOriginalRegistry
RubyTypeInstanceNamespace
RubyTypeName
RubyTypeNamespace

### Public Class Methods

_obj2soap(obj, registry, type = nil) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 122
    def self._obj2soap(obj, registry, type = nil)
      if obj.respond_to?(:to_xmlpart)
        SOAPRawData.new(obj)
      elsif defined?(::REXML) and obj.is_a?(::REXML::Element)
        SOAPRawData.new(SOAPREXMLElementWrap.new(obj))
      elsif referent = Thread.current[:SOAPMapping][:MarshalKey][obj.__id__] and
          !Thread.current[:SOAPMapping][:NoReference]
        SOAPReference.new(referent)
      elsif registry
        registry.obj2soap(obj, type)
      else
        raise MappingError.new("no mapping registry given")
      end
    end

_soap2obj(node, registry, klass = nil) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 137
    def self._soap2obj(node, registry, klass = nil)
      if node.nil?
        return nil
      elsif node.is_a?(SOAPReference)
        target = node.__getobj__
        # target.id is not Object#id but SOAPReference#id
        if referent = Thread.current[:SOAPMapping][:MarshalKey][target.id] and
            !Thread.current[:SOAPMapping][:NoReference]
          return referent
        else
          return _soap2obj(target, registry, klass)
        end
      end
      return registry.soap2obj(node, klass)
    end

ary2md(ary, rank, type_ns = XSD::Namespace, typename = XSD::AnyTypeLiteral, registry = nil, opt = EMPTY_OPT) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 82
    def self.ary2md(ary, rank, type_ns = XSD::Namespace, typename = XSD::AnyTypeLiteral, registry = nil, opt = EMPTY_OPT)
      registry ||= Mapping::DefaultRegistry
      type = XSD::QName.new(type_ns, typename)
      md_ary = SOAPArray.new(ValueArrayName, rank, type)
      protect_mapping(opt) do
        add_md_ary(md_ary, ary, [], registry)
      end
      md_ary
    end

ary2soap(ary, type_ns = XSD::Namespace, typename = XSD::AnyTypeLiteral, registry = nil, opt = EMPTY_OPT) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 70
    def self.ary2soap(ary, type_ns = XSD::Namespace, typename = XSD::AnyTypeLiteral, registry = nil, opt = EMPTY_OPT)
      registry ||= Mapping::DefaultRegistry
      type = XSD::QName.new(type_ns, typename)
      soap_ary = SOAPArray.new(ValueArrayName, 1, type)
      protect_mapping(opt) do
        ary.each do |ele|
          soap_ary.add(_obj2soap(ele, registry, type))
        end
      end
      soap_ary
    end

class2element(klass) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 269
    def self.class2element(klass)
      name = schema_type_definition(klass) ||
        Mapping.name2elename(klass.name)
      namespace = schema_ns_definition(klass) || RubyCustomTypeNamespace
      XSD::QName.new(namespace, name)
    end

class2qname(klass) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 263
    def self.class2qname(klass)
      name = schema_type_definition(klass)
      namespace = schema_ns_definition(klass)
      XSD::QName.new(namespace, name)
    end

class_from_name(name, lenient = false) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 228
    def self.class_from_name(name, lenient = false)
      unless lenient
        const = const_from_name_nonlenient(name)
      else
        const = const_from_name(name, true)
      end
      if const.is_a?(::Class)
        const
      else
        nil
      end
    end

const_from_name(name, lenient = false) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 204
    def self.const_from_name(name, lenient = false)
      const = ::Object
      name.sub(/\A::/, '').split('::').each do |const_str|
        if /\A[A-Z]/ =~ const_str
          begin
            if const.const_defined?(const_str)
              const = const.const_get(const_str)
              next
            end
          rescue NameError
          end
        end
        if lenient
          const_str = Mapping.safeconstname(const_str)
          if const.const_defined?(const_str)
            const = const.const_get(const_str)
            next
          end
        end
        return nil
      end
      const
    end

const_from_name_nonlenient(name) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 254
    def self.const_from_name_nonlenient(name)
      if Thread.current[:SOAPMapping]
        Thread.current[:SOAPMapping][:ConstFromName][name] ||=
          const_from_name(name)
      else
        const_from_name(name)
      end
    end

create_empty_object(klass) click to toggle source

ruby/1.7 or later.

    # File lib/soap/mapping/mapping.rb, line 155
    def self.create_empty_object(klass)
      klass.allocate
    end

create_schema_definition(klass, definition) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 466
    def self.create_schema_definition(klass, definition)
      schema_ns = definition[:schema_ns]
      schema_name = definition[:schema_name]
      schema_type = definition[:schema_type]
      is_anonymous = definition[:is_anonymous]
      schema_basetype = definition[:schema_basetype]
      # wrap if needed for backward compatibility
      if schema_ns
        schema_name = Mapping.to_qname(schema_name, schema_ns) if schema_name
        schema_type = Mapping.to_qname(schema_type, schema_ns) if schema_type
        # no need for schema_basetype bacause it's introduced later
      end
      schema_qualified = definition[:schema_qualified]
      schema_element = definition[:schema_element]
      schema_attributes = definition[:schema_attribute]
      definition = SchemaDefinition.new(klass, schema_name, schema_type, is_anonymous, schema_qualified)
      definition.basetype = schema_basetype
      definition.attributes = schema_attributes
      if schema_element
        if schema_element.respond_to?(:is_concrete_definition) and
            schema_element.is_concrete_definition
          definition.elements = schema_element
        else
          default_ns = schema_name.namespace if schema_name
          default_ns ||= schema_type.namespace if schema_type
          definition.elements = parse_schema_definition(schema_element, default_ns)
          if klass < ::Array
            definition.elements.set_array
          end
        end
      end
      definition
    end

define_singleton_method(obj, name, &block) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 300
    def self.define_singleton_method(obj, name, &block)
      sclass = (class << obj; self; end)
      sclass.class_eval {
        define_method(name, &block)
      }
    end

elename2name(name) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 198
    def self.elename2name(name)
      name.gsub(/\.\./, '::').gsub(/((?:\.[0-9a-fA-F]{2})+)/) {
        [$1.delete('.')].pack('H*')
      }
    end

external_ces() click to toggle source

    # File lib/soap/mapping/mapping.rb, line 413
    def self.external_ces
      Thread.current[:SOAPMapping][:ExternalCES]
    end

fault2exception(fault, registry = nil) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 92
    def self.fault2exception(fault, registry = nil)
      registry ||= Mapping::DefaultRegistry
      detail = if fault.detail
          soap2obj(fault.detail, registry) || ""
        else
          ""
        end
      if detail.is_a?(Mapping::SOAPException)
        begin
          e = detail.to_e
          remote_backtrace = e.backtrace
          e.set_backtrace(nil)
          raise e # ruby sets current caller as local backtrace of e => e2.
        rescue Exception => e
          e.set_backtrace(remote_backtrace + e.backtrace[1..-1])
          raise
        end
      else
        fault.detail = detail
        fault.set_backtrace(
          if detail.is_a?(Array)
            detail
          else
            [detail.to_s]
          end
        )
        raise
      end
    end

get_attribute(obj, attr_name) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 328
    def self.get_attribute(obj, attr_name)
      case obj
      when ::SOAP::Mapping::Object
        return obj[attr_name]
      when ::Hash
        return obj[attr_name] || obj[attr_name.intern]
      else
        if obj.respond_to?(attr_name)
          return obj.__send__(attr_name)
        end
        iv = obj.instance_variables
        name = Mapping.safevarname(attr_name)
        if iv.include?("@#{name}")
          return obj.instance_variable_get("@#{name}")
        elsif iv.include?("@#{attr_name}")
          return obj.instance_variable_get("@#{attr_name}")
        end
        if obj.respond_to?(name)
          return obj.__send__(name)
        end
        nil
      end
    end

get_attributes(obj) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 307
    def self.get_attributes(obj)
      if obj.is_a?(::Hash)
        obj
      else
        rs = {}
        obj.instance_variables.each do |ele|
          rs[ele.sub(/^@/, '')] = obj.instance_variable_get(ele)
        end
        rs
      end
    end

get_attributes_for_any(obj) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 320
    def self.get_attributes_for_any(obj)
      if obj.respond_to?(:__xmlele_any)
        obj.__xmlele_any || EMPTY_ATTRIBUTES
      else
        get_attributes(obj)
      end
    end

module_from_name(name, lenient = false) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 241
    def self.module_from_name(name, lenient = false)
      unless lenient
        const = const_from_name_nonlenient(name)
      else
        const = const_from_name(name, true)
      end
      if const.is_a?(::Module)
        const
      else
        nil
      end
    end

name2elename(name) click to toggle source

Allow only (Letter | '_') (Letter | Digit | '-' | '_')* here. Caution: '.' is not allowed here. To follow XML spec., it should be NCName.

    (denied chars) => .[0-F][0-F]
    ex. a.b => a.2eb

    # File lib/soap/mapping/mapping.rb, line 192
    def self.name2elename(name)
      name.gsub(/([^a-zA-Z0-9:_\-]+)/) {
        '.' << $1.unpack('H2' * $1.size).join('.')
      }.gsub(/::/, '..')
    end

obj2element(obj) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 276
    def self.obj2element(obj)
      name = namespace = nil
      ivars = obj.instance_variables
      if ivars.include?('@schema_type')
        name = obj.instance_variable_get('@schema_type')
      end
      if ivars.include?('@schema_ns')
        namespace = obj.instance_variable_get('@schema_ns')
      end
      if !name or !namespace
        class2qname(obj.class)
      else
        XSD::QName.new(namespace, name)
      end
    end

obj2soap(obj, registry = nil, type = nil, opt = EMPTY_OPT) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 39
    def self.obj2soap(obj, registry = nil, type = nil, opt = EMPTY_OPT)
      registry ||= Mapping::DefaultRegistry
      soap_obj = nil
      protect_mapping(opt) do
        soap_obj = _obj2soap(obj, registry, type)
      end
      soap_obj
    end

objs2soap(objs, registry = nil, types = nil, opt = EMPTY_OPT) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 48
    def self.objs2soap(objs, registry = nil, types = nil, opt = EMPTY_OPT)
      registry ||= Mapping::DefaultRegistry
      ary = []
      protect_mapping(opt) do
        0.upto(objs.length - 1) do |idx|
          type = types ? types[idx] : nil
          soap = _obj2soap(objs[idx], registry, type)
          ary << soap
        end
      end
      ary
    end

parse_schema_definition(schema_element, default_ns) click to toggle source

for backward compatibility returns SchemaComplexTypeDefinition

    # File lib/soap/mapping/mapping.rb, line 502
    def self.parse_schema_definition(schema_element, default_ns)
      definition = nil
      if schema_element[0] == :choice
        schema_element.shift
        definition = SchemaChoiceDefinition.new
      else
        definition = SchemaSequenceDefinition.new
      end
      schema_element.each do |ele|
        element_definition = parse_schema_element_definition(ele, default_ns)
        definition << element_definition
      end
      definition
    end

parse_schema_element_definition(schema_element, default_ns) click to toggle source

returns SchemaElementDefinition

    # File lib/soap/mapping/mapping.rb, line 518
    def self.parse_schema_element_definition(schema_element, default_ns)
      if schema_element[0] == :choice
        parse_schema_definition(schema_element, default_ns)
      elsif schema_element[0].is_a?(Array)
        parse_schema_definition(schema_element, default_ns)
      else
        varname, info, occurrence = schema_element
        mapped_class_str, elename = info
        if occurrence
          minoccurs, maxoccurs = occurrence
        else
          # for backward compatibility
          minoccurs, maxoccurs = 1, 1
        end
        as_any = as_array = false
        if /\[\]$/ =~ mapped_class_str
          mapped_class_str = mapped_class_str.sub(/\[\]$/, '')
          if mapped_class_str.empty?
            mapped_class_str = nil
          end
          as_array = true
        end
        if mapped_class_str
          mapped_class = Mapping.class_from_name(mapped_class_str)
          if mapped_class.nil?
            warn("cannot find mapped class: #{mapped_class_str}")
          end
        end
        if elename == XSD::AnyTypeName
          as_any = true
        elsif elename.nil?
          elename = XSD::QName.new(default_ns, varname)
        end
        SchemaElementDefinition.new(
          varname, mapped_class, elename, minoccurs, maxoccurs, as_any, as_array)
      end
    end

protect_threadvars(*symbols) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 559
    def protect_threadvars(*symbols)
      backup = {}
      begin
        symbols.each do |sym|
          backup[sym] = Thread.current[sym]
        end
        yield
      ensure
        symbols.each do |sym|
          Thread.current[sym] = backup[sym]
        end
      end
    end

reset_root_type_hint() click to toggle source

    # File lib/soap/mapping/mapping.rb, line 409
    def self.reset_root_type_hint
      Thread.current[:SOAPMapping][:RootTypeHint] = false
    end

root_type_hint() click to toggle source

    # File lib/soap/mapping/mapping.rb, line 405
    def self.root_type_hint
      Thread.current[:SOAPMapping][:RootTypeHint]
    end

safeconstname(name) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 390
    def self.safeconstname(name)
      Thread.current[:SOAPMapping][:SafeConstName][name] ||=
        XSD::CodeGen::GenSupport.safeconstname(name)
    end

safemethodname(name) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 395
    def self.safemethodname(name)
      Thread.current[:SOAPMapping][:SafeMethodName][name] ||=
        XSD::CodeGen::GenSupport.safemethodname(name)
    end

safevarname(name) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 400
    def self.safevarname(name)
      Thread.current[:SOAPMapping][:SafeVarName][name] ||=
        XSD::CodeGen::GenSupport.safevarname(name)
    end

schema_attribute_definition(klass) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 437
    def self.schema_attribute_definition(klass)
      class_schema_variable(:schema_attribute, klass)
    end

schema_definition_classdef(klass) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 441
    def self.schema_definition_classdef(klass)
      if Thread.current[:SOAPMapping][:SchemaDefinition].key?(klass)
        return Thread.current[:SOAPMapping][:SchemaDefinition][klass]
      end
      schema_ns = schema_ns_definition(klass)
      schema_name = schema_name_definition(klass)
      schema_type = schema_type_definition(klass)
      qualified = schema_qualified_definition(klass)
      elements = schema_element_definition(klass)
      attributes = schema_attribute_definition(klass)
      return nil if schema_name.nil? and schema_type.nil?
      schema_name = Mapping.to_qname(schema_name, schema_ns) if schema_name
      schema_type = Mapping.to_qname(schema_type, schema_ns) if schema_type
      definition = create_schema_definition(klass,
        :schema_name => schema_name,
        :schema_type => schema_type,
        :is_anonymous => false,
        :schema_qualified => qualified,
        :schema_element => elements,
        :schema_attribute => attributes
      )
      Thread.current[:SOAPMapping][:SchemaDefinition][klass] = definition
      definition
    end

schema_element_definition(klass) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 433
    def self.schema_element_definition(klass)
      class_schema_variable(:schema_element, klass)
    end

schema_name_definition(klass) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 421
    def self.schema_name_definition(klass)
      class_schema_variable(:schema_name, klass)
    end

schema_ns_definition(klass) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 417
    def self.schema_ns_definition(klass)
      class_schema_variable(:schema_ns, klass)
    end

schema_qualified_definition(klass) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 429
    def self.schema_qualified_definition(klass)
      class_schema_variable(:schema_qualified, klass)
    end

schema_type_definition(klass) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 425
    def self.schema_type_definition(klass)
      class_schema_variable(:schema_type, klass)
    end

set_attributes(obj, values) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 352
    def self.set_attributes(obj, values)
      case obj
      when ::SOAP::Mapping::Object
        values.each do |attr_name, value|
          obj.__add_xmlele_value(attr_name, value)
        end
      else
        values.each do |attr_name, value|
          # untaint depends GenSupport.safevarname
          name = Mapping.safevarname(attr_name).untaint
          setter = name + "="
          if obj.respond_to?(setter)
            obj.__send__(setter, value)
          else
            obj.instance_variable_set('@' + name, value)
            begin
              unless obj.respond_to?(name)
                obj.instance_eval                 def #{name}                  @#{name}                end
              end
              unless self.respond_to?(name + "=")
                obj.instance_eval                 def #{name}=(value)                  @#{name} = value                end
              end
            rescue TypeError
              # singleton class may not exist (e.g. Float)
            end
          end
        end
      end
    end

soap2obj(node, registry = nil, klass = nil, opt = EMPTY_OPT) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 61
    def self.soap2obj(node, registry = nil, klass = nil, opt = EMPTY_OPT)
      registry ||= Mapping::DefaultRegistry
      obj = nil
      protect_mapping(opt) do
        obj = _soap2obj(node, registry, klass)
      end
      obj
    end

to_qname(obj, ns = nil) click to toggle source

    # File lib/soap/mapping/mapping.rb, line 292
    def self.to_qname(obj, ns = nil)
      if obj.is_a?(XSD::QName)
        obj
      else
        XSD::QName.new(ns, obj)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.