soap-lc 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,117 @@
1
+ module SOAP
2
+ class XSD
3
+ class Sequence < Hash
4
+ def initialize( type )
5
+ type.attributes.each { |name, value|
6
+ self[name.to_sym] = value
7
+ }
8
+
9
+ type.find_all{ |e| e.class == REXML::Element }.each { |content|
10
+ case content.name
11
+ when "annotation"
12
+ ###############################################################################
13
+ warn "xsd:annotation in xsd:sequence is not yet supported!"
14
+ ###############################################################################
15
+ when "element"
16
+ raise SOAP::LCElementError, "Malformated sequence" unless self[:type].nil? or self[:type] = :element
17
+ if self[:type].nil?
18
+ self[:type] = :element
19
+ self[:element] = Array.new
20
+ end
21
+ self[:element] << SOAP::XSD::Element.new( content )
22
+ when "choice"
23
+ raise SOAP::LCElementError, "Malformated sequence" unless self[:type].nil? or self[:type] = :choice
24
+ self[:type] = :choice
25
+ ###############################################################################
26
+ warn "xsd:choice in xsd:sequence is not yet supported!"
27
+ ###############################################################################
28
+ when "group"
29
+ raise SOAP::LCElementError, "Malformated sequence" unless self[:type].nil? or self[:type] = :group
30
+ self[:type] = :group
31
+ ###############################################################################
32
+ warn "xsd:group in xsd:sequence is not yet supported!"
33
+ ###############################################################################
34
+ when "sequence"
35
+ raise SOAP::LCElementError, "Malformated sequence" unless self[:type].nil? or self[:type] = :sequence
36
+ self[:type] = :sequence
37
+ ###############################################################################
38
+ warn "xsd:sequence in xsd:sequence is not yet supported!"
39
+ ###############################################################################
40
+ when "any"
41
+ raise SOAP::LCElementError, "Malformated sequence" unless self[:type].nil? or self[:type] = :any
42
+ self[:type] = :any
43
+ ###############################################################################
44
+ warn "xsd:any in xsd:sequence is not yet supported!"
45
+ ###############################################################################
46
+ else
47
+ raise SOAP::LCElementError, "Invalid element `#{content.name}' in xsd:sequence"
48
+ end
49
+ }
50
+ end
51
+
52
+ def display( types, args )
53
+ r = ""
54
+
55
+ case self[:type]
56
+ when :element
57
+ self[:element].each { |element|
58
+ r << element.display( types, args )
59
+ }
60
+ when :choice
61
+ ###############################################################################
62
+ warn "xsd:choice in xsd:sequence is not yet supported!"
63
+ ###############################################################################
64
+ when :group
65
+ ###############################################################################
66
+ warn "xsd:group in xsd:sequence is not yet supported!"
67
+ ###############################################################################
68
+ when :sequence
69
+ ###############################################################################
70
+ warn "xsd:sequence in xsd:sequence is not yet supported!"
71
+ ###############################################################################
72
+ when :any
73
+ ###############################################################################
74
+ warn "xsd:any in xsd:sequence is not yet supported!"
75
+ ###############################################################################
76
+ else
77
+ raise SOAP::LCWSDLError, "Malformated sequence `#{self[:name]}'"
78
+ end
79
+
80
+ return r
81
+ end
82
+
83
+ def responseToHash( xml, types )
84
+ r = {}
85
+
86
+ case self[:type]
87
+ when :element
88
+ self[:element].each { |element|
89
+ element.responseToHash( xml, types ).each { |k, v|
90
+ r[k] = v
91
+ }
92
+ }
93
+ when :choice
94
+ ###############################################################################
95
+ warn "xsd:choice in xsd:sequence is not yet supported!"
96
+ ###############################################################################
97
+ when :group
98
+ ###############################################################################
99
+ warn "xsd:group in xsd:sequence is not yet supported!"
100
+ ###############################################################################
101
+ when :sequence
102
+ ###############################################################################
103
+ warn "xsd:sequence in xsd:sequence is not yet supported!"
104
+ ###############################################################################
105
+ when :any
106
+ ###############################################################################
107
+ warn "xsd:any in xsd:sequence is not yet supported!"
108
+ ###############################################################################
109
+ else
110
+ raise SOAP::LCWSDLError, "Malformated sequence `#{self[:name]}'"
111
+ end
112
+
113
+ return r
114
+ end
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,83 @@
1
+ module SOAP
2
+ class XSD
3
+ class SimpleType < Hash
4
+ def initialize( type )
5
+ type.attributes.each { |name, value|
6
+ self[name.to_sym] = value
7
+ }
8
+
9
+ type.find_all{ |e| e.class == REXML::Element }.each { |content|
10
+ case content.name
11
+ when "list"
12
+ raise SOAP::LCElementError, "Malformated simpleType `#{type.attributes['name']}'" unless self[:type].nil?
13
+ self[:type] = :list
14
+ self[:list] = nil
15
+ ###############################################################################
16
+ warn "xsd:list in xsd:simpleType is not yet supported!"
17
+ ###############################################################################
18
+ when "union"
19
+ raise SOAP::LCElementError, "Malformated simpleType `#{type.attributes['name']}'" unless self[:type].nil?
20
+ self[:type] = :union
21
+ self[:union] = nil
22
+ ###############################################################################
23
+ warn "xsd:union in xsd:simpleType is not yet supported!"
24
+ ###############################################################################
25
+ when "restriction"
26
+ raise SOAP::LCElementError, "Malformated simpleType `#{type.attributes['name']}'" unless self[:type].nil?
27
+ self[:type] = :restriction
28
+ self[:restriction] = SOAP::XSD::Restriction.new( content )
29
+ when "annotation"
30
+ ###############################################################################
31
+ warn "xsd:annotation in xsd:simpleType is not yet supported!"
32
+ ###############################################################################
33
+ else
34
+ raise SOAP::LCElementError, "Invalid element `#{content.name}' in xsd:simpleType `#{type.attributes['name']}'"
35
+ end
36
+ }
37
+ end
38
+
39
+ def display( types, args )
40
+ r = ""
41
+
42
+ case self[:type]
43
+ when :restriction
44
+ # TODO ########################################################################
45
+ # TODO ########################################################################
46
+ # TODO ########################################################################
47
+ # TODO ########################################################################
48
+ when :list
49
+ ###############################################################################
50
+ warn "xsd:list in xsd:simpleType is not yet supported!"
51
+ ###############################################################################
52
+ when :union
53
+ ###############################################################################
54
+ warn "xsd:union in xsd:simpleType is not yet supported!"
55
+ ###############################################################################
56
+ else
57
+ raise SOAP::LCWSDLError, "Malformated simpleType `#{self[:name]}'"
58
+ end
59
+
60
+ return r
61
+ end
62
+
63
+ def responseToHash( xml, types )
64
+ r = nil
65
+ case self[:type]
66
+ when :restriction
67
+ r = self[:restriction].responseToHash( xml, types )
68
+ when :list
69
+ ###############################################################################
70
+ warn "xsd:list in xsd:simpleType is not yet supported!"
71
+ ###############################################################################
72
+ when :union
73
+ ###############################################################################
74
+ warn "xsd:union in xsd:simpleType is not yet supported!"
75
+ ###############################################################################
76
+ else
77
+ raise SOAP::LCWSDLError, "Malformated simpleType `#{self[:name]}'"
78
+ end
79
+ return r
80
+ end
81
+ end
82
+ end
83
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soap-lc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Gr\xC3\xA9goire Lejeune"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-24 00:00:00 +01:00
12
+ date: 2009-01-30 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -43,9 +43,11 @@ files:
43
43
  - setup.rb
44
44
  - lib/soap
45
45
  - lib/soap/lc
46
+ - lib/soap/lc/core_ext.rb
46
47
  - lib/soap/lc/error.rb
47
48
  - lib/soap/lc/request.rb
48
49
  - lib/soap/lc/response.rb
50
+ - lib/soap/lc/version.rb
49
51
  - lib/soap/lc/wsdl
50
52
  - lib/soap/lc/wsdl/binding.rb
51
53
  - lib/soap/lc/wsdl/message.rb
@@ -53,8 +55,27 @@ files:
53
55
  - lib/soap/lc/wsdl/portType.rb
54
56
  - lib/soap/lc/wsdl/service.rb
55
57
  - lib/soap/lc/wsdl.rb
58
+ - lib/soap/lc/xsd
59
+ - lib/soap/lc/xsd/complextype.rb
60
+ - lib/soap/lc/xsd/convert.rb
61
+ - lib/soap/lc/xsd/element.rb
62
+ - lib/soap/lc/xsd/enumeration.rb
63
+ - lib/soap/lc/xsd/restriction.rb
64
+ - lib/soap/lc/xsd/sequence.rb
65
+ - lib/soap/lc/xsd/simpletype.rb
56
66
  - lib/soap/lc/xsd.rb
57
67
  - lib/soap/lc.rb
68
+ - examples/HelloService.wsdl
69
+ - examples/mono
70
+ - examples/mono/index.html
71
+ - examples/mono/NumberService.asmx
72
+ - examples/mono/README.txt
73
+ - examples/StockQuote.wsdl
74
+ - examples/t_000.rb
75
+ - examples/t_001.rb
76
+ - examples/t_002.rb
77
+ - examples/t_00X.rb
78
+ - examples/t_010.rb
58
79
  has_rdoc: true
59
80
  homepage: http://greg.rubyfr.net
60
81
  post_install_message: