Parent

Namespace

Included Modules

Files

Class/Module Index [+]

Quicksearch

SOAP::RPC::Proxy

Attributes

allow_unqualified_element[RW]
default_encodingstyle[RW]
filterchain[R]
generate_explicit_type[RW]
headerhandler[R]
literal_mapping_registry[RW]
mandatorycharset[RW]
mapping_registry[RW]
operation[R]
return_response_as_xml[RW]
soapaction[RW]
streamhandler[R]
use_default_namespace[RW]

Public Class Methods

new(endpoint_url, soapaction, options) click to toggle source
# File lib/soap/rpc/proxy.rb, line 46
def initialize(endpoint_url, soapaction, options)
  @endpoint_url = endpoint_url
  @soapaction = soapaction
  @options = options
  @protocol_option = options["protocol"] ||= ::SOAP::Property.new
  initialize_streamhandler(@protocol_option)
  @operation = {}
  @operation_by_qname = {}
  @operation_by_soapaction = {}
  @mandatorycharset = nil
  # TODO: set to false by default or drop thie option in 1.6.0
  @allow_unqualified_element = true
  @default_encodingstyle = nil
  @generate_explicit_type = true
  @use_default_namespace = false
  @return_response_as_xml = false
  @headerhandler = Header::HandlerSet.new
  @filterchain = Filter::FilterChain.new
  @mapping_registry = nil
  @literal_mapping_registry = ::SOAP::Mapping::LiteralRegistry.new
end

Public Instance Methods

add_document_method(soapaction, name, param_def, opt = {}) click to toggle source
add_document_operation(soapaction, name, param_def, opt = {}) click to toggle source
# File lib/soap/rpc/proxy.rb, line 100
def add_document_operation(soapaction, name, param_def, opt = {})
  ensure_styleuse_option(opt, :document, :literal)
  op = Operation.new(soapaction, param_def, opt)
  assign_operation(name, nil, soapaction, op)
end
Also aliased as: add_document_method
add_method(qname, soapaction, name, param_def, opt = {}) click to toggle source

add_method is for shortcut of typical rpc/encoded method definition.

Alias for: add_rpc_operation
add_rpc_method(qname, soapaction, name, param_def, opt = {}) click to toggle source
Alias for: add_rpc_operation
add_rpc_operation(qname, soapaction, name, param_def, opt = {}) click to toggle source
# File lib/soap/rpc/proxy.rb, line 93
def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
  ensure_styleuse_option(opt, :rpc, :encoded)
  opt[:request_qname] = qname
  op = Operation.new(soapaction, param_def, opt)
  assign_operation(name, qname, soapaction, op)
end
Also aliased as: add_method, add_rpc_method
call(name, *params) click to toggle source
# File lib/soap/rpc/proxy.rb, line 121
def call(name, *params)
  # name must be used only for lookup
  op_info = lookup_operation(name)
  mapping_opt = create_mapping_opt
  req_header = create_request_header
  req_body = SOAPBody.new(
    op_info.request_body(params, @mapping_registry,
      @literal_mapping_registry, mapping_opt)
  )
  reqopt = create_encoding_opt(
    :soapaction => op_info.soapaction || @soapaction,
    :envelopenamespace => @options["soap.envelope.requestnamespace"],
    :default_encodingstyle =>
      @default_encodingstyle || op_info.request_default_encodingstyle,
    :use_default_namespace =>
      op_info.use_default_namespace || @use_default_namespace
  )
  resopt = create_encoding_opt(
    :envelopenamespace => @options["soap.envelope.responsenamespace"],
    :default_encodingstyle =>
      @default_encodingstyle || op_info.response_default_encodingstyle
  )
  env = route(req_header, req_body, reqopt, resopt)
  if op_info.response_use.nil?
    return nil
  end
  raise EmptyResponseError unless env
  receive_headers(env.header)
  begin
    check_fault(env.body)
  rescue ::SOAP::FaultError => e
    op_info.raise_fault(e, @mapping_registry, @literal_mapping_registry)
  end
  if @return_response_as_xml
    resopt[:response_as_xml]
  else
    op_info.response_obj(env.body, @mapping_registry,
      @literal_mapping_registry, mapping_opt)
  end
end
check_fault(body) click to toggle source
# File lib/soap/rpc/proxy.rb, line 187
def check_fault(body)
  if body.fault
    raise SOAP::FaultError.new(body.fault)
  end
end
endpoint_url() click to toggle source
# File lib/soap/rpc/proxy.rb, line 72
def endpoint_url
  @endpoint_url
end
endpoint_url=(endpoint_url) click to toggle source
# File lib/soap/rpc/proxy.rb, line 76
def endpoint_url=(endpoint_url)
  @endpoint_url = endpoint_url
  reset_stream
end
inspect() click to toggle source
# File lib/soap/rpc/proxy.rb, line 68
def inspect
  "#<#{self.class}:#{@endpoint_url}>"
end
invoke(req_header, req_body, opt = nil) click to toggle source
# File lib/soap/rpc/proxy.rb, line 111
def invoke(req_header, req_body, opt = nil)
  opt ||= create_encoding_opt
  env = route(req_header, req_body, opt, opt)
  if @return_response_as_xml
    opt[:response_as_xml]
  else
    env
  end
end
reset_stream() click to toggle source
# File lib/soap/rpc/proxy.rb, line 81
def reset_stream
  @streamhandler.reset(@endpoint_url)
end
route(req_header, req_body, reqopt, resopt) click to toggle source
# File lib/soap/rpc/proxy.rb, line 162
def route(req_header, req_body, reqopt, resopt)
  req_env = ::SOAP::SOAPEnvelope.new(req_header, req_body)
  unless reqopt[:envelopenamespace].nil?
    set_envelopenamespace(req_env, reqopt[:envelopenamespace])
  end
  reqopt[:external_content] = nil
  conn_data = marshal(req_env, reqopt)
  if ext = reqopt[:external_content]
    mime = MIMEMessage.new
    ext.each do |k, v|
      mime.add_attachment(v.data)
    end
    mime.add_part(conn_data.send_string + "\r\n")
    mime.close
    conn_data.send_string = mime.content_str
    conn_data.send_contenttype = mime.headers['content-type'].str
  end
  conn_data = @streamhandler.send(@endpoint_url, conn_data,
    reqopt[:soapaction])
  if conn_data.receive_string.empty?
    return nil
  end
  unmarshal(conn_data, resopt)
end
set_wiredump_file_base(wiredump_file_base) click to toggle source
# File lib/soap/rpc/proxy.rb, line 85
def set_wiredump_file_base(wiredump_file_base)
  @streamhandler.wiredump_file_base = wiredump_file_base
end
test_loopback_response() click to toggle source
# File lib/soap/rpc/proxy.rb, line 89
def test_loopback_response
  @streamhandler.test_loopback_response
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.