Class: SOAP::RPC::Router::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/soap/rpc/router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(soapaction, name, param_def, opt) ⇒ Operation

Returns a new instance of Operation.



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/soap/rpc/router.rb', line 407

def initialize(soapaction, name, param_def, opt)
  @soapaction = soapaction
  @name = name
  @request_style = opt[:request_style]
  @response_style = opt[:response_style]
  @request_use = opt[:request_use]
  @response_use = opt[:response_use]
  @faults = opt[:faults]
  check_style(@request_style)
  check_style(@response_style)
  check_use(@request_use)
  check_use(@response_use)
  if @response_style == :rpc
    request_qname = opt[:request_qname] or raise
    @rpc_method_factory =
      RPC::SOAPMethodRequest.new(request_qname, param_def, @soapaction)
    @rpc_response_qname = opt[:response_qname]
  else
    @doc_request_qnames = []
    @doc_response_qnames = []
    param_def.each do |param|
      param = MethodDef.to_param(param)
      case param.io_type
      when SOAPMethod::IN
        @doc_request_qnames << param.qname
      when SOAPMethod::OUT
        @doc_response_qnames << param.qname
      else
        raise ArgumentError.new(
          "illegal inout definition for document style: #{param.io_type}")
      end
    end
  end
end

Instance Attribute Details

#faultsObject (readonly)

Returns the value of attribute faults.



405
406
407
# File 'lib/soap/rpc/router.rb', line 405

def faults
  @faults
end

#nameObject (readonly)

Returns the value of attribute name.



399
400
401
# File 'lib/soap/rpc/router.rb', line 399

def name
  @name
end

#request_styleObject (readonly)

Returns the value of attribute request_style.



401
402
403
# File 'lib/soap/rpc/router.rb', line 401

def request_style
  @request_style
end

#request_useObject (readonly)

Returns the value of attribute request_use.



403
404
405
# File 'lib/soap/rpc/router.rb', line 403

def request_use
  @request_use
end

#response_styleObject (readonly)

Returns the value of attribute response_style.



402
403
404
# File 'lib/soap/rpc/router.rb', line 402

def response_style
  @response_style
end

#response_useObject (readonly)

Returns the value of attribute response_use.



404
405
406
# File 'lib/soap/rpc/router.rb', line 404

def response_use
  @response_use
end

#soapactionObject (readonly)

Returns the value of attribute soapaction.



400
401
402
# File 'lib/soap/rpc/router.rb', line 400

def soapaction
  @soapaction
end

Instance Method Details

#call(body, mapping_registry, literal_mapping_registry, opt) ⇒ Object



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/soap/rpc/router.rb', line 450

def call(body, mapping_registry, literal_mapping_registry, opt)
  if @request_style == :rpc
    values = request_rpc(body, mapping_registry, literal_mapping_registry,
      opt)
  else
    values = request_document(body, mapping_registry,
      literal_mapping_registry, opt)
  end
  result = receiver.method(@name.intern).call(*values)
  return result if result.is_a?(SOAPFault)
  if @response_style == :rpc
    response_rpc(result, mapping_registry, literal_mapping_registry, opt)
  elsif @doc_response_qnames.empty?
    # nothing to do
  else
    response_doc(result, mapping_registry, literal_mapping_registry, opt)
  end
end

#request_default_encodingstyleObject



442
443
444
# File 'lib/soap/rpc/router.rb', line 442

def request_default_encodingstyle
  (@request_use == :encoded) ? EncodingNamespace : LiteralNamespace
end

#response_default_encodingstyleObject



446
447
448
# File 'lib/soap/rpc/router.rb', line 446

def response_default_encodingstyle
  (@response_use == :encoded) ? EncodingNamespace : LiteralNamespace
end