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

root/tags/RELEASE_1_3_0/sample/hippoClient.rb

Revision 76, 2.4 kB (checked in by nakahiro, 8 years ago)

Update for SOAP4R/1.3.0.

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