Class: SOAP::WSDLDriver::Servant__

Inherits:
Object
  • Object
show all
Includes:
SOAP
Defined in:
lib/soap/wsdlDriver.rb

Constant Summary

Constants included from SOAP

AttrActor, AttrArrayType, AttrArrayTypeName, AttrEncodingStyle, AttrEncodingStyleName, AttrMustUnderstand, AttrMustUnderstandName, AttrOffset, AttrOffsetName, AttrPosition, AttrPositionName, AttrRoot, AttrRootName, Base64Literal, EleBody, EleBodyName, EleEnvelope, EleEnvelopeName, EleFault, EleFaultActor, EleFaultActorName, EleFaultCode, EleFaultCodeName, EleFaultDetail, EleFaultDetailName, EleFaultName, EleFaultString, EleFaultStringName, EleHeader, EleHeaderName, EncodingNamespace, EnvelopeNamespace, LiteralNamespace, MediaType, NextActor, PropertyName, SOAPNamespaceTag, TypeMap, VERSION, ValueArray, ValueArrayName, XSDNamespaceTag, XSINamespaceTag

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, wsdl, port, logdev) ⇒ Servant__

Returns a new instance of Servant__.



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/soap/wsdlDriver.rb', line 266

def initialize(host, wsdl, port, logdev)
  @host = host
  @wsdl = wsdl
  @port = port
  @logdev = logdev
  @soapaction = nil
  @options = setup_options
  @default_encodingstyle = nil
  @allow_unqualified_element = nil
  @generate_explicit_type = false
  @mapping_registry = nil		# for rpc unmarshal
  @wsdl_mapping_registry = nil	# for rpc marshal
  @wiredump_file_base = nil
  @mandatorycharset = nil
  @wsdl_elements = @wsdl.collect_elements
  @wsdl_types = @wsdl.collect_complextypes + @wsdl.collect_simpletypes
  @rpc_decode_typemap = @wsdl_types +
	@wsdl.soap_rpc_complextypes(port.find_binding)
  @wsdl_mapping_registry = Mapping::WSDLEncodedRegistry.new(
    @rpc_decode_typemap)
  @doc_mapper = Mapping::WSDLLiteralRegistry.new(
    @wsdl_types, @wsdl_elements)
  endpoint_url = @port.soap_address.location
  # Convert a map which key is QName, to a Hash which key is String.
  @operation = {}
  @port.inputoperation_map.each do |op_name, op_info|
    orgname = op_name.name
    name = XSD::CodeGen::GenSupport.safemethodname(orgname)
	@operation[name] = @operation[orgname] = op_info
	add_method_interface(op_info)
  end
  @proxy = ::SOAP::RPC::Proxy.new(endpoint_url, @soapaction, @options)
end

Instance Attribute Details

#allow_unqualified_elementObject

Returns the value of attribute allow_unqualified_element



261
262
263
# File 'lib/soap/wsdlDriver.rb', line 261

def allow_unqualified_element
  @allow_unqualified_element
end

#default_encodingstyleObject

Returns the value of attribute default_encodingstyle



260
261
262
# File 'lib/soap/wsdlDriver.rb', line 260

def default_encodingstyle
  @default_encodingstyle
end

#generate_explicit_typeObject

Returns the value of attribute generate_explicit_type



262
263
264
# File 'lib/soap/wsdlDriver.rb', line 262

def generate_explicit_type
  @generate_explicit_type
end

#mapping_registryObject

Returns the value of attribute mapping_registry



263
264
265
# File 'lib/soap/wsdlDriver.rb', line 263

def mapping_registry
  @mapping_registry
end

#optionsObject (readonly)

Returns the value of attribute options



256
257
258
# File 'lib/soap/wsdlDriver.rb', line 256

def options
  @options
end

#portObject (readonly)

Returns the value of attribute port



257
258
259
# File 'lib/soap/wsdlDriver.rb', line 257

def port
  @port
end

#soapactionObject

Returns the value of attribute soapaction



259
260
261
# File 'lib/soap/wsdlDriver.rb', line 259

def soapaction
  @soapaction
end

#wsdl_mapping_registryObject

Returns the value of attribute wsdl_mapping_registry



264
265
266
# File 'lib/soap/wsdlDriver.rb', line 264

def wsdl_mapping_registry
  @wsdl_mapping_registry
end

Instance Method Details

#document_send(name, header_obj, body_obj) ⇒ Object

req_header: [[element, mustunderstand, encodingstyle(QName/String)], …] req_body: SOAPBasetype/SOAPCompoundtype

Raises:



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/soap/wsdlDriver.rb', line 361

def document_send(name, header_obj, body_obj)
  set_wiredump_file_base(name)
  unless op_info = @operation[name]
    raise RuntimeError, "method: #{name} not defined"
  end
  req_header = header_obj ? header_from_obj(header_obj, op_info) : nil
  req_body = body_from_obj(body_obj, op_info)
  opt = create_options({
    :soapaction => op_info.soapaction || @soapaction,
    :decode_typemap => @wsdl_types})
  env = @proxy.invoke(req_header, req_body, opt)
  raise EmptyResponseError unless env
  if env.body.fault
	raise ::SOAP::FaultError.new(env.body.fault)
  end
  res_body_obj = env.body.response ?
	Mapping.soap2obj(env.body.response, @mapping_registry) : nil
  return env.header, res_body_obj
end

#endpoint_urlObject



304
305
306
# File 'lib/soap/wsdlDriver.rb', line 304

def endpoint_url
  @proxy.endpoint_url
end

#endpoint_url=(endpoint_url) ⇒ Object



308
309
310
# File 'lib/soap/wsdlDriver.rb', line 308

def endpoint_url=(endpoint_url)
  @proxy.endpoint_url = endpoint_url
end

#headerhandlerObject



312
313
314
# File 'lib/soap/wsdlDriver.rb', line 312

def headerhandler
  @proxy.headerhandler
end

#inspectObject



300
301
302
# File 'lib/soap/wsdlDriver.rb', line 300

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

#reset_streamObject



324
325
326
# File 'lib/soap/wsdlDriver.rb', line 324

def reset_stream
  @proxy.reset_stream
end

#rpc_call(name, *values) ⇒ Object

Raises:



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/soap/wsdlDriver.rb', line 328

def rpc_call(name, *values)
  set_wiredump_file_base(name)
  unless op_info = @operation[name]
    raise RuntimeError, "method: #{name} not defined"
  end
  req_header = create_request_header
  req_body = create_request_body(op_info, *values)
  reqopt = create_options({
    :soapaction => op_info.soapaction || @soapaction})
  resopt = create_options({
    :decode_typemap => @rpc_decode_typemap})
  env = @proxy.route(req_header, req_body, reqopt, resopt)
  raise EmptyResponseError 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

#streamhandlerObject



316
317
318
# File 'lib/soap/wsdlDriver.rb', line 316

def streamhandler
  @proxy.streamhandler
end

#test_loopback_responseObject



320
321
322
# File 'lib/soap/wsdlDriver.rb', line 320

def test_loopback_response
  @proxy.test_loopback_response
end