Class: SOAP::WSDLDriver::Servant__

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

Constant Summary

Constants included from SOAP

AttrActor, AttrActorName, AttrArrayType, AttrArrayTypeName, AttrEncodingStyle, AttrEncodingStyleName, AttrHref, AttrHrefName, AttrId, AttrIdName, AttrMustUnderstand, AttrMustUnderstandName, AttrOffset, AttrOffsetName, AttrPosition, AttrPositionName, AttrRoot, AttrRootName, Base64Literal, Charset, EleBody, EleBodyName, EleEnvelope, EleEnvelopeName, EleFault, EleFaultActor, EleFaultActorName, EleFaultCode, EleFaultCodeName, EleFaultDetail, EleFaultDetailName, EleFaultName, EleFaultString, EleFaultStringName, EleHeader, EleHeaderName, EncodingNamespace, EnvelopeNamespace, LiteralNamespace, MediaType, NextActor, PropertyName, RPCRouter, RPCServerException, RPCUtils, SOAPGenerator, SOAPProxy, TypeMap, VERSION, ValueArray, ValueArrayName

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Servant__.



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/soap/wsdlDriver.rb', line 287

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.



282
283
284
# File 'lib/soap/wsdlDriver.rb', line 282

def allow_unqualified_element
  @allow_unqualified_element
end

#default_encodingstyleObject

Returns the value of attribute default_encodingstyle.



281
282
283
# File 'lib/soap/wsdlDriver.rb', line 281

def default_encodingstyle
  @default_encodingstyle
end

#generate_explicit_typeObject

Returns the value of attribute generate_explicit_type.



283
284
285
# File 'lib/soap/wsdlDriver.rb', line 283

def generate_explicit_type
  @generate_explicit_type
end

#mapping_registryObject

Returns the value of attribute mapping_registry.



284
285
286
# File 'lib/soap/wsdlDriver.rb', line 284

def mapping_registry
  @mapping_registry
end

#optionsObject (readonly)

Returns the value of attribute options.



277
278
279
# File 'lib/soap/wsdlDriver.rb', line 277

def options
  @options
end

#portObject (readonly)

Returns the value of attribute port.



278
279
280
# File 'lib/soap/wsdlDriver.rb', line 278

def port
  @port
end

#soapactionObject

Returns the value of attribute soapaction.



280
281
282
# File 'lib/soap/wsdlDriver.rb', line 280

def soapaction
  @soapaction
end

#wsdl_mapping_registryObject

Returns the value of attribute wsdl_mapping_registry.



285
286
287
# File 'lib/soap/wsdlDriver.rb', line 285

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:



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/soap/wsdlDriver.rb', line 382

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



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

def endpoint_url
  @proxy.endpoint_url
end

#endpoint_url=(endpoint_url) ⇒ Object



329
330
331
# File 'lib/soap/wsdlDriver.rb', line 329

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

#headerhandlerObject



333
334
335
# File 'lib/soap/wsdlDriver.rb', line 333

def headerhandler
  @proxy.headerhandler
end

#inspectObject



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

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

#reset_streamObject



345
346
347
# File 'lib/soap/wsdlDriver.rb', line 345

def reset_stream
  @proxy.reset_stream
end

#rpc_call(name, *values) ⇒ Object

Raises:



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/soap/wsdlDriver.rb', line 349

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



337
338
339
# File 'lib/soap/wsdlDriver.rb', line 337

def streamhandler
  @proxy.streamhandler
end

#test_loopback_responseObject



341
342
343
# File 'lib/soap/wsdlDriver.rb', line 341

def test_loopback_response
  @proxy.test_loopback_response
end