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.



282
283
284
285
286
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
320
321
322
323
324
325
326
# File 'lib/soap/rpc/proxy.rb', line 282

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]
  # set nil(unqualified) by default
  @elementformdefault = opt[:elementformdefault]
  @attributeformdefault = opt[:attributeformdefault]
  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_request_qualified = []
    @doc_response_qnames = []
    @doc_response_qualified = []
    param_def.each do |inout, paramname, typeinfo, eleinfo|
      klass_not_used, nsdef, namedef = typeinfo
      qualified = eleinfo
      if namedef.nil?
        raise MethodDefinitionError.new("qname must be given")
      end
      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 MethodDefinitionError.new(
          "illegal inout definition for document style: #{inout}")
      end
    end
  end
end

Instance Attribute Details

#attributeformdefaultObject (readonly)

Returns the value of attribute attributeformdefault



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

def attributeformdefault
  @attributeformdefault
end

#elementformdefaultObject (readonly)

Returns the value of attribute elementformdefault



279
280
281
# File 'lib/soap/rpc/proxy.rb', line 279

def elementformdefault
  @elementformdefault
end

#request_styleObject (readonly)

Returns the value of attribute request_style



275
276
277
# File 'lib/soap/rpc/proxy.rb', line 275

def request_style
  @request_style
end

#request_useObject (readonly)

Returns the value of attribute request_use



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

def request_use
  @request_use
end

#response_styleObject (readonly)

Returns the value of attribute response_style



276
277
278
# File 'lib/soap/rpc/proxy.rb', line 276

def response_style
  @response_style
end

#response_useObject (readonly)

Returns the value of attribute response_use



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

def response_use
  @response_use
end

#soapactionObject (readonly)

Returns the value of attribute soapaction



274
275
276
# File 'lib/soap/rpc/proxy.rb', line 274

def soapaction
  @soapaction
end

Instance Method Details

#raise_fault(e, mapping_registry, literal_mapping_registry) ⇒ Object



352
353
354
355
356
357
358
# File 'lib/soap/rpc/proxy.rb', line 352

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



336
337
338
339
340
341
342
# File 'lib/soap/rpc/proxy.rb', line 336

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



328
329
330
# File 'lib/soap/rpc/proxy.rb', line 328

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

#response_default_encodingstyleObject



332
333
334
# File 'lib/soap/rpc/proxy.rb', line 332

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

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



344
345
346
347
348
349
350
# File 'lib/soap/rpc/proxy.rb', line 344

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