soap4r_es 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.
Files changed (165) hide show
  1. checksums.yaml +7 -0
  2. data/bin/wsdl2ruby.rb +140 -0
  3. data/bin/wsdl2ruby_rails.rb +140 -0
  4. data/bin/xsd2ruby.rb +92 -0
  5. data/lib/soap/attachment.rb +109 -0
  6. data/lib/soap/attrproxy.rb +35 -0
  7. data/lib/soap/baseData.rb +1095 -0
  8. data/lib/soap/element.rb +278 -0
  9. data/lib/soap/encodingstyle/aspDotNetHandler.rb +208 -0
  10. data/lib/soap/encodingstyle/handler.rb +121 -0
  11. data/lib/soap/encodingstyle/literalHandler.rb +196 -0
  12. data/lib/soap/encodingstyle/soapHandler.rb +560 -0
  13. data/lib/soap/filter/filterchain.rb +52 -0
  14. data/lib/soap/filter/handler.rb +32 -0
  15. data/lib/soap/filter/streamhandler.rb +30 -0
  16. data/lib/soap/filter.rb +14 -0
  17. data/lib/soap/generator.rb +299 -0
  18. data/lib/soap/header/handler.rb +64 -0
  19. data/lib/soap/header/handlerset.rb +78 -0
  20. data/lib/soap/header/mappinghandler.rb +48 -0
  21. data/lib/soap/header/simplehandler.rb +45 -0
  22. data/lib/soap/httpconfigloader.rb +140 -0
  23. data/lib/soap/mapping/encodedregistry.rb +541 -0
  24. data/lib/soap/mapping/factory.rb +389 -0
  25. data/lib/soap/mapping/literalregistry.rb +392 -0
  26. data/lib/soap/mapping/mapping.rb +577 -0
  27. data/lib/soap/mapping/registry.rb +297 -0
  28. data/lib/soap/mapping/rubytypeFactory.rb +446 -0
  29. data/lib/soap/mapping/schemadefinition.rb +171 -0
  30. data/lib/soap/mapping/typeMap.rb +107 -0
  31. data/lib/soap/mapping/wsdlencodedregistry.rb +212 -0
  32. data/lib/soap/mapping/wsdlliteralregistry.rb +249 -0
  33. data/lib/soap/mapping.rb +13 -0
  34. data/lib/soap/marshal.rb +60 -0
  35. data/lib/soap/mimemessage.rb +243 -0
  36. data/lib/soap/nestedexception.rb +43 -0
  37. data/lib/soap/netHttpClient.rb +242 -0
  38. data/lib/soap/ns.rb +39 -0
  39. data/lib/soap/parser.rb +253 -0
  40. data/lib/soap/processor.rb +67 -0
  41. data/lib/soap/property.rb +330 -0
  42. data/lib/soap/proxy.rb +15 -0
  43. data/lib/soap/rpc/cgistub.rb +249 -0
  44. data/lib/soap/rpc/driver.rb +222 -0
  45. data/lib/soap/rpc/element.rb +375 -0
  46. data/lib/soap/rpc/httpserver.rb +144 -0
  47. data/lib/soap/rpc/methodDef.rb +69 -0
  48. data/lib/soap/rpc/proxy.rb +573 -0
  49. data/lib/soap/rpc/router.rb +672 -0
  50. data/lib/soap/rpc/rpc.rb +26 -0
  51. data/lib/soap/rpc/soaplet.rb +201 -0
  52. data/lib/soap/rpc/standaloneServer.rb +44 -0
  53. data/lib/soap/soap.rb +163 -0
  54. data/lib/soap/streamHandler.rb +302 -0
  55. data/lib/soap/version.rb +12 -0
  56. data/lib/soap/wsdlDriver.rb +165 -0
  57. data/lib/wsdl/binding.rb +66 -0
  58. data/lib/wsdl/data.rb +65 -0
  59. data/lib/wsdl/definitions.rb +237 -0
  60. data/lib/wsdl/documentation.rb +33 -0
  61. data/lib/wsdl/import.rb +81 -0
  62. data/lib/wsdl/importer.rb +39 -0
  63. data/lib/wsdl/info.rb +51 -0
  64. data/lib/wsdl/message.rb +55 -0
  65. data/lib/wsdl/operation.rb +152 -0
  66. data/lib/wsdl/operationBinding.rb +241 -0
  67. data/lib/wsdl/param.rb +94 -0
  68. data/lib/wsdl/parser.rb +180 -0
  69. data/lib/wsdl/part.rb +53 -0
  70. data/lib/wsdl/port.rb +67 -0
  71. data/lib/wsdl/portType.rb +76 -0
  72. data/lib/wsdl/service.rb +62 -0
  73. data/lib/wsdl/soap/address.rb +41 -0
  74. data/lib/wsdl/soap/binding.rb +50 -0
  75. data/lib/wsdl/soap/body.rb +59 -0
  76. data/lib/wsdl/soap/cgiStubCreator.rb +93 -0
  77. data/lib/wsdl/soap/classDefCreator.rb +529 -0
  78. data/lib/wsdl/soap/classDefCreatorSupport.rb +242 -0
  79. data/lib/wsdl/soap/classNameCreator.rb +57 -0
  80. data/lib/wsdl/soap/clientSkeltonCreator.rb +107 -0
  81. data/lib/wsdl/soap/complexType.rb +174 -0
  82. data/lib/wsdl/soap/data.rb +43 -0
  83. data/lib/wsdl/soap/definitions.rb +201 -0
  84. data/lib/wsdl/soap/driverCreator.rb +121 -0
  85. data/lib/wsdl/soap/element.rb +34 -0
  86. data/lib/wsdl/soap/encodedMappingRegistryCreator.rb +74 -0
  87. data/lib/wsdl/soap/fault.rb +57 -0
  88. data/lib/wsdl/soap/header.rb +87 -0
  89. data/lib/wsdl/soap/headerfault.rb +57 -0
  90. data/lib/wsdl/soap/literalMappingRegistryCreator.rb +116 -0
  91. data/lib/wsdl/soap/mappingRegistryCreator.rb +59 -0
  92. data/lib/wsdl/soap/mappingRegistryCreatorSupport.rb +380 -0
  93. data/lib/wsdl/soap/methodDefCreator.rb +200 -0
  94. data/lib/wsdl/soap/operation.rb +113 -0
  95. data/lib/wsdl/soap/servantSkeltonCreator.rb +92 -0
  96. data/lib/wsdl/soap/servletStubCreator.rb +105 -0
  97. data/lib/wsdl/soap/standaloneServerStubCreator.rb +101 -0
  98. data/lib/wsdl/soap/wsdl2ruby.rb +249 -0
  99. data/lib/wsdl/types.rb +45 -0
  100. data/lib/wsdl/wsdl.rb +25 -0
  101. data/lib/wsdl/xmlSchema/all.rb +25 -0
  102. data/lib/wsdl/xmlSchema/annotation.rb +35 -0
  103. data/lib/wsdl/xmlSchema/any.rb +62 -0
  104. data/lib/wsdl/xmlSchema/anyAttribute.rb +49 -0
  105. data/lib/wsdl/xmlSchema/attribute.rb +105 -0
  106. data/lib/wsdl/xmlSchema/attributeGroup.rb +69 -0
  107. data/lib/wsdl/xmlSchema/choice.rb +59 -0
  108. data/lib/wsdl/xmlSchema/complexContent.rb +98 -0
  109. data/lib/wsdl/xmlSchema/complexExtension.rb +120 -0
  110. data/lib/wsdl/xmlSchema/complexRestriction.rb +105 -0
  111. data/lib/wsdl/xmlSchema/complexType.rb +194 -0
  112. data/lib/wsdl/xmlSchema/content.rb +96 -0
  113. data/lib/wsdl/xmlSchema/data.rb +117 -0
  114. data/lib/wsdl/xmlSchema/element.rb +154 -0
  115. data/lib/wsdl/xmlSchema/enumeration.rb +37 -0
  116. data/lib/wsdl/xmlSchema/fractiondigits.rb +38 -0
  117. data/lib/wsdl/xmlSchema/group.rb +101 -0
  118. data/lib/wsdl/xmlSchema/import.rb +53 -0
  119. data/lib/wsdl/xmlSchema/importHandler.rb +45 -0
  120. data/lib/wsdl/xmlSchema/importer.rb +103 -0
  121. data/lib/wsdl/xmlSchema/include.rb +48 -0
  122. data/lib/wsdl/xmlSchema/length.rb +38 -0
  123. data/lib/wsdl/xmlSchema/list.rb +49 -0
  124. data/lib/wsdl/xmlSchema/maxexclusive.rb +38 -0
  125. data/lib/wsdl/xmlSchema/maxinclusive.rb +38 -0
  126. data/lib/wsdl/xmlSchema/maxlength.rb +38 -0
  127. data/lib/wsdl/xmlSchema/minexclusive.rb +38 -0
  128. data/lib/wsdl/xmlSchema/mininclusive.rb +38 -0
  129. data/lib/wsdl/xmlSchema/minlength.rb +38 -0
  130. data/lib/wsdl/xmlSchema/parser.rb +168 -0
  131. data/lib/wsdl/xmlSchema/pattern.rb +37 -0
  132. data/lib/wsdl/xmlSchema/ref.rb +34 -0
  133. data/lib/wsdl/xmlSchema/schema.rb +179 -0
  134. data/lib/wsdl/xmlSchema/sequence.rb +55 -0
  135. data/lib/wsdl/xmlSchema/simpleContent.rb +70 -0
  136. data/lib/wsdl/xmlSchema/simpleExtension.rb +63 -0
  137. data/lib/wsdl/xmlSchema/simpleRestriction.rb +133 -0
  138. data/lib/wsdl/xmlSchema/simpleType.rb +88 -0
  139. data/lib/wsdl/xmlSchema/totaldigits.rb +38 -0
  140. data/lib/wsdl/xmlSchema/union.rb +36 -0
  141. data/lib/wsdl/xmlSchema/unique.rb +35 -0
  142. data/lib/wsdl/xmlSchema/whitespace.rb +38 -0
  143. data/lib/wsdl/xmlSchema/xsd2ruby.rb +177 -0
  144. data/lib/xsd/charset.rb +190 -0
  145. data/lib/xsd/codegen/classdef.rb +230 -0
  146. data/lib/xsd/codegen/commentdef.rb +35 -0
  147. data/lib/xsd/codegen/gensupport.rb +277 -0
  148. data/lib/xsd/codegen/methoddef.rb +71 -0
  149. data/lib/xsd/codegen/moduledef.rb +209 -0
  150. data/lib/xsd/codegen.rb +13 -0
  151. data/lib/xsd/datatypes.rb +1465 -0
  152. data/lib/xsd/datatypes1999.rb +21 -0
  153. data/lib/xsd/iconvcharset.rb +33 -0
  154. data/lib/xsd/mapping.rb +69 -0
  155. data/lib/xsd/namedelements.rb +133 -0
  156. data/lib/xsd/ns.rb +183 -0
  157. data/lib/xsd/qname.rb +80 -0
  158. data/lib/xsd/xmlparser/libxmlparser.rb +136 -0
  159. data/lib/xsd/xmlparser/nokogiriparser.rb +63 -0
  160. data/lib/xsd/xmlparser/ogaparser.rb +53 -0
  161. data/lib/xsd/xmlparser/oxparser.rb +97 -0
  162. data/lib/xsd/xmlparser/parser.rb +101 -0
  163. data/lib/xsd/xmlparser/rexmlparser.rb +54 -0
  164. data/lib/xsd/xmlparser.rb +81 -0
  165. metadata +240 -0
@@ -0,0 +1,117 @@
1
+ # encoding: UTF-8
2
+ # WSDL4R - XMLSchema data definitions.
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'xsd/datatypes'
11
+ require 'wsdl/xmlSchema/annotation'
12
+ require 'wsdl/xmlSchema/schema'
13
+ require 'wsdl/xmlSchema/import'
14
+ require 'wsdl/xmlSchema/include'
15
+ require 'wsdl/xmlSchema/simpleType'
16
+ require 'wsdl/xmlSchema/simpleRestriction'
17
+ require 'wsdl/xmlSchema/simpleExtension'
18
+ require 'wsdl/xmlSchema/complexType'
19
+ require 'wsdl/xmlSchema/complexContent'
20
+ require 'wsdl/xmlSchema/complexRestriction'
21
+ require 'wsdl/xmlSchema/complexExtension'
22
+ require 'wsdl/xmlSchema/simpleContent'
23
+ require 'wsdl/xmlSchema/any'
24
+ require 'wsdl/xmlSchema/anyAttribute'
25
+ require 'wsdl/xmlSchema/element'
26
+ require 'wsdl/xmlSchema/all'
27
+ require 'wsdl/xmlSchema/choice'
28
+ require 'wsdl/xmlSchema/sequence'
29
+ require 'wsdl/xmlSchema/list'
30
+ require 'wsdl/xmlSchema/attribute'
31
+ require 'wsdl/xmlSchema/union'
32
+ require 'wsdl/xmlSchema/unique'
33
+ require 'wsdl/xmlSchema/group'
34
+ require 'wsdl/xmlSchema/attributeGroup'
35
+
36
+ require 'wsdl/xmlSchema/length'
37
+ require 'wsdl/xmlSchema/minlength'
38
+ require 'wsdl/xmlSchema/maxlength'
39
+ require 'wsdl/xmlSchema/pattern'
40
+ require 'wsdl/xmlSchema/enumeration'
41
+ require 'wsdl/xmlSchema/whitespace'
42
+ require 'wsdl/xmlSchema/maxinclusive'
43
+ require 'wsdl/xmlSchema/maxexclusive'
44
+ require 'wsdl/xmlSchema/minexclusive'
45
+ require 'wsdl/xmlSchema/mininclusive'
46
+ require 'wsdl/xmlSchema/totaldigits'
47
+ require 'wsdl/xmlSchema/fractiondigits'
48
+
49
+ module WSDL
50
+ module XMLSchema
51
+
52
+
53
+ AllName = XSD::QName.new(XSD::Namespace, 'all')
54
+ AnnotationName = XSD::QName.new(XSD::Namespace, 'annotation')
55
+ AnyName = XSD::QName.new(XSD::Namespace, 'any')
56
+ AnyAttributeName = XSD::QName.new(XSD::Namespace, 'anyAttribute')
57
+ AttributeName = XSD::QName.new(XSD::Namespace, 'attribute')
58
+ AttributeGroupName = XSD::QName.new(XSD::Namespace, 'attributeGroup')
59
+ ChoiceName = XSD::QName.new(XSD::Namespace, 'choice')
60
+ ComplexContentName = XSD::QName.new(XSD::Namespace, 'complexContent')
61
+ ComplexTypeName = XSD::QName.new(XSD::Namespace, 'complexType')
62
+ ElementName = XSD::QName.new(XSD::Namespace, 'element')
63
+ ExtensionName = XSD::QName.new(XSD::Namespace, 'extension')
64
+ GroupName = XSD::QName.new(XSD::Namespace, 'group')
65
+ ImportName = XSD::QName.new(XSD::Namespace, 'import')
66
+ IncludeName = XSD::QName.new(XSD::Namespace, 'include')
67
+ ListName = XSD::QName.new(XSD::Namespace, 'list')
68
+ RestrictionName = XSD::QName.new(XSD::Namespace, 'restriction')
69
+ SequenceName = XSD::QName.new(XSD::Namespace, 'sequence')
70
+ SchemaName = XSD::QName.new(XSD::Namespace, 'schema')
71
+ SimpleContentName = XSD::QName.new(XSD::Namespace, 'simpleContent')
72
+ SimpleTypeName = XSD::QName.new(XSD::Namespace, 'simpleType')
73
+ UnionName = XSD::QName.new(XSD::Namespace, 'union')
74
+ UniqueName = XSD::QName.new(XSD::Namespace, 'unique')
75
+
76
+ LengthName = XSD::QName.new(XSD::Namespace, 'length')
77
+ MinLengthName = XSD::QName.new(XSD::Namespace, 'minLength')
78
+ MaxLengthName = XSD::QName.new(XSD::Namespace, 'maxLength')
79
+ PatternName = XSD::QName.new(XSD::Namespace, 'pattern')
80
+ EnumerationName = XSD::QName.new(XSD::Namespace, 'enumeration')
81
+ WhiteSpaceName = XSD::QName.new(XSD::Namespace, 'whiteSpace')
82
+ MaxInclusiveName = XSD::QName.new(XSD::Namespace, 'maxInclusive')
83
+ MaxExclusiveName = XSD::QName.new(XSD::Namespace, 'maxExclusive')
84
+ MinExclusiveName = XSD::QName.new(XSD::Namespace, 'minExclusive')
85
+ MinInclusiveName = XSD::QName.new(XSD::Namespace, 'minInclusive')
86
+ TotalDigitsName = XSD::QName.new(XSD::Namespace, 'totalDigits')
87
+ FractionDigitsName = XSD::QName.new(XSD::Namespace, 'fractionDigits')
88
+
89
+ AbstractAttrName = XSD::QName.new(nil, 'abstract')
90
+ AttributeFormDefaultAttrName = XSD::QName.new(nil, 'attributeFormDefault')
91
+ BaseAttrName = XSD::QName.new(nil, 'base')
92
+ DefaultAttrName = XSD::QName.new(nil, 'default')
93
+ ElementFormDefaultAttrName = XSD::QName.new(nil, 'elementFormDefault')
94
+ FinalAttrName = XSD::QName.new(nil, 'final')
95
+ FixedAttrName = XSD::QName.new(nil, 'fixed')
96
+ FormAttrName = XSD::QName.new(nil, 'form')
97
+ IdAttrName = XSD::QName.new(nil, 'id')
98
+ ItemTypeAttrName = XSD::QName.new(nil, 'itemType')
99
+ MaxOccursAttrName = XSD::QName.new(nil, 'maxOccurs')
100
+ MemberTypesAttrName = XSD::QName.new(nil, 'memberTypes')
101
+ MinOccursAttrName = XSD::QName.new(nil, 'minOccurs')
102
+ MixedAttrName = XSD::QName.new(nil, 'mixed')
103
+ NameAttrName = XSD::QName.new(nil, 'name')
104
+ NamespaceAttrName = XSD::QName.new(nil, 'namespace')
105
+ NillableAttrName = XSD::QName.new(nil, 'nillable')
106
+ ProcessContentsAttrName = XSD::QName.new(nil, 'processContents')
107
+ RefAttrName = XSD::QName.new(nil, 'ref')
108
+ SchemaLocationAttrName = XSD::QName.new(nil, 'schemaLocation')
109
+ TargetNamespaceAttrName = XSD::QName.new(nil, 'targetNamespace')
110
+ TypeAttrName = XSD::QName.new(nil, 'type')
111
+ UseAttrName = XSD::QName.new(nil, 'use')
112
+ ValueAttrName = XSD::QName.new(nil, 'value')
113
+ VersionAttrName = XSD::QName.new(nil, 'version')
114
+
115
+
116
+ end
117
+ end
@@ -0,0 +1,154 @@
1
+ # encoding: UTF-8
2
+ # WSDL4R - XMLSchema element definition.
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'wsdl/info'
11
+ require 'wsdl/xmlSchema/ref'
12
+
13
+
14
+ module WSDL
15
+ module XMLSchema
16
+
17
+
18
+ class Element < Info
19
+ include Ref
20
+
21
+ attr_writer :name # required
22
+ attr_writer :form
23
+ attr_writer :type
24
+ attr_writer :local_simpletype
25
+ attr_writer :local_complextype
26
+ attr_writer :constraint
27
+ attr_accessor :maxoccurs
28
+ attr_accessor :minoccurs
29
+ attr_writer :nillable
30
+
31
+ attr_reader_ref :name
32
+ attr_reader_ref :form
33
+ attr_reader_ref :type
34
+ attr_reader_ref :local_simpletype
35
+ attr_reader_ref :local_complextype
36
+ attr_reader_ref :constraint
37
+ attr_reader_ref :nillable
38
+ attr_reader_ref :default
39
+ attr_reader_ref :abstract
40
+
41
+ def initialize(name = nil, type = nil)
42
+ super()
43
+ @name = name
44
+ @form = nil
45
+ @type = type
46
+ @local_simpletype = @local_complextype = nil
47
+ @constraint = nil
48
+ @maxoccurs = 1
49
+ @minoccurs = 1
50
+ @nillable = nil
51
+ @default = nil
52
+ @abstract = false
53
+ @ref = nil
54
+ @refelement = nil
55
+ end
56
+
57
+ def empty?
58
+ !(local_simpletype || local_complextype || constraint || type)
59
+ end
60
+
61
+ def targetnamespace
62
+ parent.targetnamespace
63
+ end
64
+
65
+ def elementformdefault
66
+ parent.elementformdefault
67
+ end
68
+
69
+ def elementform
70
+ self.form.nil? ? parent.elementformdefault : self.form
71
+ end
72
+
73
+ def parse_element(element)
74
+ case element
75
+ when SimpleTypeName
76
+ @local_simpletype = SimpleType.new
77
+ @local_simpletype
78
+ when ComplexTypeName
79
+ @type = nil
80
+ @local_complextype = ComplexType.new
81
+ @local_complextype
82
+ when UniqueName
83
+ @constraint = Unique.new
84
+ @constraint
85
+ else
86
+ nil
87
+ end
88
+ end
89
+
90
+ def parse_attr(attr, value)
91
+ case attr
92
+ when NameAttrName
93
+ # namespace may be nil
94
+ if directelement? or elementform == 'qualified'
95
+ @name = XSD::QName.new(targetnamespace, value.source)
96
+ else
97
+ @name = XSD::QName.new(nil, value.source)
98
+ end
99
+ when FormAttrName
100
+ @form = value.source
101
+ if @form != 'qualified' and @name.namespace
102
+ @name = XSD::QName.new(nil, @name.name)
103
+ end
104
+ @form
105
+ when TypeAttrName
106
+ @type = value
107
+ when RefAttrName
108
+ @ref = value
109
+ when MaxOccursAttrName
110
+ if parent.is_a?(All)
111
+ if value.source != '1'
112
+ raise Parser::AttributeConstraintError.new(
113
+ "cannot parse #{value} for #{attr}")
114
+ end
115
+ end
116
+ if value.source == 'unbounded'
117
+ @maxoccurs = nil
118
+ else
119
+ @maxoccurs = Integer(value.source)
120
+ end
121
+ value.source
122
+ when MinOccursAttrName
123
+ if parent.is_a?(All)
124
+ unless ['0', '1'].include?(value.source)
125
+ raise Parser::AttributeConstraintError.new(
126
+ "cannot parse #{value} for #{attr}")
127
+ end
128
+ end
129
+ @minoccurs = Integer(value.source)
130
+ when NillableAttrName
131
+ @nillable = to_boolean(value)
132
+ when DefaultAttrName
133
+ @default = value.source
134
+ when AbstractAttrName
135
+ @abstract = to_boolean(value)
136
+ else
137
+ nil
138
+ end
139
+ end
140
+
141
+ private
142
+
143
+ def directelement?
144
+ parent.is_a?(Schema)
145
+ end
146
+
147
+ def refelement
148
+ @refelement ||= (@ref ? root.collect_elements[@ref] : nil)
149
+ end
150
+ end
151
+
152
+
153
+ end
154
+ end
@@ -0,0 +1,37 @@
1
+ # encoding: UTF-8
2
+ # WSDL4R - XMLSchema enumeration definition for WSDL.
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'wsdl/info'
11
+
12
+
13
+ module WSDL
14
+ module XMLSchema
15
+
16
+
17
+ class Enumeration < Info
18
+ def initialize
19
+ super
20
+ end
21
+
22
+ def parse_element(element)
23
+ nil
24
+ end
25
+
26
+ def parse_attr(attr, value)
27
+ case attr
28
+ when ValueAttrName
29
+ parent.enumeration << value.source
30
+ value.source
31
+ end
32
+ end
33
+ end
34
+
35
+
36
+ end
37
+ end
@@ -0,0 +1,38 @@
1
+ # encoding: UTF-8
2
+ # WSDL4R - XMLSchema fractionDigits definition for WSDL.
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'wsdl/info'
11
+
12
+
13
+ module WSDL
14
+ module XMLSchema
15
+
16
+
17
+ class FractionDigits < Info
18
+ def initialize
19
+ super
20
+ end
21
+
22
+ def parse_element(element)
23
+ nil
24
+ end
25
+
26
+ def parse_attr(attr, value)
27
+ case attr
28
+ when FixedAttrName
29
+ parent.fixed[:fractiondigits] = to_boolean(value)
30
+ when ValueAttrName
31
+ parent.fractiondigits = to_int(value)
32
+ end
33
+ end
34
+ end
35
+
36
+
37
+ end
38
+ end
@@ -0,0 +1,101 @@
1
+ # encoding: UTF-8
2
+ # WSDL4R - XMLSchema group definition.
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'wsdl/info'
11
+ require 'wsdl/xmlSchema/ref'
12
+
13
+
14
+ module WSDL
15
+ module XMLSchema
16
+
17
+
18
+ class Group < Info
19
+ include Ref
20
+
21
+ attr_writer :name # required
22
+ attr_accessor :maxoccurs
23
+ attr_accessor :minoccurs
24
+ attr_writer :content
25
+
26
+ attr_reader_ref :name
27
+ attr_reader_ref :content
28
+
29
+ def initialize(name = nil)
30
+ super()
31
+ @name = name
32
+ @maxoccurs = 1
33
+ @minoccurs = 1
34
+ @content = nil
35
+ @ref = nil
36
+ @refelement = nil
37
+ end
38
+
39
+ def targetnamespace
40
+ parent.targetnamespace
41
+ end
42
+
43
+ def elementformdefault
44
+ parent.elementformdefault
45
+ end
46
+
47
+ def parse_element(element)
48
+ case element
49
+ when AllName
50
+ @content = All.new
51
+ when SequenceName
52
+ @content = Sequence.new
53
+ when ChoiceName
54
+ @content = Choice.new
55
+ else
56
+ nil
57
+ end
58
+ end
59
+
60
+ def parse_attr(attr, value)
61
+ case attr
62
+ when NameAttrName
63
+ @name = XSD::QName.new(targetnamespace, value.source)
64
+ when RefAttrName
65
+ @ref = value
66
+ when MaxOccursAttrName
67
+ if parent.is_a?(All)
68
+ if value.source != '1'
69
+ raise Parser::AttributeConstraintError.new(
70
+ "cannot parse #{value} for #{attr}")
71
+ end
72
+ end
73
+ if value.source == 'unbounded'
74
+ @maxoccurs = nil
75
+ else
76
+ @maxoccurs = Integer(value.source)
77
+ end
78
+ value.source
79
+ when MinOccursAttrName
80
+ if parent.is_a?(All)
81
+ unless ['0', '1'].include?(value.source)
82
+ raise Parser::AttributeConstraintError.new(
83
+ "cannot parse #{value} for #{attr}")
84
+ end
85
+ end
86
+ @minoccurs = Integer(value.source)
87
+ else
88
+ nil
89
+ end
90
+ end
91
+
92
+ private
93
+
94
+ def refelement
95
+ @refelement ||= (@ref ? root.collect_modelgroups[@ref] : nil)
96
+ end
97
+ end
98
+
99
+
100
+ end
101
+ end
@@ -0,0 +1,53 @@
1
+ # encoding: UTF-8
2
+ # WSDL4R - XMLSchema import definition.
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'wsdl/info'
11
+ require 'wsdl/xmlSchema/importHandler'
12
+
13
+
14
+ module WSDL
15
+ module XMLSchema
16
+
17
+
18
+ class Import < Info
19
+ attr_reader :namespace
20
+
21
+ def initialize
22
+ super
23
+ @namespace = nil
24
+ @handler = ImportHandler.new
25
+ end
26
+
27
+ def schemalocation
28
+ @handler.schemalocation
29
+ end
30
+
31
+ def content
32
+ @handler.content
33
+ end
34
+
35
+ def parse_element(element)
36
+ nil
37
+ end
38
+
39
+ def parse_attr(attr, value)
40
+ case attr
41
+ when NamespaceAttrName
42
+ @namespace = value.source
43
+ when SchemaLocationAttrName
44
+ @handler.parse_schemalocation(value.source, root, parent)
45
+ else
46
+ nil
47
+ end
48
+ end
49
+ end
50
+
51
+
52
+ end
53
+ end
@@ -0,0 +1,45 @@
1
+ # encoding: UTF-8
2
+ # WSDL4R - XMLSchema import handler.
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'wsdl/info'
11
+
12
+
13
+ module WSDL
14
+ module XMLSchema
15
+
16
+
17
+ class ImportHandler
18
+ attr_reader :schemalocation
19
+ attr_reader :content
20
+
21
+ def initialize
22
+ @schemalocation = nil
23
+ @content = nil
24
+ end
25
+
26
+ def parse_schemalocation(location, root, parent)
27
+ @schemalocation = URI.parse(location)
28
+ if @schemalocation.relative? and !parent.location.nil? and
29
+ !parent.location.relative?
30
+ @schemalocation = parent.location + @schemalocation
31
+ end
32
+ if root.importedschema.key?(@schemalocation)
33
+ @content = root.importedschema[@schemalocation]
34
+ else
35
+ root.importedschema[@schemalocation] = nil # placeholder
36
+ @content = Importer.import(@schemalocation, root)
37
+ root.importedschema[@schemalocation] = @content
38
+ end
39
+ @schemalocation
40
+ end
41
+ end
42
+
43
+
44
+ end
45
+ end
@@ -0,0 +1,103 @@
1
+ # encoding: UTF-8
2
+ # WSDL4R - XSD importer library.
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'soap/soap'
11
+ require 'soap/httpconfigloader'
12
+ require 'wsdl/xmlSchema/parser'
13
+
14
+
15
+ module WSDL
16
+ module XMLSchema
17
+
18
+
19
+ class Importer
20
+ DO_NOT_IMPORT = [::SOAP::EncodingNamespace]
21
+
22
+ def self.import(location, originalroot = nil)
23
+ new.import(location, originalroot)
24
+ end
25
+
26
+ def initialize
27
+ @web_client = nil
28
+ end
29
+
30
+ def import(location, originalroot = nil)
31
+ if DO_NOT_IMPORT.include?(location.to_s)
32
+ return nil
33
+ end
34
+ unless location.is_a?(URI)
35
+ location = URI.parse(location)
36
+ end
37
+ source, normalizedlocation = fetch(location)
38
+ content = parse(source, normalizedlocation, originalroot)
39
+ content.location = normalizedlocation
40
+ content
41
+ end
42
+
43
+ private
44
+
45
+ def parse(content, location, originalroot)
46
+ opt = {
47
+ :location => location,
48
+ :originalroot => originalroot
49
+ }
50
+ WSDL::XMLSchema::Parser.new(opt).parse(content)
51
+ end
52
+
53
+ def fetch(location)
54
+ warn("importing: #{location}") if $DEBUG
55
+ content = nil
56
+ normalizedlocation = location
57
+ if location.scheme == 'file' or
58
+ (location.relative? and FileTest.exist?(location.path))
59
+ content = File.open(location.path).read
60
+ normalizedlocation = URI.parse('file://' + File.expand_path(location.path))
61
+ elsif location.scheme and location.scheme.size == 1 and
62
+ FileTest.exist?(location.to_s)
63
+ # ToDo: remove this ugly workaround for a path with drive letter
64
+ # (D://foo/bar)
65
+ content = File.open(location.to_s).read
66
+ else
67
+ client = web_client.new(nil, "WSDL4R")
68
+ client.proxy = ::SOAP::Env::HTTP_PROXY
69
+ client.no_proxy = ::SOAP::Env::NO_PROXY
70
+ if opt = ::SOAP::Property.loadproperty(::SOAP::PropertyName)
71
+ http_opt = opt["client.protocol.http"]
72
+ ::SOAP::HTTPConfigLoader.set_options(client, http_opt) if http_opt
73
+ end
74
+ content = client.get_content(location)
75
+ end
76
+ return content, normalizedlocation
77
+ end
78
+
79
+ def web_client
80
+ return @web_client if @web_client
81
+ begin
82
+ require 'httpclient'
83
+ @web_client = HTTPClient
84
+ rescue LoadError
85
+ begin
86
+ require 'http-access2'
87
+ if HTTPAccess2::VERSION < "2.0"
88
+ raise LoadError.new("http-access/2.0 or later is required.")
89
+ end
90
+ @web_client = HTTPAccess2::Client
91
+ rescue LoadError
92
+ warn("Loading http-access2 failed. Net/http is used.") if $DEBUG
93
+ require 'soap/netHttpClient'
94
+ @web_client = ::SOAP::NetHttpClient
95
+ end
96
+ end
97
+ @web_client
98
+ end
99
+ end
100
+
101
+
102
+ end
103
+ end
@@ -0,0 +1,48 @@
1
+ # encoding: UTF-8
2
+ # WSDL4R - XMLSchema include definition.
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'wsdl/info'
11
+ require 'wsdl/xmlSchema/importHandler'
12
+
13
+
14
+ module WSDL
15
+ module XMLSchema
16
+
17
+
18
+ class Include < Info
19
+ def initialize
20
+ super
21
+ @handler = ImportHandler.new
22
+ end
23
+
24
+ def schemalocation
25
+ @handler.schemalocation
26
+ end
27
+
28
+ def content
29
+ @handler.content
30
+ end
31
+
32
+ def parse_element(element)
33
+ nil
34
+ end
35
+
36
+ def parse_attr(attr, value)
37
+ case attr
38
+ when SchemaLocationAttrName
39
+ @handler.parse_schemalocation(value.source, root, parent)
40
+ else
41
+ nil
42
+ end
43
+ end
44
+ end
45
+
46
+
47
+ end
48
+ end