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

root/tags/RELEASE_1_3_0/sample/apacheServer.cgi

Revision 76, 1.6 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/local/bin/ruby
2
3 require 'soap/cgistub'
4
5
6 module XSD
7   Namespace = 'http://www.w3.org/1999/XMLSchema'
8   InstanceNamespace = 'http://www.w3.org/1999/XMLSchema-instance'
9   NilLiteral = 'null'
10 end
11
12
13 class Address
14   @@typeName = 'address'
15   @@typeNamespace = 'urn:ibm-soap-address-demo'
16
17   attr_accessor :streetNum, :streetName, :city, :state, :zip, :phoneNumber
18   def initialize( streetNum = nil, streetName = nil, city = nil, state = nil, zip = nil, phoneNumber = nil )
19     @streetNum = streetNum
20     @streetName = streetName
21     @city = city
22     @state = state
23     @zip = zip
24     @phoneNumber = phoneNumber
25   end
26 end
27
28 class PhoneNumber
29   @@typeName = 'phone'
30   @@typeNamespace = 'urn:ibm-soap-address-demo'
31
32   attr_accessor :areaCode, :exchange, :number
33   def initialize( areaCode = nil, exchange = nil, number = nil )
34     @exchange = exchange
35     @areaCode = areaCode
36     @number = number
37   end
38 end
39
40
41 class SampleApp < SOAP::CGIStub
42   NS1 = 'urn:i3solutions-delayed-quotes'
43   NS2 = 'urn:AddressFetcher'
44
45   def methodDef
46     addMethod( self, "getQuote", NS1 )
47     addMethod( self, "getAddressFromName", NS2 )
48     addMethod( self, "addEntry", NS2 )
49   end
50  
51   def getQuote( symbol )
52     152
53   end
54
55   def getAddressFromName( nameToLookup )
56     ret = Address.new( 123, 'Main Street', 'Anytown', 'NY', 12345, PhoneNumber.new( 123, '456', '7890' ))
57     ret
58   end
59
60   def addEntry( nameToRegister, address )
61     ret = Address.new( 123, 'Main Street', 'Anytown', 'NY', 12345, PhoneNumber.new( 123, '456', '7890' ))
62     [ ret, ret, ret ]
63   end
64 end
65
66 SampleApp.new( "foo", "http://www.sarion.com/xmlns/nakahiro/soap4r/sample1" ).start
Note: See TracBrowser for help on using the browser.