Class: SOAP::RPC::Driver

Inherits:
Object show all
Includes:
AttrProxy
Defined in:
lib/soap/rpc/driver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttrProxy

included

Constructor Details

#initialize(endpoint_url, namespace = nil, soapaction = nil) ⇒ Driver

Returns a new instance of Driver.



82
83
84
85
86
87
88
# File 'lib/soap/rpc/driver.rb', line 82

def initialize(endpoint_url, namespace = nil, soapaction = nil)
  @namespace = namespace
  @soapaction = soapaction
  @options = setup_options
  @wiredump_file_base = nil
  @proxy = Proxy.new(endpoint_url, @soapaction, @options)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



43
44
45
# File 'lib/soap/rpc/driver.rb', line 43

def options
  @options
end

#proxyObject (readonly)

Returns the value of attribute proxy.



42
43
44
# File 'lib/soap/rpc/driver.rb', line 42

def proxy
  @proxy
end

#soapactionObject

Returns the value of attribute soapaction.



44
45
46
# File 'lib/soap/rpc/driver.rb', line 44

def soapaction
  @soapaction
end

Instance Method Details

#add_document_method(name, soapaction, req_qname, res_qname) ⇒ Object



121
122
123
124
125
# File 'lib/soap/rpc/driver.rb', line 121

def add_document_method(name, soapaction, req_qname, res_qname)
  param_def = SOAPMethod.create_doc_param_def(req_qname, res_qname)
  @proxy.add_document_method(soapaction, name, param_def)
  add_document_method_interface(name, param_def)
end

#add_document_operation(soapaction, name, param_def, opt = {}) ⇒ Object



132
133
134
135
# File 'lib/soap/rpc/driver.rb', line 132

def add_document_operation(soapaction, name, param_def, opt = {})
  @proxy.add_document_operation(soapaction, name, param_def, opt)
  add_document_method_interface(name, param_def)
end

#add_rpc_method(name, *params) ⇒ Object Also known as: add_method



96
97
98
# File 'lib/soap/rpc/driver.rb', line 96

def add_rpc_method(name, *params)
  add_rpc_method_with_soapaction_as(name, name, @soapaction, *params)
end

#add_rpc_method_as(name, name_as, *params) ⇒ Object Also known as: add_method_as



100
101
102
# File 'lib/soap/rpc/driver.rb', line 100

def add_rpc_method_as(name, name_as, *params)
  add_rpc_method_with_soapaction_as(name, name_as, @soapaction, *params)
end

#add_rpc_method_with_soapaction(name, soapaction, *params) ⇒ Object Also known as: add_method_with_soapaction



104
105
106
# File 'lib/soap/rpc/driver.rb', line 104

def add_rpc_method_with_soapaction(name, soapaction, *params)
  add_rpc_method_with_soapaction_as(name, name, soapaction, *params)
end

#add_rpc_method_with_soapaction_as(name, name_as, soapaction, *params) ⇒ Object Also known as: add_method_with_soapaction_as



108
109
110
111
112
113
# File 'lib/soap/rpc/driver.rb', line 108

def add_rpc_method_with_soapaction_as(name, name_as, soapaction, *params)
  param_def = SOAPMethod.create_rpc_param_def(params)
  qname = XSD::QName.new(@namespace, name_as)
  @proxy.add_rpc_method(qname, soapaction, name, param_def)
  add_rpc_method_interface(name, param_def)
end

#add_rpc_operation(qname, soapaction, name, param_def, opt = {}) ⇒ Object



127
128
129
130
# File 'lib/soap/rpc/driver.rb', line 127

def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
  @proxy.add_rpc_operation(qname, soapaction, name, param_def, opt)
  add_rpc_method_interface(name, param_def)
end

#call(name, *params) ⇒ Object



150
151
152
153
# File 'lib/soap/rpc/driver.rb', line 150

def call(name, *params)
  set_wiredump_file_base(name)
  @proxy.call(name, *params)
end

#httpproxyObject



50
51
52
# File 'lib/soap/rpc/driver.rb', line 50

def httpproxy
  options["protocol.http.proxy"]
end

#httpproxy=(httpproxy) ⇒ Object



54
55
56
# File 'lib/soap/rpc/driver.rb', line 54

def httpproxy=(httpproxy)
  options["protocol.http.proxy"] = httpproxy
end

#inspectObject



46
47
48
# File 'lib/soap/rpc/driver.rb', line 46

def inspect
  "#<#{self.class}:#{@proxy.inspect}>"
end

#invoke(headers, body) ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/soap/rpc/driver.rb', line 137

def invoke(headers, body)
  if headers and !headers.is_a?(SOAPHeader)
    headers = create_header(headers)
  end
  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

#loadproperty(propertyname) ⇒ Object



90
91
92
93
94
# File 'lib/soap/rpc/driver.rb', line 90

def loadproperty(propertyname)
  unless options.loadproperty(propertyname)
    raise LoadError.new("No such property to load -- #{propertyname}")
  end
end

#mandatorycharsetObject



66
67
68
# File 'lib/soap/rpc/driver.rb', line 66

def mandatorycharset
  options["protocol.mandatorycharset"]
end

#mandatorycharset=(mandatorycharset) ⇒ Object



70
71
72
# File 'lib/soap/rpc/driver.rb', line 70

def mandatorycharset=(mandatorycharset)
  options["protocol.mandatorycharset"] = mandatorycharset
end

#wiredump_devObject



58
59
60
# File 'lib/soap/rpc/driver.rb', line 58

def wiredump_dev
  options["protocol.http.wiredump_dev"]
end

#wiredump_dev=(wiredump_dev) ⇒ Object



62
63
64
# File 'lib/soap/rpc/driver.rb', line 62

def wiredump_dev=(wiredump_dev)
  options["protocol.http.wiredump_dev"] = wiredump_dev
end

#wiredump_file_baseObject



74
75
76
# File 'lib/soap/rpc/driver.rb', line 74

def wiredump_file_base
  options["protocol.wiredump_file_base"]
end

#wiredump_file_base=(wiredump_file_base) ⇒ Object



78
79
80
# File 'lib/soap/rpc/driver.rb', line 78

def wiredump_file_base=(wiredump_file_base)
  options["protocol.wiredump_file_base"] = wiredump_file_base
end