soap-lc 0.0.1

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,86 @@
1
+ module SOAP
2
+ class WSDL
3
+ class PortTypes < Hash
4
+ end
5
+
6
+ class PortType
7
+ attr_reader :operations
8
+ attr_reader :name
9
+
10
+ def initialize( element )
11
+ @operations = Hash.new
12
+ @name = element.attributes['name']
13
+
14
+ # Process all operations
15
+ element.find_all {|e| e.class == REXML::Element }.each { |operation|
16
+ case operation.name
17
+ when "operation"
18
+ @operations[operation.attributes['name']] = Hash.new
19
+
20
+ # Store operation attributs
21
+ operation.attributes.each { |name, value|
22
+ case name
23
+ when 'name'
24
+ @operations[operation.attributes['name']][:name] = value
25
+ else
26
+ warn "Ignoring attribut `#{name}' in operation `#{operation.attributes['name']}' for portType `#{element.attributes['name']}'"
27
+ end
28
+ }
29
+
30
+ # Store operation input, output and/or fault
31
+ operation.find_all {|e| e.class == REXML::Element }.each { |action|
32
+ case action.name
33
+ when "input"
34
+ @operations[operation.attributes['name']][:input] = Hash.new
35
+
36
+ # Store input attributs
37
+ action.attributes.each { |name, value|
38
+ case name
39
+ when 'name'
40
+ @operations[operation.attributes['name']][:input][:name] = value
41
+ when 'message'
42
+ @operations[operation.attributes['name']][:input][:message] = value
43
+ else
44
+ warn "Ignoring attribut `#{name}' in #{action.name} `#{action.attributes['name']}' in operation `#{operation.attributes['name']}' for portType `#{element.attributes['name']}'"
45
+ end
46
+ }
47
+ when "output"
48
+ @operations[operation.attributes['name']][:output] = Hash.new
49
+
50
+ # Store output attributs
51
+ action.attributes.each { |name, value|
52
+ case name
53
+ when 'name'
54
+ @operations[operation.attributes['name']][:output][:name] = value
55
+ when 'message'
56
+ @operations[operation.attributes['name']][:output][:message] = value
57
+ else
58
+ warn "Ignoring attribut `#{name}' in #{action.name} `#{action.attributes['name']}' in operation `#{operation.attributes['name']}' for portType `#{element.attributes['name']}'"
59
+ end
60
+ }
61
+ when "fault"
62
+ @operations[operation.attributes['name']][:fault] = Hash.new
63
+
64
+ # Store output attributs
65
+ action.attributes.each { |name, value|
66
+ case name
67
+ when 'name'
68
+ @operations[operation.attributes['name']][:fault][:name] = value
69
+ when 'message'
70
+ @operations[operation.attributes['name']][:fault][:message] = value
71
+ else
72
+ warn "Ignoring attribut `#{name}' in #{action.name} `#{action.attributes['name']}' in operation `#{operation.attributes['name']}' for portType `#{element.attributes['name']}'"
73
+ end
74
+ }
75
+ else
76
+ warn "Ignoring element `#{action.name}' in operation `#{operation.attributes['name']}' for portType `#{element.attributes['name']}'"
77
+ end
78
+ }
79
+ else
80
+ warn "Ignoring element `#{operation.name}' in portType `#{element.attributes['name']}'"
81
+ end
82
+ }
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,56 @@
1
+ module SOAP
2
+ class WSDL
3
+ class Services < Hash
4
+ def getServicePortForBindingName( name )
5
+ self.each do |binding_name, binding|
6
+ binding.ports.each do |port_name, port|
7
+ return port if port[:binding].nns == name
8
+ end
9
+ end
10
+ return nil
11
+ end
12
+ end
13
+
14
+ class Service
15
+ attr_reader :ports
16
+ attr_reader :name
17
+
18
+ def initialize( element )
19
+ @ports = Hash.new
20
+ @name = element.attributes['name']
21
+
22
+ # Process all ports
23
+ element.find_all {|e| e.class == REXML::Element }.each { |port|
24
+ case port.name
25
+ when "port"
26
+ @ports[port.attributes['name']] = Hash.new
27
+
28
+ # Store port attributs
29
+ port.attributes.each { |name, value|
30
+ case name
31
+ when 'name'
32
+ @ports[port.attributes['name']][:name] = value
33
+ when 'binding'
34
+ @ports[port.attributes['name']][:binding] = value
35
+ else
36
+ warn "Ignoring attribut `#{name}' in port `#{port.attributes['name']}' for service `#{element.attributes['name']}'"
37
+ end
38
+ }
39
+
40
+ # Store port soap:address
41
+ port.find_all {|e| e.class == REXML::Element }.each { |address|
42
+ case address.name
43
+ when "address"
44
+ @ports[port.attributes['name']][:address] = address.attributes['location']
45
+ else
46
+ warn "Ignoring element `#{address.name}' in port `#{port.attributes['name']}' for service `#{element.attributes['name']}'"
47
+ end
48
+ }
49
+ else
50
+ warn "Ignoring element `#{port.name}' in service `#{element.attributes['name']}'"
51
+ end
52
+ }
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,518 @@
1
+ module SOAP
2
+ class XSD
3
+ attr_reader :elements
4
+ attr_reader :simpleTypes
5
+ attr_reader :complexType
6
+
7
+ ANY_SIMPLE_TYPE = %w(duration dateTime time date gYearMonth gYear gMonthDay gDay gMonth
8
+ boolean base64Binary hexBinary float double anyURI QName NOTATION string normalizedString
9
+ token language Name NMTOKEN NCName NMTOKENS ID IDREF ENTITY IDREFS ENTITIES
10
+ decimal integer nonPositiveInteger long nonNegativeInteger negativeInteger int unsignedLong positiveInteger
11
+ short unsignedInt byte unsignedShort unsignedByte)
12
+
13
+ def initialize( )
14
+ @elements = Hash.new
15
+ @simpleTypes = Hash.new
16
+ @complexTypes = Hash.new
17
+ @types = Hash.new
18
+ end
19
+
20
+ def add_schema( types )
21
+ # Process all schema
22
+ types.children.find_all{|e| e.class == REXML::Element }.each { |schema|
23
+ schema.find_all{ |e| e.class == REXML::Element }.each { |type|
24
+ processType type
25
+ }
26
+ }
27
+ end
28
+
29
+ def any_defined_type
30
+ @types.keys
31
+ end
32
+
33
+ def []( name )
34
+ @types[name]
35
+ end
36
+
37
+ def self.displayBuiltinType( name, args, min = 1, max = 1 )
38
+ r = ""
39
+
40
+ if args.keys.include?( name.to_sym )
41
+ args[name.to_sym] = [args[name.to_sym]] unless args[name.to_sym].class == Array
42
+ if args[name.to_sym].size < min or args[name.to_sym].size > max
43
+ raise SOAP::LCArgumentError, "Wrong number or values for parameter `#{name}'"
44
+ end
45
+ args[name.to_sym].each { |v|
46
+ r << "<#{name}>#{v}</#{name}>\n"
47
+ }
48
+ elsif min > 0
49
+ raise SOAP::LCArgumentError, "Missing parameter `#{name}'" if min > 0
50
+ end
51
+
52
+ return r
53
+ end
54
+
55
+ private
56
+ def processType( type )
57
+ case type.name
58
+ when "element"
59
+ @elements[type.attributes['name']] = SOAP::XSD::Element.new( type )
60
+ @types[type.attributes['name']] = {
61
+ :type => :element,
62
+ :value => @elements[type.attributes['name']]
63
+ }
64
+ when "complexType"
65
+ @complexTypes[type.attributes['name']] = SOAP::XSD::ComplexType.new( type )
66
+ @types[type.attributes['name']] = {
67
+ :type => :complexType,
68
+ :value => @complexTypes[type.attributes['name']]
69
+ }
70
+ when "simpleType"
71
+ @simpleTypes[type.attributes['name']] = SOAP::XSD::SimpleType.new( type )
72
+ @types[type.attributes['name']] = {
73
+ :type => :simpleType,
74
+ :value => @simpleTypes[type.attributes['name']]
75
+ }
76
+ else
77
+ warn "Ignoring type `#{type.name}'"
78
+ end
79
+ end
80
+
81
+ class Restriction < Hash
82
+ def initialize( content )
83
+ content.attributes.each { |name, value|
84
+ self[name.to_sym] = value
85
+ }
86
+ content.find_all{ |e| e.class == REXML::Element }.each { |restrictions|
87
+ case restrictions.name
88
+ when "annotation"
89
+ ###############################################################################
90
+ warn "xsd:annotation in xsd:restriction is not yet supported!"
91
+ ###############################################################################
92
+ when "fractionDigits"
93
+ ###############################################################################
94
+ warn "xsd:fractionDigits in xsd:restriction is not yet supported!"
95
+ ###############################################################################
96
+ when "enumeration"
97
+ self[:enumeration] = SOAP::XSD::Enumeration.new unless self.has_key?( :enumeration )
98
+ self[:enumeration] << restrictions.attributes['value']
99
+ when "length"
100
+ ###############################################################################
101
+ warn "xsd:length in xsd:restriction is not yet supported!"
102
+ ###############################################################################
103
+ when "maxExclusive"
104
+ ###############################################################################
105
+ warn "xsd:maxExclusive in xsd:restriction is not yet supported!"
106
+ ###############################################################################
107
+ when "maxInclusive"
108
+ ###############################################################################
109
+ warn "xsd:maxInclusive in xsd:restriction is not yet supported!"
110
+ ###############################################################################
111
+ when "maxLength"
112
+ ###############################################################################
113
+ warn "xsd:maxLength in xsd:restriction is not yet supported!"
114
+ ###############################################################################
115
+ when "minExclusive"
116
+ ###############################################################################
117
+ warn "xsd:minExclusive in xsd:restriction is not yet supported!"
118
+ ###############################################################################
119
+ when "minInclusive"
120
+ ###############################################################################
121
+ warn "xsd:minInclusive in xsd:restriction is not yet supported!"
122
+ ###############################################################################
123
+ when "minLength"
124
+ ###############################################################################
125
+ warn "xsd:minLength in xsd:restriction is not yet supported!"
126
+ ###############################################################################
127
+ when "pattern"
128
+ ###############################################################################
129
+ warn "xsd:pattern in xsd:restriction is not yet supported!"
130
+ ###############################################################################
131
+ when "simpleType"
132
+ ###############################################################################
133
+ warn "xsd:simpleType in xsd:restriction is not yet supported!"
134
+ ###############################################################################
135
+ when "totalDigits"
136
+ ###############################################################################
137
+ warn "xsd:totalDigits in xsd:restriction is not yet supported!"
138
+ ###############################################################################
139
+ when "whiteSpace"
140
+ ###############################################################################
141
+ warn "xsd:whiteSpace in xsd:restriction is not yet supported!"
142
+ ###############################################################################
143
+ else
144
+ warn "Ignoring `#{restrictions.name}' in xsd:restriction for xsd:simpleType `#{type.attributes['name']}'"
145
+ end
146
+ }
147
+ end
148
+ end
149
+
150
+ class Enumeration < Array
151
+ end
152
+
153
+ class Sequence < Hash
154
+ def initialize( type )
155
+ type.attributes.each { |name, value|
156
+ self[name.to_sym] = value
157
+ }
158
+
159
+ type.find_all{ |e| e.class == REXML::Element }.each { |content|
160
+ case content.name
161
+ when "annotation"
162
+ ###############################################################################
163
+ warn "xsd:annotation in xsd:sequence is not yet supported!"
164
+ ###############################################################################
165
+ when "element"
166
+ raise SOAP::LCElementError, "Malformated sequence" unless self[:type].nil? or self[:type] = :element
167
+ if self[:type].nil?
168
+ self[:type] = :element
169
+ self[:element] = Array.new
170
+ end
171
+ self[:element] << SOAP::XSD::Element.new( content )
172
+ when "choice"
173
+ raise SOAP::LCElementError, "Malformated sequence" unless self[:type].nil? or self[:type] = :choice
174
+ self[:type] = :choice
175
+ ###############################################################################
176
+ warn "xsd:choice in xsd:sequence is not yet supported!"
177
+ ###############################################################################
178
+ when "group"
179
+ raise SOAP::LCElementError, "Malformated sequence" unless self[:type].nil? or self[:type] = :group
180
+ self[:type] = :group
181
+ ###############################################################################
182
+ warn "xsd:group in xsd:sequence is not yet supported!"
183
+ ###############################################################################
184
+ when "sequence"
185
+ raise SOAP::LCElementError, "Malformated sequence" unless self[:type].nil? or self[:type] = :sequence
186
+ self[:type] = :sequence
187
+ ###############################################################################
188
+ warn "xsd:sequence in xsd:sequence is not yet supported!"
189
+ ###############################################################################
190
+ when "any"
191
+ raise SOAP::LCElementError, "Malformated sequence" unless self[:type].nil? or self[:type] = :any
192
+ self[:type] = :any
193
+ ###############################################################################
194
+ warn "xsd:any in xsd:sequence is not yet supported!"
195
+ ###############################################################################
196
+ else
197
+ raise SOAP::LCElementError, "Invalid element `#{content.name}' in xsd:sequence"
198
+ end
199
+ }
200
+ end
201
+
202
+ def display( types, args )
203
+ r = ""
204
+
205
+ case self[:type]
206
+ when :element
207
+ self[:element].each { |element|
208
+ r << element.display( types, args )
209
+ }
210
+ when :choice
211
+ ###############################################################################
212
+ warn "xsd:choice in xsd:sequence is not yet supported!"
213
+ ###############################################################################
214
+ when :group
215
+ ###############################################################################
216
+ warn "xsd:group in xsd:sequence is not yet supported!"
217
+ ###############################################################################
218
+ when :sequence
219
+ ###############################################################################
220
+ warn "xsd:sequence in xsd:sequence is not yet supported!"
221
+ ###############################################################################
222
+ when :any
223
+ ###############################################################################
224
+ warn "xsd:any in xsd:sequence is not yet supported!"
225
+ ###############################################################################
226
+ else
227
+ raise SOAP::LCWSDLError, "Malformated sequence `#{self[:name]}'"
228
+ end
229
+
230
+ return r
231
+ end
232
+ end
233
+
234
+ class SimpleType < Hash
235
+ def initialize( type )
236
+ type.attributes.each { |name, value|
237
+ self[name.to_sym] = value
238
+ }
239
+
240
+ type.find_all{ |e| e.class == REXML::Element }.each { |content|
241
+ case content.name
242
+ when "list"
243
+ raise SOAP::LCElementError, "Malformated simpleType `#{type.attributes['name']}'" unless self[:type].nil?
244
+ self[:type] = :list
245
+ self[:list] = nil
246
+ ###############################################################################
247
+ warn "xsd:list in xsd:simpleType is not yet supported!"
248
+ ###############################################################################
249
+ when "union"
250
+ raise SOAP::LCElementError, "Malformated simpleType `#{type.attributes['name']}'" unless self[:type].nil?
251
+ self[:type] = :union
252
+ self[:union] = nil
253
+ ###############################################################################
254
+ warn "xsd:union in xsd:simpleType is not yet supported!"
255
+ ###############################################################################
256
+ when "restriction"
257
+ raise SOAP::LCElementError, "Malformated simpleType `#{type.attributes['name']}'" unless self[:type].nil?
258
+ self[:type] = :restriction
259
+ self[:restriction] = SOAP::XSD::Restriction.new( content )
260
+ when "annotation"
261
+ ###############################################################################
262
+ warn "xsd:annotation in xsd:simpleType is not yet supported!"
263
+ ###############################################################################
264
+ else
265
+ raise SOAP::LCElementError, "Invalid element `#{content.name}' in xsd:simpleType `#{type.attributes['name']}'"
266
+ end
267
+ }
268
+ end
269
+
270
+ def display( types, args )
271
+ r = ""
272
+
273
+ case self[:type]
274
+ when :restriction
275
+ # TODO ########################################################################
276
+ # TODO ########################################################################
277
+ # TODO ########################################################################
278
+ # TODO ########################################################################
279
+ when :list
280
+ ###############################################################################
281
+ warn "xsd:list in xsd:simpleType is not yet supported!"
282
+ ###############################################################################
283
+ when :union
284
+ ###############################################################################
285
+ warn "xsd:union in xsd:simpleType is not yet supported!"
286
+ ###############################################################################
287
+ else
288
+ raise SOAP::LCWSDLError, "Malformated simpleType `#{self[:name]}'"
289
+ end
290
+
291
+ return r
292
+ end
293
+
294
+ end
295
+
296
+ class ComplexType < Hash
297
+ def initialize( type )
298
+ type.attributes.each { |name, value|
299
+ self[name.to_sym] = value
300
+ }
301
+
302
+ type.find_all{ |e| e.class == REXML::Element }.each { |content|
303
+ case content.name
304
+ when "simpleContent"
305
+ raise SOAP::LCElementError, "Malformated complexType `#{type.attributes['name']}'" unless self[:type].nil?
306
+ self[:type] = :simpleContent
307
+ ###############################################################################
308
+ warn "xsd:simpleContent in xsd:complexType (global definition) is not yet supported!"
309
+ ###############################################################################
310
+ when "complexContent"
311
+ raise SOAP::LCElementError, "Malformated complexType `#{type.attributes['name']}'" unless self[:type].nil?
312
+ self[:type] = :complexContent
313
+ ###############################################################################
314
+ warn "xsd:complexContent in xsd:complexType (global definition) is not yet supported!"
315
+ ###############################################################################
316
+ when "group"
317
+ raise SOAP::LCElementError, "Malformated complexType `#{type.attributes['name']}'" unless self[:type].nil?
318
+ self[:type] = :group
319
+ ###############################################################################
320
+ warn "xsd:group in xsd:complexType (global definition) is not yet supported!"
321
+ ###############################################################################
322
+ when "all"
323
+ raise SOAP::LCElementError, "Malformated complexType `#{type.attributes['name']}'" unless self[:type].nil?
324
+ self[:type] = :all
325
+ ###############################################################################
326
+ warn "xsd:all in xsd:complexType (global definition) is not yet supported!"
327
+ ###############################################################################
328
+ when "choise"
329
+ raise SOAP::LCElementError, "Malformated complexType `#{type.attributes['name']}'" unless self[:type].nil?
330
+ self[:type] = :choise
331
+ ###############################################################################
332
+ warn "xsd:choise in xsd:complexType (global definition) is not yet supported!"
333
+ ###############################################################################
334
+ when "sequence"
335
+ raise SOAP::LCElementError, "Malformated complexType `#{type.attributes['name']}'" unless self[:type].nil?
336
+ self[:type] = :sequence
337
+ self[:sequence] = SOAP::XSD::Sequence.new( content )
338
+ when "attribute"
339
+ raise SOAP::LCElementError, "Malformated complexType `#{type.attributes['name']}'" if (not(self[:attributes_type].nil?) and self[:attributes_type] != :attribute) or [:simpleContent, :complexContent].include?(self[:type])
340
+ self[:attributes_type] = :attribute
341
+ ###############################################################################
342
+ warn "xsd:attribute in xsd:complexType (global definition) is not yet supported!"
343
+ ###############################################################################
344
+ when "attributeGroup"
345
+ raise SOAP::LCElementError, "Malformated complexType `#{type.attributes['name']}'" if (not(self[:attributes_type].nil?) and self[:attributes_type] != :attributeGroup) or [:simpleContent, :complexContent].include?(self[:type])
346
+ self[:attributes_type] = :attributeGroup
347
+ ###############################################################################
348
+ warn "xsd:attributeGroup in xsd:complexType (global definition) is not yet supported!"
349
+ ###############################################################################
350
+ when "anyAttribute"
351
+ raise SOAP::LCElementError, "Malformated complexType `#{type.attributes['name']}'" if not(self[:any_attributes].nil?) or [:simpleContent, :complexContent].include?(self[:type])
352
+ self[:any_attributes] = :anyAttribute
353
+ ###############################################################################
354
+ warn "xsd:anyAttribute in xsd:complexType (global definition) is not yet supported!"
355
+ ###############################################################################
356
+ when "annotation"
357
+ ###############################################################################
358
+ warn "xsd:annotation in xsd:complexType (global definition) (global definition) is not yet supported!"
359
+ ###############################################################################
360
+ else
361
+ raise SOAP::LCElementError, "Invalid element `#{content.name}' in xsd:complexType `#{type.attributes['name']}'"
362
+ end
363
+ }
364
+ end
365
+
366
+ def display( types, args )
367
+ r = ""
368
+
369
+ case self[:type]
370
+ when :simpleContent
371
+ ###############################################################################
372
+ warn "xsd:simpleContent in xsd:complexType (global definition) is not yet supported!"
373
+ ###############################################################################
374
+ when :complexContent
375
+ ###############################################################################
376
+ warn "xsd:complexContent in xsd:complexType (global definition) is not yet supported!"
377
+ ###############################################################################
378
+ when :group
379
+ ###############################################################################
380
+ warn "xsd:group in xsd:complexType (global definition) is not yet supported!"
381
+ ###############################################################################
382
+ when :all
383
+ ###############################################################################
384
+ warn "xsd:all in xsd:complexType (global definition) is not yet supported!"
385
+ ###############################################################################
386
+ when :choise
387
+ ###############################################################################
388
+ warn "xsd:choise in xsd:complexType (global definition) is not yet supported!"
389
+ ###############################################################################
390
+ when :sequence
391
+ r << self[:sequence].display( types, args )
392
+ else
393
+ raise SOAP::LCWSDLError, "Malformated complexType `#{self[:name]}'"
394
+ end
395
+
396
+ return r
397
+ end
398
+ end
399
+
400
+ class Element < Hash
401
+ def initialize( type )
402
+ type.attributes.each { |name, value|
403
+ self[name.to_sym] = value
404
+ }
405
+
406
+ type.find_all{ |e| e.class == REXML::Element }.each { |content|
407
+ case content.name
408
+ when "simpleType"
409
+ raise SOAP::LCElementError, "Malformated element `#{type.attributes['name']}'" unless self[:type].nil?
410
+ self[:type] = :simpleType
411
+ ###############################################################################
412
+ warn "xsd:simpleType in xsd:element is not yet supported!"
413
+ ###############################################################################
414
+ when "complexType"
415
+ raise SOAP::LCElementError, "Malformated element `#{type.attributes['name']}'" unless self[:type].nil?
416
+ self[:type] = :complexType
417
+ self[:complexType] = SOAP::XSD::ComplexType.new( content )
418
+ when "unique"
419
+ raise SOAP::LCElementError, "Malformated element `#{type.attributes['name']}'" unless self[:key].nil?
420
+ self[:key] = :unique
421
+ ###############################################################################
422
+ warn "xsd:unique in xsd:element is not yet supported!"
423
+ ###############################################################################
424
+ when "key"
425
+ raise SOAP::LCElementError, "Malformated element `#{type.attributes['name']}'" unless self[:key].nil?
426
+ self[:key] = :key
427
+ ###############################################################################
428
+ warn "xsd:unique in xsd:element is not yet supported!"
429
+ ###############################################################################
430
+ when "keyref"
431
+ raise SOAP::LCElementError, "Malformated element `#{type.attributes['name']}'" unless self[:key].nil?
432
+ self[:key] = :keyref
433
+ ###############################################################################
434
+ warn "xsd:unique in xsd:element is not yet supported!"
435
+ ###############################################################################
436
+ when "annotation"
437
+ ###############################################################################
438
+ warn "xsd:annotation in xsd:complexType (global definition) (global definition) is not yet supported!"
439
+ ###############################################################################
440
+ else
441
+ raise SOAP::LCElementError, "Invalid element `#{content.name}' in xsd:element `#{type.attributes['name']}'"
442
+ end
443
+ }
444
+ end
445
+
446
+ def display( types, args )
447
+ r = ""
448
+
449
+ min, max = getOccures( args )
450
+ if SOAP::XSD::ANY_SIMPLE_TYPE.include?( self[:type].nns )
451
+ r << SOAP::XSD.displayBuiltinType( self[:name], args, min, max )
452
+ else
453
+ case types[self[:type].nns][:type]
454
+ when :simpleType
455
+ if args.keys.include?( self[:name].to_sym )
456
+ args[self[:name].to_sym] = [args[self[:name].to_sym]] unless args[self[:name].to_sym].class == Array
457
+ if args[self[:name].to_sym].size < min or args[self[:name].to_sym].size > max
458
+ raise SOAP::LCArgumentError, "Wrong number or values for parameter `#{name}'"
459
+ end
460
+ args[self[:name].to_sym].each { |v|
461
+ r << "<#{self[:name]}>"
462
+ r << "#{v}" ############ CHECK !!!
463
+ r << "</#{self[:name]}>\n"
464
+ }
465
+ elsif min > 0
466
+ raise SOAP::LCArgumentError, "Missing parameter `#{name}'" if min > 0
467
+ end
468
+ when :complexType
469
+ if args.keys.include?( self[:name].to_sym )
470
+ if args.keys.include?( self[:name].to_sym )
471
+ args[self[:name].to_sym] = [args[self[:name].to_sym]] unless args[self[:name].to_sym].class == Array
472
+ if args[self[:name].to_sym].size < min or args[self[:name].to_sym].size > max
473
+ raise SOAP::LCArgumentError, "Wrong number or values for parameter `#{name}'"
474
+ end
475
+ args[self[:name].to_sym].each { |v|
476
+ r << "<#{self[:name]}>"
477
+ r << types[self[:type].nns][:value].display( types, v )
478
+ r << "</#{self[:name]}>\n"
479
+ }
480
+ elsif min > 0
481
+ raise SOAP::LCArgumentError, "Missing parameter `#{name}'" if min > 0
482
+ end
483
+ else
484
+ r << "<#{self[:name]}>\n"
485
+ r << types[self[:type].nns][:value].display( types, args )
486
+ r << "</#{self[:name]}>\n"
487
+ end
488
+ else
489
+ raise SOAL::LCWSDLError, "Malformated element `#{self[:name]}'"
490
+ end
491
+ end
492
+
493
+ return r
494
+ end
495
+
496
+ def getOccures( args )
497
+ element_min = self[:minOccurs].to_i || 1
498
+ element_max = self[:maxOccurs] || "1"
499
+ if element_max == "unbounded"
500
+ if args.keys.include?(self[:name].to_sym)
501
+ if args[self[:name].to_sym].class == Array
502
+ element_max = args[self[:name].to_sym].size
503
+ else
504
+ element_max = 1
505
+ end
506
+ else
507
+ element_max = 1
508
+ end
509
+ else
510
+ element_max = element_max.to_i
511
+ end
512
+
513
+ return( [element_min, element_max] )
514
+ end
515
+
516
+ end
517
+ end
518
+ end