Class: SOAP::RPC::Router

### Home Classes Methods

### In Files

- lib/soap/rpc/router.rb

### Parent

Object

### Namespace

- CLASS SOAP::RPC::Router::ApplicationScopeOperation
- CLASS SOAP::RPC::Router::Operation
- CLASS SOAP::RPC::Router::RequestScopeOperation

### Methods

- ::new
- #add_document_method
- #add_document_operation
- #add_document_request_operation
- #add_headerhandler
- #add_method
- #add_request_headerhandler
- #add_rpc_method
- #add_rpc_operation
- #add_rpc_request_operation
- #add_rpc_request_servant
- #add_rpc_servant
- #add_servant
- #create_fault_response
- #route

### Included Modules

- SOAP

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- SOAP
- SOAP::ArrayIndexOutOfBoundsError
- SOAP::ArrayStoreError
- SOAP::Attachment
- SOAP::AttrProxy
- SOAP::AttrProxy::AttrProxyClassSupport
- 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::MethodDef
- SOAP::RPC::MethodDef::Parameter
- 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::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::StreamError
- SOAP::StreamHandler
- SOAP::StreamHandler::ConnectionData
- SOAP::UnhandledMustUnderstandHeaderError
- 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::OperationBinding
- WSDL::OperationBinding::BoundId
- WSDL::OperationBinding::OperationInfo
- WSDL::OperationBinding::Part
- 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::ParamInfo
- 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::Ref
- WSDL::XMLSchema::Ref::RefClassSupport
- 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::LibXMLParser
- 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
- Hash
- Kernel

No matching classes.

# SOAP::RPC::Router

### Attributes

actor[R]
external_ces[RW]
filterchain[R]
generate_explicit_type[RW]
literal_mapping_registry[RW]
mapping_registry[RW]
use_default_namespace[RW]

### Public Class Methods

new(actor) click to toggle source

    # File lib/soap/rpc/router.rb, line 37
    def initialize(actor)
      @actor = actor
      @mapping_registry = nil
      @headerhandler = Header::HandlerSet.new
      @literal_mapping_registry = ::SOAP::Mapping::LiteralRegistry.new
      @generate_explicit_type = true
      @use_default_namespace = false
      @external_ces = nil
      @operation_by_soapaction = {}
      @operation_by_qname = {}
      @headerhandlerfactory = []
      @filterchain = Filter::FilterChain.new
    end

### Public Instance Methods

add_document_method(receiver, soapaction, name, param_def, opt = {}) click to toggle source
Alias for: add_document_operation
add_document_operation(receiver, soapaction, name, param_def, opt = {}) click to toggle source

    # File lib/soap/rpc/router.rb, line 125
    def add_document_operation(receiver, soapaction, name, param_def, opt = {})
      #
      # adopt workaround for doc/lit wrapper method
      # (you should consider to simply use rpc/lit service)
      #
      #unless soapaction
      #  raise RPCRoutingError.new("soapaction is a must for document method")
      #end
      ensure_styleuse_option(opt, :document, :literal)
      op = ApplicationScopeOperation.new(soapaction, receiver, name, param_def,
        opt)
      if opt[:request_style] != :document
        raise RPCRoutingError.new("illegal request_style given")
      end
      assign_operation(soapaction, first_input_part_qname(param_def), op)
    end

Also aliased as: add_document_method
add_document_request_operation(factory, soapaction, name, param_def, opt = {}) click to toggle source

    # File lib/soap/rpc/router.rb, line 143
    def add_document_request_operation(factory, soapaction, name, param_def, opt = {})
      #
      # adopt workaround for doc/lit wrapper method
      # (you should consider to simply use rpc/lit service)
      #
      #unless soapaction
      #  raise RPCRoutingError.new("soapaction is a must for document method")
      #end
      ensure_styleuse_option(opt, :document, :literal)
      op = RequestScopeOperation.new(soapaction, receiver, name, param_def, opt)
      if opt[:request_style] != :document
        raise RPCRoutingError.new("illegal request_style given")
      end
      assign_operation(soapaction, first_input_part_qname(param_def), op)
    end

add_headerhandler(handler) click to toggle source

    # File lib/soap/rpc/router.rb, line 61
    def add_headerhandler(handler)
      @headerhandler.add(handler)
    end

add_method(receiver, qname, soapaction, name, param_def, opt = {}) click to toggle source
Alias for: add_rpc_operation
add_request_headerhandler(factory) click to toggle source

header handler interface

    # File lib/soap/rpc/router.rb, line 54
    def add_request_headerhandler(factory)
      unless factory.respond_to?(:create)
        raise TypeError.new("factory must respond to 'create'")
      end
      @headerhandlerfactory << factory
    end

add_rpc_method(receiver, qname, soapaction, name, param_def, opt = {}) click to toggle source
Alias for: add_rpc_operation
add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {}) click to toggle source

operation definition interface

    # File lib/soap/rpc/router.rb, line 102
    def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
      ensure_styleuse_option(opt, :rpc, :encoded)
      opt[:request_qname] = qname
      op = ApplicationScopeOperation.new(soapaction, receiver, name, param_def,
        opt)
      if opt[:request_style] != :rpc
        raise RPCRoutingError.new("illegal request_style given")
      end
      assign_operation(soapaction, qname, op)
    end

Also aliased as: add_method, add_rpc_method
add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {}) click to toggle source

    # File lib/soap/rpc/router.rb, line 115
    def add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {})
      ensure_styleuse_option(opt, :rpc, :encoded)
      opt[:request_qname] = qname
      op = RequestScopeOperation.new(soapaction, factory, name, param_def, opt)
      if opt[:request_style] != :rpc
        raise RPCRoutingError.new("illegal request_style given")
      end
      assign_operation(soapaction, qname, op)
    end

add_rpc_request_servant(factory, namespace) click to toggle source

servant definition interface

    # File lib/soap/rpc/router.rb, line 68
    def add_rpc_request_servant(factory, namespace)
      unless factory.respond_to?(:create)
        raise TypeError.new("factory must respond to 'create'")
      end
      obj = factory.create        # a dummy instance for introspection
      ::SOAP::RPC.defined_methods(obj).each do |name|
        begin
          qname = XSD::QName.new(namespace, name)
          param_def = ::SOAP::RPC::SOAPMethod.derive_rpc_param_def(obj, name)
          opt = create_styleuse_option(:rpc, :encoded)
          add_rpc_request_operation(factory, qname, nil, name, param_def, opt)
        rescue SOAP::RPC::MethodDefinitionError => e
          p e if $DEBUG
        end
      end
    end

add_rpc_servant(obj, namespace) click to toggle source

    # File lib/soap/rpc/router.rb, line 85
    def add_rpc_servant(obj, namespace)
      ::SOAP::RPC.defined_methods(obj).each do |name|
        begin
          qname = XSD::QName.new(namespace, name)
          param_def = ::SOAP::RPC::SOAPMethod.derive_rpc_param_def(obj, name)
          opt = create_styleuse_option(:rpc, :encoded)
          add_rpc_operation(obj, qname, nil, name, param_def, opt)
        rescue SOAP::RPC::MethodDefinitionError => e
          p e if $DEBUG
        end
      end
    end

Also aliased as: add_servant
add_servant(obj, namespace) click to toggle source
Alias for: add_rpc_servant
create_fault_response(e) click to toggle source

Create fault response string.

    # File lib/soap/rpc/router.rb, line 200
    def create_fault_response(e)
      env = SOAPEnvelope.new(SOAPHeader.new, SOAPBody.new(fault(e, nil), true))
      opt = {}
      opt[:external_content] = nil
      @filterchain.reverse_each do |filter|
        env = filter.on_outbound(env, opt)
        break unless env
      end
      response_string = Processor.marshal(env, opt)
      conn_data = StreamHandler::ConnectionData.new(response_string)
      conn_data.is_fault = true
      if ext = opt[:external_content]
        mimeize(conn_data, ext)
      end
      conn_data
    end

route(conn_data) click to toggle source

    # File lib/soap/rpc/router.rb, line 159
    def route(conn_data)
      # we cannot set request_default_encodingsyle before parsing the content.
      env = unmarshal(conn_data)
      if env.nil?
        raise ArgumentError.new("illegal SOAP marshal format")
      end
      op = lookup_operation(conn_data.soapaction, env.body)
      headerhandler = @headerhandler.dup
      @headerhandlerfactory.each do |f|
        headerhandler.add(f.create)
      end
      soap_response = default_encodingstyle = nil
      begin
        receive_headers(headerhandler, env.header)
        soap_response =
          op.call(env.body, @mapping_registry, @literal_mapping_registry,
            create_mapping_opt)
        conn_data.is_fault = true if soap_response.is_a?(SOAPFault)
        default_encodingstyle = op.response_default_encodingstyle
      rescue Exception => e
        # If a wsdl fault was raised by service, the fault declaration details
        # is kept in wsdl_fault. Otherwise (exception is a program fault)
        # wsdl_fault is nil
        wsdl_fault_details = op.faults && op.faults[e.class.name]
        soap_response = fault(e, wsdl_fault_details)
        conn_data.is_fault = true
        default_encodingstyle = nil
      end
      header = call_headers(headerhandler)
      if op.response_use.nil?
        conn_data.send_string = ''
        conn_data.is_nocontent = true
        conn_data
      else
        body = SOAPBody.new(soap_response, conn_data.is_fault)
        env = SOAPEnvelope.new(header, body)
        marshal(conn_data, env, default_encodingstyle)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.