Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

root/trunk/test/wsdl/overload/expectedDriver.rb

Revision 2006, 1.8 kB (checked in by nahi, 1 year ago)
  • update tests for the previous change ('in' -> :in)
Line 
1 require 'default.rb'
2 require 'defaultMappingRegistry.rb'
3 require 'soap/rpc/driver'
4
5 class OverloadServicePortType < ::SOAP::RPC::Driver
6   DefaultEndpointUrl = "http://localhost/"
7   NsOverload = "urn:overload"
8
9   Methods = [
10     [ XSD::QName.new(NsOverload, "methodAlpha"),
11       "methodAlpha1",
12       "methodAlpha",
13       [ [:in, "in0", ["::SOAP::SOAPString"]],
14         [:in, "in1", ["::SOAP::SOAPString"]],
15         [:in, "in2", ["::SOAP::SOAPString"]],
16         [:retval, "methodAlphaReturn", ["::SOAP::SOAPLong"]] ],
17       { :request_style =>  :rpc, :request_use =>  :encoded,
18         :response_style => :rpc, :response_use => :encoded,
19         :faults => {} }
20     ],
21     [ XSD::QName.new(NsOverload, "methodAlpha"),
22       "methodAlpha2",
23       "methodAlpha_2",
24       [ [:in, "in0", ["::SOAP::SOAPString"]],
25         [:in, "in1", ["::SOAP::SOAPString"]],
26         [:retval, "methodAlphaReturn", ["::SOAP::SOAPLong"]] ],
27       { :request_style =>  :rpc, :request_use =>  :encoded,
28         :response_style => :rpc, :response_use => :encoded,
29         :faults => {} }
30     ]
31   ]
32
33   def initialize(endpoint_url = nil)
34     endpoint_url ||= DefaultEndpointUrl
35     super(endpoint_url, nil)
36     self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
37     self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
38     init_methods
39   end
40
41 private
42
43   def init_methods
44     Methods.each do |definitions|
45       opt = definitions.last
46       if opt[:request_style] == :document
47         add_document_operation(*definitions)
48       else
49         add_rpc_operation(*definitions)
50         qname = definitions[0]
51         name = definitions[2]
52         if qname.name != name and qname.name.capitalize == name.capitalize
53           ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
54             __send__(name, *arg)
55           end
56         end
57       end
58     end
59   end
60 end
61
Note: See TracBrowser for help on using the browser.