Class: SOAP::RPC::Proxy::Operation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(soapaction, param_def, opt) ⇒ Operation

Returns a new instance of Operation.



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/soap/rpc/proxy.rb', line 362

def initialize(soapaction, param_def, opt)
  @soapaction = soapaction
  @request_style = opt[:request_style]
  @response_style = opt[:response_style]
  @request_use = opt[:request_use]
  @response_use = opt[:response_use]
  @use_default_namespace =
    opt[:use_default_namespace] || opt[:elementformdefault]
  if opt.key?(:elementformdefault)
    warn("option :elementformdefault is deprecated.  use :use_default_namespace instead")
  end
  check_style(@request_style)
  check_style(@response_style)
  check_use(@request_use)
  check_use(@response_use)
  if @request_style == :rpc
    @rpc_request_qname = opt[:request_qname]
    if @rpc_request_qname.nil?
      raise MethodDefinitionError.new("rpc_request_qname must be given")
    end
    @rpc_method_factory =
      RPC::SOAPMethodRequest.new(@rpc_request_qname, param_def, @soapaction)
  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 MethodDefinitionError.new(
          "illegal inout definition for document style: #{param.io_type}")
      end
    end
  end
end

Instance Attribute Details

#request_styleObject (readonly)

Returns the value of attribute request_style.



356
357
358
# File 'lib/soap/rpc/proxy.rb', line 356

def request_style
  @request_style
end

#request_useObject (readonly)

Returns the value of attribute request_use.



358
359
360
# File 'lib/soap/rpc/proxy.rb', line 358

def request_use
  @request_use
end

#response_styleObject (readonly)

Returns the value of attribute response_style.



357
358
359
# File 'lib/soap/rpc/proxy.rb', line 357

def response_style
  @response_style
end

#response_useObject (readonly)

Returns the value of attribute response_use.



359
360
361
# File 'lib/soap/rpc/proxy.rb', line 359

def response_use
  @response_use
end

#soapactionObject (readonly)

Returns the value of attribute soapaction.



355
356
357
# File 'lib/soap/rpc/proxy.rb', line 355

def soapaction
  @soapaction
end

#use_default_namespaceObject (readonly)

Returns the value of attribute use_default_namespace.



360
361
362
# File 'lib/soap/rpc/proxy.rb', line 360

def use_default_namespace
  @use_default_namespace
end

Instance Method Details

#raise_fault(e, mapping_registry, literal_mapping_registry) ⇒ Object



427
428
429
430
431
432
433
# File 'lib/soap/rpc/proxy.rb', line 427

def raise_fault(e, mapping_registry, literal_mapping_registry)
  if @response_style == :rpc
    Mapping.fault2exception(e, mapping_registry)
  else
    Mapping.fault2exception(e, literal_mapping_registry)
  end
end

#request_body(values, mapping_registry, literal_mapping_registry, opt) ⇒ Object



410
411
412
413
414
415
416
# File 'lib/soap/rpc/proxy.rb', line 410

def request_body(values, mapping_registry, literal_mapping_registry, opt)
  if @request_style == :rpc
    request_rpc(values, mapping_registry, literal_mapping_registry, opt)
  else
    request_doc(values, mapping_registry, literal_mapping_registry, opt)
  end
end

#request_default_encodingstyleObject



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

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

#response_default_encodingstyleObject



406
407
408
# File 'lib/soap/rpc/proxy.rb', line 406

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

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



418
419
420
421
422
423
424
425
# File 'lib/soap/rpc/proxy.rb', line 418

def response_obj(body, mapping_registry, literal_mapping_registry, opt)
  if @response_style == :rpc
    response_rpc(body, mapping_registry, literal_mapping_registry, opt)
  else
    unique_result_for_one_element_array(
      response_doc(body, mapping_registry, literal_mapping_registry, opt))
  end
end