Class SOAP::RPC::Driver::Servant__
In: soap/rpc/driver.rb
Parent: Object

Methods

Attributes

headerhandler  [R] 
options  [R] 
proxy  [R] 
streamhandler  [R] 

Public Class methods

[Source]

# File soap/rpc/driver.rb, line 147
    def initialize(host, endpoint_url, namespace)
      @host = host
      @namespace = namespace
      @mapping_registry = nil
      @soapaction = nil
      @wiredump_file_base = nil
      @options = setup_options
      @streamhandler = HTTPPostStreamHandler.new(endpoint_url,
        @options["protocol.http"] ||= ::SOAP::Property.new)
      @headerhandler = Header::HandlerSet.new
      @proxy = Proxy.new(@streamhandler, @soapaction)
      @proxy.allow_unqualified_element = true
    end

Public Instance methods

[Source]

# File soap/rpc/driver.rb, line 233
    def add_method(name_as, soapaction, name, param_def)
      qname = XSD::QName.new(@namespace, name_as)
      @proxy.add_method(qname, soapaction, name, param_def)
      add_rpc_method_interface(name, param_def)
    end

[Source]

# File soap/rpc/driver.rb, line 239
    def add_rpc_method_interface(name, param_def)
      param_names = []
      i = 0
      @proxy.method[name].each_param_name(RPC::SOAPMethod::IN,
          RPC::SOAPMethod::INOUT) do |param_name|
        i += 1
        param_names << "arg#{ i }"
      end
      callparam = (param_names.collect { |pname| ", " + pname }).join
      @host.instance_eval "def \#{ name }(\#{ param_names.join(\", \") })\n@servant.call(\#{ name.dump }\#{ callparam })\nend\n"
      @host.method(name)
    end

[Source]

# File soap/rpc/driver.rb, line 208
    def call(name, *params)
      set_wiredump_file_base(name)
      # Convert parameters: params array => SOAPArray => members array

      params = Mapping.obj2soap(params, @mapping_registry).to_a
      env = @proxy.call(call_headers, name, *params)
      raise EmptyResponseError.new("Empty response.") unless env
      receive_headers(env.header)
      begin
        @proxy.check_fault(env.body)
      rescue SOAP::FaultError => e
        Mapping.fault2exception(e)
      end

      ret = env.body.response ?

        Mapping.soap2obj(env.body.response, @mapping_registry) : nil
      if env.body.outparams
        outparams = env.body.outparams.collect { |outparam|
          Mapping.soap2obj(outparam)
        }
        return [ret].concat(outparams)
      else
        return ret
      end
    end

[Source]

# File soap/rpc/driver.rb, line 186
    def default_encodingstyle
      @proxy.default_encodingstyle
    end

[Source]

# File soap/rpc/driver.rb, line 190
    def default_encodingstyle=(encodingstyle)
      @proxy.default_encodingstyle = encodingstyle
    end

[Source]

# File soap/rpc/driver.rb, line 161
    def endpoint_url
      @streamhandler.endpoint_url
    end

[Source]

# File soap/rpc/driver.rb, line 165
    def endpoint_url=(endpoint_url)
      @streamhandler.endpoint_url = endpoint_url
      @streamhandler.reset
    end

[Source]

# File soap/rpc/driver.rb, line 198
    def invoke(headers, body)
      set_wiredump_file_base(body.elename.name)
      env = @proxy.invoke(headers, body)
      if env.nil?
        return nil, nil
      else
        return env.header, env.body
      end
    end

[Source]

# File soap/rpc/driver.rb, line 170
    def mapping_registry
      @mapping_registry
    end

[Source]

# File soap/rpc/driver.rb, line 174
    def mapping_registry=(mapping_registry)
      @mapping_registry = mapping_registry
    end

[Source]

# File soap/rpc/driver.rb, line 178
    def soapaction
      @soapaction
    end

[Source]

# File soap/rpc/driver.rb, line 182
    def soapaction=(soapaction)
      @soapaction = soapaction
    end

[Source]

# File soap/rpc/driver.rb, line 194
    def test_loopback_response
      @streamhandler.test_loopback_response
    end

[Validate]