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

root/tags/RELEASE_1_4_5/sample/hippoClient.rb

Revision 106, 2.3 kB (checked in by nakahiro, 8 years ago)

Changed 1999 support method.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to author date id revision
Line 
1 #!/usr/bin/env ruby
2
3 require 'soap/driver'
4
5 server = ARGV.shift or raise ArgumentError.new( 'Target URL was not given.' )
6 proxy = ARGV.shift || nil
7
8 require 'soap/XMLSchemaDatatypes1999'
9
10 def getWireDumpLogFile
11   logFilename = File.basename( $0 ) + '.log'
12   f = File.open( logFilename, 'w' )
13   f << "File: #{ logFilename } - Wiredumps for SOAP4R client / #{ $serverName } server.\n"
14   f << "Date: #{ Time.now }\n\n"
15 end
16
17
18 =begin
19 # http://www.hippo2000.net/cgi-bin/soap.cgi
20
21 NS = 'urn:Geometry2'
22
23 drv = SOAP::Driver.new( Log.new( STDERR ), 'hippoApp', NS, server, proxy )
24 drv.setWireDumpDev( getWireDumpLogFile )
25 drv.addMethod( 'calcArea', 'x1', 'y1', 'x2', 'y2' )
26
27 puts drv.calcArea( 5, 1000, 10, 20 )
28 =end
29
30 =begin
31 # http://www.hippo2000.net/cgi-bin/soap.pl?class=Geometry
32
33 NS = 'urn:ServerDemo'
34
35 class Point
36   @@namespace = NS
37   def initialize( x, y )
38     @x = x
39     @y = y
40   end
41 end
42
43 origin = Point.new( 10, 10 )
44 corner = Point.new( 110, 110 )
45
46 drv = SOAP::Driver.new( Log.new( STDERR ), 'hippoApp', NS, server, proxy )
47 drv.setWireDumpDev( getWireDumpLogFile )
48 drv.addMethod( 'calculateArea', 'origin', 'corner' )
49
50 puts drv.calculateArea( origin, corner )
51 =end
52
53 =begin
54 # http://www.hippo2000.net/cgi-bin/soapEx.cgi
55
56 NS = 'urn:SoapEx'
57
58 drv = SOAP::Driver.new( Log.new( STDERR ), 'hippoApp', NS, server, proxy )
59 drv.setWireDumpDev( getWireDumpLogFile )
60 drv.addMethod( 'calcArea', 'x1', 'y1', 'x2', 'y2' )
61
62 # calcArea sample
63 p drv.calcArea( 5, 10, 10, 15 )
64 =end
65
66
67 =begin
68 # http://www.hippo2000.net/cgi-bin/soapEx.cgi
69
70 NS = 'urn:SoapEx'
71
72 drv = SOAP::Driver.new( Log.new( STDERR ), 'hippoApp', NS, server, proxy )
73 drv.setWireDumpDev( getWireDumpLogFile )
74 drv.addMethod( 'parseChasen', 'target' )
75 drv.addMethod( 'parseChasenArry', 'target' )
76
77 require 'uconv'
78
79 # ChaSen Sample 1
80 def putLine( index, kanaName, pos )
81   line = "#{ index }\t\t#{ kanaName }\t\t#{ pos }"
82   puts Uconv.u8toeuc( line )
83 end
84
85 targetString = Uconv.euctou8( 'SOAP����ȳڤ����Ǥ���?' )
86
87 result = drv.parseChasen( targetString )
88
89 index = Uconv.euctou8( '����' )
90 kanaName = Uconv.euctou8( '��� )
91 pos = Uconv.euctou8( '���)
92
93 putLine( index, kanaName, pos )
94
95 result.each do | ele |
96   putLine( ele[ index ], ele[ kanaName ], ele[ pos ] )
97 end
98
99
100 # ChaSen Sample 2
101 targetString = Uconv.euctou8( '�ڤ������ѤǤ���?' )
102
103 drv.parseChasenArry( targetString ).each do | ele |
104   puts Uconv.u8toeuc( ele )
105 end
106 =end
Note: See TracBrowser for help on using the browser.