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.


342
343
344
345
346
347
348
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
379
# File 'lib/soap/rpc/router.rb', line 342

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]
  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_request_qualified = []
    @doc_response_qnames = []
    @doc_response_qualified = []
    param_def.each do |inout, paramname, typeinfo, eleinfo|
      klass, nsdef, namedef = typeinfo
      qualified = eleinfo
      case inout
      when SOAPMethod::IN
        @doc_request_qnames << XSD::QName.new(nsdef, namedef)
        @doc_request_qualified << qualified
      when SOAPMethod::OUT
        @doc_response_qnames << XSD::QName.new(nsdef, namedef)
        @doc_response_qualified << qualified
      else
        raise ArgumentError.new(
          "illegal inout definition for document style: #{inout}")
      end
    end
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


335
336
337
# File 'lib/soap/rpc/router.rb', line 335

def name
  @name
end

#request_styleObject (readonly)

Returns the value of attribute request_style


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

def request_style
  @request_style
end

#request_useObject (readonly)

Returns the value of attribute request_use


339
340
341
# File 'lib/soap/rpc/router.rb', line 339

def request_use
  @request_use
end

#response_styleObject (readonly)

Returns the value of attribute response_style


338
339
340
# File 'lib/soap/rpc/router.rb', line 338

def response_style
  @response_style
end

#response_useObject (readonly)

Returns the value of attribute response_use


340
341
342
# File 'lib/soap/rpc/router.rb', line 340

def response_use
  @response_use
end

#soapactionObject (readonly)

Returns the value of attribute soapaction


336
337
338
# File 'lib/soap/rpc/router.rb', line 336

def soapaction
  @soapaction
end

Instance Method Details

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


389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/soap/rpc/router.rb', line 389

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)
  else
    response_doc(result, mapping_registry, literal_mapping_registry, opt)
  end
end

#request_default_encodingstyleObject


381
382
383
# File 'lib/soap/rpc/router.rb', line 381

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

#response_default_encodingstyleObject


385
386
387
# File 'lib/soap/rpc/router.rb', line 385

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