SOAP::RPC::Proxy (Class)

In: soap/rpc/proxy.rb
Parent: Object

Methods

Attributes

allow_unqualified_element  [RW] 
default_encodingstyle  [RW] 
mandatorycharset  [RW] 
method  [R] 
soapaction  [RW] 

Classes and Modules

Class SOAP::RPC::Proxy::Request

Included Modules

Public Class methods

[Source]

# File soap/rpc/proxy.rb, line 32
  def initialize(streamhandler, soapaction = nil)
    @streamhandler = streamhandler
    @soapaction = soapaction
    @method = {}
    @mandatorycharset = nil
    @allow_unqualified_element = false
    @default_encodingstyle = nil
  end

Public Instance methods

[Source]

# File soap/rpc/proxy.rb, line 70
  def add_method(qname, soapaction, name, param_def)
    @method[name] = SOAPMethodRequest.new(qname, param_def, soapaction)
  end

[Source]

# File soap/rpc/proxy.rb, line 106
  def call(headers, name, *values)
    req = create_request(name, *values)
    return invoke(headers, req.method, req.method.soapaction || @soapaction)
  end

[Source]

# File soap/rpc/proxy.rb, line 111
  def check_fault(body)
    if body.fault
      raise SOAP::FaultError.new(body.fault)
    end
  end

[Source]

# File soap/rpc/proxy.rb, line 74
  def create_request(name, *values)
    if (@method.key?(name))
      method = @method[name]
      method.encodingstyle = @default_encodingstyle if @default_encodingstyle
    else
      raise SOAP::RPC::MethodDefinitionError.new(
        "Method: #{ name } not defined.")
    end

    Request.new(method, values)
  end

[Source]

# File soap/rpc/proxy.rb, line 86
  def invoke(req_header, req_body, soapaction = nil)
    if req_header and !req_header.is_a?(SOAPHeader)
      req_header = create_header(req_header)
    end
    if !req_body.is_a?(SOAPBody)
      req_body = SOAPBody.new(req_body)
    end
    opt = create_options
    send_string = Processor.marshal(req_header, req_body, opt)
    data = @streamhandler.send(send_string, soapaction)
    if data.receive_string.empty?
      return nil, nil
    end
    opt = create_options
    opt[:charset] = @mandatorycharset ||
      StreamHandler.parse_media_type(data.receive_contenttype)
    res_header, res_body = Processor.unmarshal(data.receive_string, opt)
    return res_header, res_body
  end

[Validate]