# File lib/soap/rpc/proxy.rb, line 356 356: def initialize(soapaction, param_def, opt) 357: @soapaction = soapaction 358: @request_style = opt[:request_style] 359: @response_style = opt[:response_style] 360: @request_use = opt[:request_use] 361: @response_use = opt[:response_use] 362: @use_default_namespace = 363: opt[:use_default_namespace] || opt[:elementformdefault] 364: if opt.key?(:elementformdefault) 365: warn("option :elementformdefault is deprecated. use :use_default_namespace instead") 366: end 367: check_style(@request_style) 368: check_style(@response_style) 369: check_use(@request_use) 370: check_use(@response_use) 371: if @request_style == :rpc 372: @rpc_request_qname = opt[:request_qname] 373: if @rpc_request_qname.nil? 374: raise MethodDefinitionError.new("rpc_request_qname must be given") 375: end 376: @rpc_method_factory = 377: RPC::SOAPMethodRequest.new(@rpc_request_qname, param_def, @soapaction) 378: else 379: @doc_request_qnames = [] 380: @doc_request_qualified = [] 381: @doc_response_qnames = [] 382: @doc_response_qualified = [] 383: param_def.each do |inout, paramname, typeinfo, eleinfo| 384: klass_not_used, nsdef, namedef = typeinfo 385: qualified = eleinfo 386: if namedef.nil? 387: raise MethodDefinitionError.new("qname must be given") 388: end 389: case inout 390: when SOAPMethod::IN 391: @doc_request_qnames << XSD::QName.new(nsdef, namedef) 392: @doc_request_qualified << qualified 393: when SOAPMethod::OUT 394: @doc_response_qnames << XSD::QName.new(nsdef, namedef) 395: @doc_response_qualified << qualified 396: else 397: raise MethodDefinitionError.new( 398: "illegal inout definition for document style: #{inout}") 399: end 400: end 401: end 402: end
# File lib/soap/rpc/proxy.rb, line 429 429: def raise_fault(e, mapping_registry, literal_mapping_registry) 430: if @response_style == :rpc 431: Mapping.fault2exception(e, mapping_registry) 432: else 433: Mapping.fault2exception(e, literal_mapping_registry) 434: end 435: end
# File lib/soap/rpc/proxy.rb, line 412 412: def request_body(values, mapping_registry, literal_mapping_registry, opt) 413: if @request_style == :rpc 414: request_rpc(values, mapping_registry, literal_mapping_registry, opt) 415: else 416: request_doc(values, mapping_registry, literal_mapping_registry, opt) 417: end 418: end
# File lib/soap/rpc/proxy.rb, line 404 404: def request_default_encodingstyle 405: (@request_use == :encoded) ? EncodingNamespace : LiteralNamespace 406: end
# File lib/soap/rpc/proxy.rb, line 408 408: def response_default_encodingstyle 409: (@response_use == :encoded) ? EncodingNamespace : LiteralNamespace 410: end
# File lib/soap/rpc/proxy.rb, line 420 420: def response_obj(body, mapping_registry, literal_mapping_registry, opt) 421: if @response_style == :rpc 422: response_rpc(body, mapping_registry, literal_mapping_registry, opt) 423: else 424: unique_result_for_one_element_array( 425: response_doc(body, mapping_registry, literal_mapping_registry, opt)) 426: end 427: end
# File lib/soap/rpc/proxy.rb, line 444 444: def check_style(style) 445: unless [:rpc, :document].include?(style) 446: raise MethodDefinitionError.new("unknown style: #{style}") 447: end 448: end
nil means oneway
# File lib/soap/rpc/proxy.rb, line 451 451: def check_use(use) 452: unless [:encoded, :literal, nil].include?(use) 453: raise MethodDefinitionError.new("unknown use: #{use}") 454: end 455: end
# File lib/soap/rpc/proxy.rb, line 465 465: def request_doc(values, mapping_registry, literal_mapping_registry, opt) 466: if @request_use == :encoded 467: request_doc_enc(values, mapping_registry, opt) 468: else 469: request_doc_lit(values, literal_mapping_registry, opt) 470: end 471: end
# File lib/soap/rpc/proxy.rb, line 502 502: def request_doc_enc(values, mapping_registry, opt) 503: (0...values.size).collect { |idx| 504: ele = Mapping.obj2soap(values[idx], mapping_registry, nil, opt) 505: ele.elename = @doc_request_qnames[idx] 506: ele.qualified = @doc_request_qualified[idx] 507: ele 508: } 509: end
# File lib/soap/rpc/proxy.rb, line 511 511: def request_doc_lit(values, mapping_registry, opt) 512: (0...values.size).collect { |idx| 513: ele = Mapping.obj2soap(values[idx], mapping_registry, 514: @doc_request_qnames[idx], opt) 515: ele.encodingstyle = LiteralNamespace 516: ele.qualified = @doc_request_qualified[idx] 517: ele 518: } 519: end
# File lib/soap/rpc/proxy.rb, line 457 457: def request_rpc(values, mapping_registry, literal_mapping_registry, opt) 458: if @request_use == :encoded 459: request_rpc_enc(values, mapping_registry, opt) 460: else 461: request_rpc_lit(values, literal_mapping_registry, opt) 462: end 463: end
# File lib/soap/rpc/proxy.rb, line 473 473: def request_rpc_enc(values, mapping_registry, opt) 474: method = @rpc_method_factory.dup 475: names = method.input_params 476: types = method.input_param_types 477: ary = Mapping.objs2soap(values, mapping_registry, types, opt) 478: soap = {} 479: 0.upto(ary.length - 1) do |idx| 480: soap[names[idx]] = ary[idx] 481: end 482: method.set_param(soap) 483: method 484: end
# File lib/soap/rpc/proxy.rb, line 486 486: def request_rpc_lit(values, mapping_registry, opt) 487: method = @rpc_method_factory.dup 488: names = method.input_params 489: types = method.get_paramtypes(names) 490: params = {} 491: idx = 0 492: names.each do |name| 493: params[name] = Mapping.obj2soap(values[idx], mapping_registry, 494: types[idx], opt) 495: params[name].elename = XSD::QName.new(nil, name) 496: idx += 1 497: end 498: method.set_param(params) 499: method 500: end
# File lib/soap/rpc/proxy.rb, line 529 529: def response_doc(body, mapping_registry, literal_mapping_registry, opt) 530: if @response_use == :encoded 531: response_doc_enc(body, mapping_registry, opt) 532: else 533: response_doc_lit(body, literal_mapping_registry, opt) 534: end 535: end
# File lib/soap/rpc/proxy.rb, line 560 560: def response_doc_enc(body, mapping_registry, opt) 561: body.collect { |key, value| 562: Mapping.soap2obj(value, mapping_registry, nil, opt) 563: } 564: end
# File lib/soap/rpc/proxy.rb, line 566 566: def response_doc_lit(body, mapping_registry, opt) 567: body.collect { |key, value| 568: Mapping.soap2obj(value, mapping_registry) 569: } 570: end
# File lib/soap/rpc/proxy.rb, line 521 521: def response_rpc(body, mapping_registry, literal_mapping_registry, opt) 522: if @response_use == :encoded 523: response_rpc_enc(body, mapping_registry, opt) 524: else 525: response_rpc_lit(body, literal_mapping_registry, opt) 526: end 527: end
# File lib/soap/rpc/proxy.rb, line 537 537: def response_rpc_enc(body, mapping_registry, opt) 538: ret = nil 539: if body.response 540: ret = Mapping.soap2obj(body.response, mapping_registry, 541: @rpc_method_factory.retval_class_name, opt) 542: end 543: if body.outparams 544: outparams = body.outparams.collect { |outparam| 545: Mapping.soap2obj(outparam, mapping_registry, nil, opt) 546: } 547: [ret].concat(outparams) 548: else 549: ret 550: end 551: end
# File lib/soap/rpc/proxy.rb, line 553 553: def response_rpc_lit(body, mapping_registry, opt) 554: body.root_node.collect { |key, value| 555: Mapping.soap2obj(value, mapping_registry, 556: @rpc_method_factory.retval_class_name, opt) 557: } 558: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.