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

root/trunk/test/interopR2/clientBase.rb

Revision 1592, 48.7 kB (checked in by nahi, 3 years ago)

updated

  • Property svn:eol-style set to native
  • Property svn:keywords set to author date id revision
</
Line 
1 $KCODE = 'EUC'
2
3 require 'logger'
4 require 'soap/rpc/driver'
5 require 'soap/mapping'
6 require 'base'
7 require 'interopResultBase'
8
9 include SOAP
10 include SOAPBuildersInterop
11
12 $soapAction = 'http://soapinterop.org/'
13 $testResultServer = 'http://dev.ctor.org/soapsrv'
14 $testResultDrv = SOAP::RPC::Driver.new($testResultServer,
15   SOAPBuildersInteropResult::InterfaceNS)
16
17 SOAPBuildersInteropResult::Methods.each do |name, *params|
18   $testResultDrv.add_rpc_operation(
19       XSD::QName.new(SOAPBuildersInteropResult::InterfaceNS, name),
20       nil, name, params)
21 end
22
23 client = SOAPBuildersInteropResult::Endpoint.new
24 client.processorName = 'SOAP4R'
25 client.processorVersion = '1.5'
26 client.uri = '*:*'
27 client.wsdl = "#{$wsdlBase} #{$wsdlGroupB}"
28
29 server = SOAPBuildersInteropResult::Endpoint.new
30 server.endpointName = $serverName
31 server.uri = $server || "#{ $serverBase }, #{ $serverGroupB }"
32 server.wsdl = "#{$wsdlBase} #{$wsdlGroupB}"
33
34 $testResults = SOAPBuildersInteropResult::InteropResults.new(client, server)
35
36 $wireDumpDev = ''
37 def $wireDumpDev.close; end
38
39 $wireDumpLogFile = STDERR
40
41
42 ###
43 ## Method definition.
44 #
45 def methodDef(drv)
46   drv.soapaction = $soapAction
47   methodDefBase(drv)
48   methodDefGroupB(drv)
49 end
50
51 def methodDefBase(drv)
52   SOAPBuildersInterop::MethodsBase.each do |name, *params|
53     drv.add_rpc_operation(
54       XSD::QName.new(InterfaceNS, name), $soapAction, name, params)
55   end
56 end
57
58 def methodDefGroupB(drv)
59   SOAPBuildersInterop::MethodsGroupB.each do |name, *params|
60     drv.add_rpc_operation(
61       XSD::QName.new(InterfaceNS, name), $soapAction, name, params)
62   end
63 end
64
65
66 ###
67 ## Helper function
68 #
69 class Float
70   Precision = 5
71
72   def ==(rhs)
73     if rhs.is_a?(Float)
74       if self.nan? and rhs.nan?
75         true
76       elsif self.infinite? == rhs.infinite?
77         true
78       elsif (rhs - self).abs <= (10 ** (- Precision))
79         true
80       else
81         false
82       end
83     else
84       false
85     end
86   end
87 end
88
89 def assert(expected, actual)
90   if expected == actual
91     'OK'
92   else
93     "Expected = " << expected.inspect << "  //  Actual = " << actual.inspect
94   end
95 end
96
97 def setWireDumpLogFile(postfix = "")
98   logFilename = File.basename($0).sub(/\.rb$/, '') << postfix << '.log'
99   f = File.open(logFilename, 'w')
100   f << "File: #{ logFilename } - Wiredumps for SOAP4R client / #{ $serverName } server.\n"
101   f << "Date: #{ Time.now }\n\n"
102   $wireDumpLogFile = f
103 end
104
105 def getWireDumpLogFileBase(postfix = "")
106   File.basename($0).sub(/\.rb$/, '') + postfix
107 end
108
109 def getIdObj(obj)
110   case obj
111   when Array
112     obj.collect { |ele|
113       getIdObj(ele)
114     }
115   else
116     # String#== compares content of args.
117     "#{ obj.class }##{ obj.__id__ }"
118   end
119 end
120
121 def dumpTitle(title)
122   p title
123   $wireDumpLogFile << "##########\n# " << title << "\n\n"
124 end
125
126 def dumpNormal(title, expected, actual)
127   result = assert(expected, actual)
128   if result == 'OK'
129     dumpResult(title, true, nil)
130   else
131     dumpResult(title, false, result)
132   end
133 end
134
135 def dumpException(title)
136   result = "Exception: #{ $! } (#{ $!.class})\n" << $@.join("\n")
137   dumpResult(title, false, result)
138 end
139
140 def dumpResult(title, result, resultStr)
141   $testResults.add(
142     SOAPBuildersInteropResult::TestResult.new(
143       title,
144       result,
145       resultStr,
146       $wireDumpDev.dup
147     )
148   )
149   $wireDumpLogFile << "Result: #{ resultStr || 'OK' }\n\n"
150   $wireDumpLogFile << $wireDumpDev
151   $wireDumpLogFile << "\n"
152
153   $wireDumpDev.replace('')
154 end
155
156 def submitTestResult
157   $testResultDrv.addResults($testResults)
158 end
159
160 class FakeFloat < SOAP::SOAPFloat
161   def initialize(str)
162     super()
163     @data = str
164   end
165
166   def to_s
167     @data.to_s
168   end
169 end
170
171 class FakeDateTime < SOAP::SOAPDateTime
172   def initialize(str)
173     super()
174     @data = str
175   end
176
177   def to_s
178     @data.to_s
179   end
180 end
181
182 class FakeDecimal < SOAP::SOAPDecimal
183   def initialize(str)
184     super()
185     @data = str
186   end
187
188   def to_s
189     @data.to_s
190   end
191 end
192
193 class FakeInt < SOAP::SOAPInt
194   def initialize(str)
195     super()
196     @data = str
197   end
198
199   def to_s
200     @data.to_s
201   end
202 end
203
204
205 ###
206 ## Invoke methods.
207 #
208 def doTest(drv)
209   doTestBase(drv)
210   doTestGroupB(drv)
211 end
212
213 def doTestBase(drv)
214   setWireDumpLogFile('_Base')
215   drv.wiredump_dev = $wireDumpDev
216 #  drv.wiredump_filebase = getWireDumpLogFileBase('_Base')
217
218   drv.mapping_registry = SOAPBuildersInterop::MappingRegistry
219
220   title = 'echoVoid'
221   dumpTitle(title)
222   begin
223     var =  drv.echoVoid()
224     dumpNormal(title, nil, var)
225   rescue Exception
226     dumpException(title)
227   end
228
229   title = 'echoString'
230   dumpTitle(title)
231   begin
232     arg = "SOAP4R Interoperability Test"
233     var = drv.echoString(arg)
234     dumpNormal(title, arg, var)
235   rescue Exception
236     dumpException(title)
237   end
238
239   title = 'echoString (Entity reference)'
240   dumpTitle(title)
241   begin
242     arg = "<>\"& &lt;&gt;&quot;&amp; &amp&amp;><<<"
243     var = drv.echoString(arg)
244     dumpNormal(title, arg, var)
245   rescue Exception
246     dumpException(title)
247   end
248
249   title = 'echoString (Character reference)'
250   dumpTitle(title)
251   begin
252     arg = "\x20&#x20;\040&#32;\x7f&#x7f;\177&#127;"
253     tobe = "    \177\177\177\177"
254     var = drv.echoString(SOAP::SOAPRawString.new(arg))
255     dumpNormal(title, tobe, var)
256   rescue Exception
257     dumpException(title)
258   end
259
260   title = 'echoString (Leading and trailing whitespace)'
261   dumpTitle(title)
262   begin
263     arg = "   SOAP4R\nInteroperability\nTest   "
264     var = drv.echoString(arg)
265     dumpNormal(title, arg, var)
266   rescue Exception
267     dumpException(title)
268   end
269
270   title = 'echoString (EUC encoded)'
271   dumpTitle(title)
272   begin
273     arg = "Hello (����panese) ������
274     var = drv.echoString(arg)
275     dumpNormal(title, arg, var)
276   rescue Exception
277     dumpException(title)
278   end
279
280   title = 'echoString (EUC encoded) again'
281   dumpTitle(title)
282   begin
283     arg = "Hello (����panese) ������
284     var = drv.echoString(arg)
285     dumpNormal(title, arg, var)
286   rescue Exception
287     dumpException(title)
288   end
289
290   title = 'echoString (empty)'
291   dumpTitle(title)
292   begin
293     arg = ''
294     var = drv.echoString(arg)
295     dumpNormal(title, arg, var)
296   rescue Exception
297     dumpException(title)
298   end
299
300   title = 'echoString (space)'
301   dumpTitle(title)
302   begin
303     arg = ' '
304     var = drv.echoString(arg)
305     dumpNormal(title, arg, var)
306   rescue Exception
307     dumpException(title)
308   end
309
310   title = 'echoString (whitespaces:\r \n \t \r \n \t)'
311   dumpTitle(title)
312   begin
313     arg = "\r \n \t \r \n \t"
314     var = drv.echoString(arg)
315     dumpNormal(title, arg, var)
316   rescue Exception
317     dumpException(title)
318   end
319
320   title = 'echoStringArray'
321   dumpTitle(title)
322   begin
323     arg = StringArray["SOAP4R\n", " Interoperability ", "\tTest\t"]
324     var = drv.echoStringArray(arg)
325     dumpNormal(title, arg, var)
326   rescue Exception
327     dumpException(title)
328   end
329
330 #  title = 'echoStringArray (sparse)'
331 #  dumpTitle(title)
332 #  begin
333 #    arg = [nil, "SOAP4R\n", nil, " Interoperability ", nil, "\tTest\t", nil]
334 #    soapAry = SOAP::Mapping.ary2soap(arg, XSD::Namespace, XSD::StringLiteral, SOAPBuildersInterop::MappingRegistry)
335 #    soapAry.sparse = true
336 #    var = drv.echoStringArray(soapAry)
337 #    dumpNormal(title, arg, var)
338 #  rescue Exception
339 #    dumpException(title)
340 #  end
341
342   title = 'echoStringArray (multi-ref)'
343   dumpTitle(title)
344   begin
345     str1 = "SOAP4R"
346     str2 = "SOAP4R"
347     arg = StringArray[str1, str2, str1]
348     var = drv.echoStringArray(arg)
349     dumpNormal(title, arg, var)
350   rescue Exception
351     dumpException(title)
352   end
353
354   title = 'echoStringArray (multi-ref: elem1 == elem3)'
355   dumpTitle(title)
356   begin
357     str1 = "SOAP4R"
358     str2 = "SOAP4R"
359     arg = StringArray[str1, str2, str1]
360     var = drv.echoStringArray(arg)
361     dumpNormal(title, getIdObj(var[0]), getIdObj(var[2]))
362   rescue Exception
363     dumpException(title)
364   end
365
366   title = 'echoStringArray (empty, multi-ref: elem1 == elem3)'
367   dumpTitle(title)
368   begin
369     str1 = ""
370     str2 = ""
371     arg = StringArray[str1, str2, str1]
372     var = drv.echoStringArray(arg)
373     dumpNormal(title, getIdObj(var[0]), getIdObj(var[2]))
374   rescue Exception
375     dumpException(title)
376   end
377
378 #  title = 'echoStringArray (sparse, multi-ref)'
379 #  dumpTitle(title)
380 #  begin
381 #    str = "SOAP4R"
382 #    arg = StringArray[nil, nil, nil, nil, nil, str, nil, str]
383 #    soapAry = SOAP::Mapping.ary2soap(arg, XSD::Namespace, XSD::StringLiteral, SOAPBuildersInterop::MappingRegistry)
384 #    soapAry.sparse = true
385 #    var = drv.echoStringArray(soapAry)
386 #    dumpNormal(title, arg, var)
387 #  rescue Exception
388 #    dumpException(title)
389 #  end
390
391   title = 'echoInteger (Int: 123)'
392   dumpTitle(title)
393   begin
394     arg = 123
395     var = drv.echoInteger(arg)
396     dumpNormal(title, arg, var)
397   rescue Exception
398     dumpException(title)
399   end
400
401   title = 'echoInteger (Int: 2147483647)'
402   dumpTitle(title)
403   begin
404     arg = 2147483647
405     var = drv.echoInteger(arg)
406     dumpNormal(title, arg, var)
407   rescue Exception
408     dumpException(title)
409   end
410
411   title = 'echoInteger (Int: -2147483648)'
412   dumpTitle(title)
413   begin
414     arg = -2147483648
415     var = drv.echoInteger(arg)
416     dumpNormal(title, arg, var)
417   rescue Exception
418     dumpException(title)
419   end
420
421   title = 'echoInteger (2147483648: junk)'
422   dumpTitle(title)
423   begin
424     begin
425       arg = FakeInt.new("2147483648")
426       var = drv.echoInteger(arg)
427       dumpNormal(title, 'Fault', 'No error occurred.')
428     rescue SOAP::RPC::ServerException, SOAP::FaultError
429       dumpNormal(title, true, true)
430     end
431   rescue Exception
432     dumpException(title)
433   end
434
435   title = 'echoInteger (-2147483649: junk)'
436   dumpTitle(title)
437   begin
438     begin
439       arg = FakeInt.new("-2147483649")
440       var = drv.echoInteger(arg)
441       dumpNormal(title, 'Fault', 'No error occurred.')
442     rescue SOAP::RPC::ServerException, SOAP::FaultError
443       dumpNormal(title, true, true)
444     end
445   rescue Exception
446     dumpException(title)
447   end
448
449   title = 'echoInteger (0.0: junk)'
450   dumpTitle(title)
451   begin
452     begin
453       arg = FakeInt.new("0.0")
454       var = drv.echoInteger(arg)
455       dumpNormal(title, 'Fault', 'No error occurred.')
456     rescue SOAP::RPC::ServerException, SOAP::FaultError
457       dumpNormal(title, true, true)
458     end
459   rescue Exception
460     dumpException(title)
461   end
462
463   title = 'echoInteger (-5.2: junk)'
464   dumpTitle(title)
465   begin
466     begin
467       arg = FakeInt.new("-5.2")
468       var = drv.echoInteger(arg)
469       dumpNormal(title, 'Fault', 'No error occurred.')
470     rescue SOAP::RPC::ServerException, SOAP::FaultError
471       dumpNormal(title, true, true)
472     end
473   rescue Exception
474     dumpException(title)
475   end
476
477   title = 'echoInteger (0.000000000a: junk)'
478   dumpTitle(title)
479   begin
480     begin
481       arg = FakeInt.new("0.000000000a")
482       var = drv.echoInteger(arg)
483       dumpNormal(title, 'Fault', 'No error occurred.')
484     rescue SOAP::RPC::ServerException, SOAP::FaultError
485       dumpNormal(title, true, true)
486     end
487   rescue Exception
488     dumpException(title)
489   end
490
491   title = 'echoInteger (+-5: junk)'
492   dumpTitle(title)
493   begin
494     begin
495       arg = FakeInt.new("+-5")
496       var = drv.echoInteger(arg)
497       dumpNormal(title, 'Fault', 'No error occurred.')
498     rescue SOAP::RPC::ServerException, SOAP::FaultError
499       dumpNormal(title, true, true)
500     end
501   rescue Exception
502     dumpException(title)
503   end
504
505   title = 'echoIntegerArray'
506   dumpTitle(title)
507   begin
508     arg = IntArray[1, 2, 3]
509     var = drv.echoIntegerArray(arg)
510     dumpNormal(title, arg, var)
511   rescue Exception
512     dumpException(title)
513   end
514
515 #  title = 'echoIntegerArray (nil)'
516 #  dumpTitle(title)
517 #  begin
518 #    arg = IntArray[nil, nil, nil]
519 #    var = drv.echoIntegerArray(arg)
520 #    dumpNormal(title, arg, var)
521 #  rescue Exception
522 #    dumpException(title)
523 #  end
524
525   title = 'echoIntegerArray (empty)'
526   dumpTitle(title)
527   begin
528     arg = SOAP::SOAPArray.new(SOAP::ValueArrayName, 1, XSD::XSDInt::Type)
529     var = drv.echoIntegerArray(arg)
530     dumpNormal(title, [], var)
531   rescue Exception
532     dumpException(title)
533   end
534
535 #  title = 'echoIntegerArray (sparse)'
536 #  dumpTitle(title)
537 #  begin
538 #    arg = [nil, 1, nil, 2, nil, 3, nil]
539 #    soapAry = SOAP::Mapping.ary2soap(arg, XSD::Namespace, XSD::XSDInt::Type, SOAPBuildersInterop::MappingRegistry)
540 #    soapAry.sparse = true
541 #    var = drv.echoIntegerArray(soapAry)
542 #    dumpNormal(title, arg, var)
543 #  rescue Exception
544 #    dumpException(title)
545 #  end
546
547   title = 'echoFloat'
548   dumpTitle(title)
549   begin
550     arg = 3.14159265358979
551     var = drv.echoFloat(SOAPFloat.new(arg))
552     dumpNormal(title, arg, var)
553   rescue Exception
554     dumpException(title)
555   end
556
557   title = 'echoFloat (scientific notation)'
558   dumpTitle(title)
559   begin
560     arg = 12.34e36
561     var = drv.echoFloat(SOAPFloat.new(arg))
562     dumpNormal(title, arg, var)
563   rescue Exception
564     dumpException(title)
565   end
566
567   title = 'echoFloat (scientific notation 2)'
568   dumpTitle(title)
569   begin
570     arg = FakeFloat.new("12.34e36")
571     var = drv.echoFloat(SOAPFloat.new(arg))
572     dumpNormal(title, 12.34e36, var)
573   rescue Exception
574     dumpException(title)
575   end
576
577   title = 'echoFloat (scientific notation 3)'
578   dumpTitle(title)
579   begin
580     arg = FakeFloat.new("12.34E+36")
581     var = drv.echoFloat(SOAPFloat.new(arg))
582     dumpNormal(title, 12.34e36, var)
583   rescue Exception
584     dumpException(title)
585   end
586
587   title = 'echoFloat (scientific notation 4)'
588   dumpTitle(title)
589   begin
590     arg = FakeFloat.new("-1.4E")
591     var = drv.echoFloat(SOAPFloat.new(arg))
592     dumpNormal(title, 1.4, var)
593   rescue Exception
594     dumpException(title)
595   end
596
597   title = 'echoFloat (positive lower boundary)'
598   dumpTitle(title)
599   begin
600     arg = 1.4e-45
601     var = drv.echoFloat(SOAPFloat.new(arg))
602     dumpNormal(title, arg, var)
603   rescue Exception
604     dumpException(title)
605   end
606
607   title = 'echoFloat (negative lower boundary)'
608   dumpTitle(title)
609   begin
610     arg = -1.4e-45
611     var = drv.echoFloat(SOAPFloat.new(arg))
612     dumpNormal(title, arg, var)
613   rescue Exception
614     dumpException(title)
615   end
616
617   title = 'echoFloat (special values: +0)'
618   dumpTitle(title)
619   begin
620     arg = 0.0
621     var = drv.echoFloat(SOAPFloat.new(arg))
622     dumpNormal(title, arg, var)
623   rescue Exception
624     dumpException(title)
625   end
626
627   title = 'echoFloat (special values: -0)'
628   dumpTitle(title)
629   begin
630     arg = (-1.0 / (1.0 / 0.0))
631     var = drv.echoFloat(SOAPFloat.new(arg))
632     dumpNormal(title, arg, var)
633   rescue Exception
634     dumpException(title)
635   end
636
637   title = 'echoFloat (special values: NaN)'
638   dumpTitle(title)
639   begin
640     arg = 0.0/0.0
641     var = drv.echoFloat(SOAPFloat.new(arg))
642     dumpNormal(title, arg, var)
643   rescue Exception
644     dumpException(title)
645   end
646
647   title = 'echoFloat (special values: INF)'
648   dumpTitle(title)
649   begin
650     arg = 1.0/0.0
651     var = drv.echoFloat(SOAPFloat.new(arg))
652     dumpNormal(title, arg, var)
653   rescue Exception
654     dumpException(title)
655   end
656
657   title = 'echoFloat (special values: -INF)'
658   dumpTitle(title)
659   begin
660     arg = -1.0/0.0
661     var = drv.echoFloat(SOAPFloat.new(arg))
662     dumpNormal(title, arg, var)
663   rescue Exception
664     dumpException(title)
665   end
666
667   title = 'echoFloat (0.000a: junk)'
668   dumpTitle(title)
669   begin
670     begin
671       arg = FakeFloat.new("0.0000000000000000a")
672       var = drv.echoFloat(arg)
673       dumpNormal(title, 'Fault', 'No error occurred.')
674     rescue SOAP::RPC::ServerException, SOAP::FaultError
675       dumpNormal(title, true, true)
676     end
677   rescue Exception
678     dumpException(title)
679   end
680
681   title = 'echoFloat (00a.0001: junk)'
682   dumpTitle(title)
683   begin
684     begin
685       arg = FakeFloat.new("00a.000000000000001")
686       var = drv.echoFloat(arg)
687       dumpNormal(title, 'Fault', 'No error occurred.')
688     rescue SOAP::RPC::ServerException, SOAP::FaultError
689       dumpNormal(title, true, true)
690     end
691   rescue Exception
692     dumpException(title)
693   end
694
695   title = 'echoFloat (+-5: junk)'
696   dumpTitle(title)
697   begin
698     begin
699       arg = FakeFloat.new("+-5")
700       var = drv.echoFloat(arg)
701       dumpNormal(title, 'Fault', 'No error occurred.')
702     rescue SOAP::RPC::ServerException, SOAP::FaultError
703       dumpNormal(title, true, true)
704     end
705   rescue Exception
706     dumpException(title)
707   end
708
709   title = 'echoFloat (5_0: junk)'
710   dumpTitle(title)
711   begin
712     begin
713       arg = FakeFloat.new("5_0")
714       var = drv.echoFloat(arg)
715       dumpNormal(title, 'Fault', 'No error occurred.')
716     rescue SOAP::RPC::ServerException, SOAP::FaultError
717       dumpNormal(title, true, true)
718     end
719   rescue Exception
720     dumpException(title)
721   end
722
723   title = 'echoFloatArray'
724   dumpTitle(title)
725   begin
726     arg = FloatArray[SOAPFloat.new(0.0001), SOAPFloat.new(1000.0), SOAPFloat.new(0.0)]
727     var = drv.echoFloatArray(arg)
728     dumpNormal(title, arg.collect { |ele| ele.data }, var)
729   rescue Exception
730     dumpException(title)
731   end
732
733   title = 'echoFloatArray (special values: NaN, INF, -INF)'
734   dumpTitle(title)
735   begin
736     nan = SOAPFloat.new(0.0/0.0)
737     inf = SOAPFloat.new(1.0/0.0)
738     inf_ = SOAPFloat.new(-1.0/0.0)
739     arg = FloatArray[nan, inf, inf_]
740     var = drv.echoFloatArray(arg)
741     dumpNormal(title, arg.collect { |ele| ele.data }, var)
742   rescue Exception
743     dumpException(title)
744   end
745
746 #  title = 'echoFloatArray (sparse)'
747 #  dumpTitle(title)
748 #  begin
749 #    arg = [nil, nil, 0.0001, 1000.0, 0.0, nil, nil]
750 #    soapAry = SOAP::Mapping.ary2soap(arg, XSD::Namespace, XSD::FloatLiteral, SOAPBuildersInterop::MappingRegistry)
751 #    soapAry.sparse = true
752 #    var = drv.echoFloatArray(soapAry)
753 #    dumpNormal(title, arg, var)
754 #  rescue Exception
755 #    dumpException(title)
756 #  end
757
758   title = 'echoStruct'
759   dumpTitle(title)
760   begin
761     arg = SOAPStruct.new(1, 1.1, "a")
762     var = drv.echoStruct(arg)
763     dumpNormal(title, arg, var)
764   rescue Exception
765     dumpException(title)
766   end
767
768   title = 'echoStruct (nil members)'
769   dumpTitle(title)
770   begin
771     arg = SOAPStruct.new(nil, nil, nil)
772     var = drv.echoStruct(arg)
773     dumpNormal(title, arg, var)
774   rescue Exception
775     dumpException(title)
776   end
777
778   title = 'echoStructArray'
779   dumpTitle(title)
780   begin
781     s1 = SOAPStruct.new(1, 1.1, "a")
782     s2 = SOAPStruct.new(2, 2.2, "b")
783     s3 = SOAPStruct.new(3, 3.3, "c")
784     arg = SOAPStructArray[s1, s2, s3]
785     var = drv.echoStructArray(arg)
786     dumpNormal(title, arg, var)
787   rescue Exception
788     dumpException(title)
789   end
790
791   title = 'echoStructArray (anyType Array)'
792   dumpTitle(title)
793   begin
794     s1 = SOAPStruct.new(1, 1.1, "a")
795     s2 = SOAPStruct.new(2, 2.2, "b")
796     s3 = SOAPStruct.new(3, 3.3, "c")
797     arg = [s1, s2, s3]
798     var = drv.echoStructArray(arg)
799     dumpNormal(title, arg, var)
800   rescue Exception
801     dumpException(title)
802   end
803
804 #  title = 'echoStructArray (sparse)'
805 #  dumpTitle(title)
806 #  begin
807 #    s1 = SOAPStruct.new(1, 1.1, "a")
808 #    s2 = SOAPStruct.new(2, 2.2, "b")
809 #    s3 = SOAPStruct.new(3, 3.3, "c")
810 #    arg = [nil, s1, s2, s3]
811 #    soapAry = SOAP::Mapping.ary2soap(arg, TypeNS, "SOAPStruct", SOAPBuildersInterop::MappingRegistry)
812 #    soapAry.sparse = true
813 #    var = drv.echoStructArray(soapAry)
814 #    dumpNormal(title, arg, var)
815 #  rescue Exception
816 #    dumpException(title)
817 #  end
818
819   title = 'echoStructArray (multi-ref)'
820   dumpTitle(title)
821   begin
822     s1 = SOAPStruct.new(1, 1.1, "a")
823     s2 = SOAPStruct.new(2, 2.2, "b")
824     arg = SOAPStructArray[s1, s1, s2]
825     var = drv.echoStructArray(arg)
826     dumpNormal(title, arg, var)
827   rescue Exception
828     dumpException(title)
829   end
830
831   title = 'echoStructArray (multi-ref: elem1 == elem2)'
832   dumpTitle(title)
833   begin
834     s1 = SOAPStruct.new(1, 1.1, "a")
835     s2 = SOAPStruct.new(2, 2.2, "b")
836     arg = SOAPStructArray[s1, s1, s2]
837     var = drv.echoStructArray(arg)
838     dumpNormal(title, getIdObj(var[0]), getIdObj(var[1]))
839   rescue Exception
840     dumpException(title)
841   end
842
843   title = 'echoStructArray (anyType Array, multi-ref: elem2 == elem3)'
844   dumpTitle(title)
845   begin
846     s1 = SOAPStruct.new(1, 1.1, "a")
847     s2 = SOAPStruct.new(2, 2.2, "b")
848     arg = [s1, s2, s2]
849     var = drv.echoStructArray(arg)
850     dumpNormal(title, getIdObj(var[1]), getIdObj(var[2]))
851   rescue Exception
852     dumpException(title)
853   end
854
855 #  title = 'echoStructArray (sparse, multi-ref)'
856 #  dumpTitle(title)
857 #  begin
858 #    s1 = SOAPStruct.new(1, 1.1, "a")
859 #    s2 = SOAPStruct.new(2, 2.2, "b")
860 #    arg = [nil, s1, nil, nil, s2, nil, s2]
861 #    soapAry = SOAP::Mapping.ary2soap(arg, TypeNS, "SOAPStruct", SOAPBuildersInterop::MappingRegistry)
862 #    soapAry.sparse = true
863 #    var = drv.echoStructArray(soapAry)
864 #    dumpNormal(title, arg, var)
865 #  rescue Exception
866 #    dumpException(title)
867 #  end
868
869 #  title = 'echoStructArray (sparse, multi-ref: elem5 == elem7)'
870 #  dumpTitle(title)
871 #  begin
872 #    s1 = SOAPStruct.new(1, 1.1, "a")
873 #    s2 = SOAPStruct.new(2, 2.2, "b")
874 #    arg = [nil, s1, nil, nil, s2, nil, s2]
875 #    soapAry = SOAP::Mapping.ary2soap(arg, TypeNS, "SOAPStruct", SOAPBuildersInterop::MappingRegistry)
876 #    soapAry.sparse = true
877 #    var = drv.echoStructArray(soapAry)
878 #    dumpNormal(title, getIdObj(var[4]), getIdObj(var[6]))
879 #  rescue Exception
880 #    dumpException(title)
881 #  end
882
883   title = 'echoStructArray (multi-ref: varString of elem1 == varString of elem2)'
884   dumpTitle(title)
885   begin
886     str1 = "a"
887     str2 = "a"
888     s1 = SOAPStruct.new(1, 1.1, str1)
889     s2 = SOAPStruct.new(2, 2.2, str1)
890     s3 = SOAPStruct.new(3, 3.3, str2)
891     arg = SOAPStructArray[s1, s2, s3]
892     var = drv.echoStructArray(arg)
893     dumpNormal(title, getIdObj(var[0].varString), getIdObj(var[1].varString))
894   rescue Exception
895     dumpException(title)
896   end
897
898   title = 'echoStructArray (anyType Array, multi-ref: varString of elem2 == varString of elem3)'
899   dumpTitle(title)
900   begin
901     str1 = "b"
902     str2 = "b"
903     s1 = SOAPStruct.new(1, 1.1, str2)
904     s2 = SOAPStruct.new(2, 2.2, str1)
905     s3 = SOAPStruct.new(3, 3.3, str1)
906     arg = [s1, s2, s3]
907     var = drv.echoStructArray(arg)
908     dumpNormal(title, getIdObj(var[1].varString), getIdObj(var[2].varString))
909   rescue Exception
910     dumpException(title)
911   end
912
913 #  title = 'echoStructArray (sparse, multi-ref: varString of elem5 == varString of elem7)'
914 #  dumpTitle(title)
915 #  begin
916 #    str1 = "c"
917 #    str2 = "c"
918 #    s1 = SOAPStruct.new(1, 1.1, str2)
919 #    s2 = SOAPStruct.new(2, 2.2, str1)
920 #    s3 = SOAPStruct.new(3, 3.3, str1)
921 #    arg = [nil, s1, nil, nil, s2, nil, s3]
922 #    soapAry = SOAP::Mapping.ary2soap(arg, TypeNS, "SOAPStruct", SOAPBuildersInterop::MappingRegistry)
923 #    soapAry.sparse = true
924 #    var = drv.echoStructArray(soapAry)
925 #    dumpNormal(title, getIdObj(var[4].varString), getIdObj(var[6].varString))
926 #  rescue Exception
927 #    dumpException(title)
928 #  end
929
930 #  title = 'echoStructArray (2D Array)'
931 #  dumpTitle(title)
932 #  begin
933 #    s1 = SOAPStruct.new(1, 1.1, "a")
934 #    s2 = SOAPStruct.new(2, 2.2, "b")
935 #    s3 = SOAPStruct.new(3, 3.3, "c")
936 #    arg = [
937 #      [s1, nil, s2],
938 #      [nil, s2, s3],
939 #    ]
940 #    md = SOAP::Mapping.ary2md(arg, 2, XSD::Namespace, XSD::AnyTypeLiteral, SOAPBuildersInterop::MappingRegistry)
941 #
942 #    var = drv.echoStructArray(md)
943 #    dumpNormal(title, arg, var)
944 #  rescue Exception
945 #    dumpException(title)
946 #  end
947 #
948 #  title = 'echoStructArray (2D Array, sparse)'
949 #  dumpTitle(title)
950 #  begin
951 #    s1 = SOAPStruct.new(1, 1.1, "a")
952 #    s2 = SOAPStruct.new(2, 2.2, "b")
953 #    s3 = SOAPStruct.new(3, 3.3, "c")
954 #    arg = [
955 #      [s1, nil, s2],
956 #      [nil, s2, s3],
957 #    ]
958 #    md = SOAP::Mapping.ary2md(arg, 2, TypeNS, "SOAPStruct", SOAPBuildersInterop::MappingRegistry)
959 ##    md.sparse = true
960 #
961 #    var = drv.echoStructArray(md)
962 #    dumpNormal(title, arg, var)
963 #  rescue Exception
964 #    dumpException(title)
965 #  end
966 #
967 #  title = 'echoStructArray (anyType, 2D Array, sparse)'
968 #  dumpTitle(title)
969 #  begin
970 #    s1 = SOAPStruct.new(1, 1.1, "a")
971 #    s2 = SOAPStruct.new(2, 2.2, "b")
972 #    s3 = SOAPStruct.new(3, 3.3, "c")
973 #    arg = [
974 #      [s1, nil, s2],
975 #      [nil, s2, s3],
976 #    ]
977 #    md = SOAP::Mapping.ary2md(arg, 2, XSD::Namespace, XSD::AnyTypeLiteral, SOAPBuildersInterop::MappingRegistry)
978 #    md.sparse = true
979 #
980 #    var = drv.echoStructArray(md)
981 #    dumpNormal(title, arg, var)
982 #  rescue Exception
983 #    dumpException(title)
984 #  end
985
986   title = 'echoDate (now)'
987   dumpTitle(title)
988   begin
989     t = Time.now.gmtime
990     arg = DateTime.new(t.year, t.mon, t.mday, t.hour, t.min, t.sec)
991     var = drv.echoDate(arg)
992     dumpNormal(title, arg.to_s, var.to_s)
993   rescue Exception
994     dumpException(title)
995   end
996
997   title = 'echoDate (before 1970: 1-01-01T00:00:00Z)'
998   dumpTitle(title)
999   begin
1000     t = Time.now.gmtime
1001     arg = DateTime.new(1, 1, 1, 0, 0, 0)
1002     var = drv.echoDate(arg)
1003     dumpNormal(title, arg.to_s, var.to_s)
1004   rescue Exception
1005     dumpException(title)
1006   end
1007
1008   title = 'echoDate (after 2038: 2038-12-31T00:00:00Z)'
1009   dumpTitle(title)
1010   begin
1011     t = Time.now.gmtime
1012     arg = DateTime.new(2038, 12, 31, 0, 0, 0)
1013     var = drv.echoDate(arg)
1014     dumpNormal(title, arg.to_s, var.to_s)
1015   rescue Exception
1016     dumpException(title)
1017   end
1018
1019   title = 'echoDate (negative: -10-01-01T00:00:00Z)'
1020   dumpTitle(title)
1021   begin
1022     t = Time.now.gmtime
1023     arg = DateTime.new(-10, 1, 1, 0, 0, 0)
1024     var = drv.echoDate(arg)
1025     dumpNormal(title, arg.to_s, var.to_s)
1026   rescue Exception
1027     dumpException(title)
1028   end
1029
1030   title = 'echoDate (time precision: msec)'
1031   dumpTitle(title)
1032   begin
1033     arg = SOAP::SOAPDateTime.new('2001-06-16T18:13:40.012')
1034     argDate = arg.data
1035     var = drv.echoDate(arg)
1036     dumpNormal(title, argDate, var)
1037   rescue Exception
1038     dumpException(title)
1039   end
1040
1041   title = 'echoDate (time precision: long)'
1042   dumpTitle(title)
1043   begin
1044     arg = SOAP::SOAPDateTime.new('2001-06-16T18:13:40.0000000000123456789012345678900000000000')
1045     argDate = arg.data
1046     var = drv.echoDate(arg)
1047     dumpNormal(title, argDate, var)
1048   rescue Exception
1049     dumpException(title)
1050   end
1051
1052   title = 'echoDate (positive TZ)'
1053   dumpTitle(title)
1054   begin
1055     arg = SOAP::SOAPDateTime.new('2001-06-17T01:13:40+07:00')
1056     argNormalized = DateTime.new(2001, 6, 16, 18, 13, 40)
1057     var = drv.echoDate(arg)
1058     dumpNormal(title, argNormalized, var)
1059   rescue Exception
1060     dumpException(title)
1061   end
1062
1063   title = 'echoDate (negative TZ)'
1064   dumpTitle(title)
1065   begin
1066     arg = SOAP::SOAPDateTime.new('2001-06-16T18:13:40-07:00')
1067     argNormalized = DateTime.new(2001, 6, 17, 1, 13, 40)
1068     var = drv.echoDate(arg)
1069     dumpNormal(title, argNormalized, var)
1070   rescue Exception
1071     dumpException(title)
1072   end
1073
1074   title = 'echoDate (+00:00 TZ)'
1075   dumpTitle(title)
1076   begin
1077     arg = SOAP::SOAPDateTime.new('2001-06-17T01:13:40+00:00')
1078     argNormalized = DateTime.new(2001, 6, 17, 1, 13, 40)
1079     var = drv.echoDate(arg)
1080     dumpNormal(title, argNormalized, var)
1081   rescue Exception
1082     dumpException(title)
1083   end
1084
1085   title = 'echoDate (-00:00 TZ)'
1086   dumpTitle(title)
1087   begin
1088     arg = SOAP::SOAPDateTime.new('2001-06-17T01:13:40-00:00')
1089     argNormalized = DateTime.new(2001, 6, 17, 1, 13, 40)
1090     var = drv.echoDate(arg)
1091     dumpNormal(title, argNormalized, var)
1092   rescue Exception
1093     dumpException(title)
1094   end
1095
1096   title = 'echoDate (min TZ)'
1097   dumpTitle(title)
1098   begin
1099     arg = SOAP::SOAPDateTime.new('2001-06-16T00:00:01+00:01')
1100     argNormalized = DateTime.new(2001, 6, 15, 23, 59, 1)
1101     var = drv.echoDate(arg)
1102     dumpNormal(title, argNormalized, var)
1103   rescue Exception
1104     dumpException(title)
1105   end
1106
1107   title = 'echoDate (year > 9999)'
1108   dumpTitle(title)
1109   begin
1110     arg = SOAP::SOAPDateTime.new('10000-06-16T18:13:40-07:00')
1111     argNormalized = DateTime.new(10000, 6, 17, 1, 13, 40)
1112     var = drv.echoDate(arg)
1113     dumpNormal(title, argNormalized, var)
1114   rescue Exception
1115     dumpException(title)
1116   end
1117
1118   title = 'echoDate (year < 0)'
1119   dumpTitle(title)
1120   begin
1121     arg = SOAP::SOAPDateTime.new('-0001-06-16T18:13:40-07:00')
1122     argNormalized = DateTime.new(0, 6, 17, 1, 13, 40)
1123     var = drv.echoDate(arg)
1124     dumpNormal(title, argNormalized, var)
1125   rescue Exception
1126     dumpException(title)
1127   end
1128
1129   title = 'echoDate (year == -4713)'
1130   dumpTitle(title)
1131   begin
1132     arg = SOAP::SOAPDateTime.new('-4713-01-01T12:00:00')
1133     argNormalized = DateTime.new(-4712, 1, 1, 12, 0, 0)
1134     var = drv.echoDate(arg)
1135     dumpNormal(title, argNormalized, var)
1136   rescue Exception
1137     dumpException(title)
1138   end
1139
1140   title = 'echoDate (year 0000: junk)'
1141   dumpTitle(title)
1142   begin
1143     begin
1144       arg = FakeDateTime.new("0000-05-18T16:52:20Z")
1145       var = drv.echoDate(arg)
1146       dumpNormal(title, 'Fault', 'No error occurred.')
1147     rescue SOAP::RPC::ServerException, SOAP::FaultError
1148       dumpNormal(title, true, true)
1149     end
1150   rescue Exception
1151     dumpException(title)
1152   end
1153
1154   title = 'echoDate (year nn: junk)'
1155   dumpTitle(title)
1156   begin
1157     begin
1158       arg = FakeDateTime.new("05-05-18T16:52:20Z")
1159       var = drv.echoDate(arg)
1160       dumpNormal(title, 'Fault', 'No error occurred.')
1161     rescue SOAP::RPC::ServerException, SOAP::FaultError
1162       dumpNormal(title, true, true)
1163     end
1164   rescue Exception
1165     dumpException(title)
1166   end
1167
1168   title = 'echoDate (no day part: junk)'
1169   dumpTitle(title)
1170   begin
1171     begin
1172       arg = FakeDateTime.new("2002-05T16:52:20Z")
1173       var = drv.echoDate(arg)
1174       dumpNormal(title, 'Fault', 'No error occurred.')
1175     rescue SOAP::RPC::ServerException, SOAP::FaultError
1176       dumpNormal(title, true, true)
1177     end
1178   rescue Exception
1179     dumpException(title)
1180   end
1181
1182   title = 'echoDate (no sec part: junk)'
1183   dumpTitle(title)
1184   begin
1185     begin
1186       arg = FakeDateTime.new("2002-05-18T16:52Z")
1187       var = drv.echoDate(arg)
1188       dumpNormal(title, 'Fault', 'No error occurred.')
1189     rescue SOAP::RPC::ServerException, SOAP::FaultError
1190       dumpNormal(title, true, true)
1191     end
1192   rescue Exception
1193     dumpException(title)
1194   end
1195
1196   title = 'echoDate (empty: junk)'
1197   dumpTitle(title)
1198   begin
1199     begin
1200       arg = FakeDateTime.new("")
1201       var = drv.echoDate(arg)
1202       dumpNormal(title, 'Fault', 'No error occurred.')
1203     rescue SOAP::RPC::ServerException, SOAP::FaultError
1204       dumpNormal(title, true, true)
1205     end
1206   rescue Exception
1207     dumpException(title)
1208   end
1209
1210   title = 'echoBase64 (xsd:base64Binary)'
1211   dumpTitle(title)
1212   begin
1213     str = "Hello (����panese) ������
1214     arg = SOAP::SOAPBase64.new(str)
1215     arg.as_xsd  # Force xsd:base64Binary instead of soap-enc:base64
1216     var = drv.echoBase64(arg)
1217     dumpNormal(title, str, var)
1218   rescue Exception
1219     dumpException(title)
1220   end
1221
1222   title = 'echoBase64 (xsd:base64Binary, empty)'
1223   dumpTitle(title)
1224   begin
1225     str = ""
1226     arg = SOAP::SOAPBase64.new(str)
1227     arg.as_xsd  # Force xsd:base64Binary instead of soap-enc:base64
1228     var = drv.echoBase64(arg)
1229     dumpNormal(title, str, var)
1230   rescue Exception
1231     dumpException(title)
1232   end
1233
1234   title = 'echoBase64 (SOAP-ENC:base64)'
1235   dumpTitle(title)
1236   begin
1237     str = "Hello (����panese) ������
1238     arg = SOAP::SOAPBase64.new(str)
1239     var = drv.echoBase64(arg)
1240     dumpNormal(title, str, var)
1241   rescue Exception
1242     dumpException(title)
1243   end
1244
1245   title = 'echoBase64 (\0)'
1246   dumpTitle(title)
1247   begin
1248     str = "\0"
1249     arg = SOAP::SOAPBase64.new(str)
1250     var = drv.echoBase64(arg)
1251     dumpNormal(title, str, var)
1252   rescue Exception
1253     dumpException(title)
1254   end
1255
1256   title = 'echoBase64 (\0a\0)'
1257   dumpTitle(title)
1258   begin
1259     str = "a\0b\0\0c\0\0\0"
1260     arg = SOAP::SOAPBase64.new(str)
1261     var = drv.echoBase64(arg)
1262     dumpNormal(title, str, var)
1263   rescue Exception
1264     dumpException(title)
1265   end
1266
1267   title = 'echoBase64 (-: junk)'
1268   dumpTitle(title)
1269   begin
1270     begin
1271       arg = SOAP::SOAPBase64.new("dummy")
1272       arg.instance_eval { @data = '-' }
1273       var = drv.echoBase64(arg)
1274       dumpNormal(title, 'Fault', 'No error occurred.')
1275     rescue SOAP::RPC::ServerException, SOAP::FaultError
1276       dumpNormal(title, true, true)
1277     end
1278   rescue Exception
1279     dumpException(title)
1280   end
1281
1282   title = 'echoHexBinary'
1283   dumpTitle(title)
1284   begin
1285     str = "Hello (����panese) ������
1286     arg = SOAP::SOAPHexBinary.new(str)
1287     var = drv.echoHexBinary(arg)
1288     dumpNormal(title, str, var)
1289   rescue Exception
1290     dumpException(title)
1291   end
1292
1293   title = 'echoHexBinary(empty)'
1294   dumpTitle(title)
1295   begin
1296     str = ""
1297     arg = SOAP::SOAPHexBinary.new(str)
1298     var = drv.echoHexBinary(arg)
1299     dumpNormal(title, str, var)
1300   rescue Exception
1301     dumpException(title)
1302   end
1303
1304   title = 'echoHexBinary(\0)'
1305   dumpTitle(title)
1306   begin
1307     str = "\0"
1308     arg = SOAP::SOAPHexBinary.new(str)
1309     var = drv.echoHexBinary(arg)
1310     dumpNormal(title, str, var)
1311   rescue Exception
1312     dumpException(title)
1313   end
1314
1315   title = 'echoHexBinary(\0a\0)'
1316   dumpTitle(title)
1317   begin
1318     str = "a\0b\0\0c\0\0\0"
1319     arg = SOAP::SOAPHexBinary.new(str)
1320     var = drv.echoHexBinary(arg)
1321     dumpNormal(title, str, var)
1322   rescue Exception
1323     dumpException(title)
1324   end
1325
1326   title = 'echoHexBinary(lower case)'
1327   dumpTitle(title)
1328   begin
1329     str = "lower case"
1330     arg = SOAP::SOAPHexBinary.new
1331     arg.set_encoded((str.unpack("H*")[0]).tr('A-F', 'a-f'))
1332     var = drv.echoHexBinary(arg)