Class: WSDL::Definitions
- Defined in:
- lib/wsdl/definitions.rb,
lib/wsdl/soap/definitions.rb
Instance Attribute Summary collapse
-
#importedschema ⇒ Object
readonly
Returns the value of attribute importedschema.
-
#imports ⇒ Object
readonly
Returns the value of attribute imports.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#targetnamespace ⇒ Object
Returns the value of attribute targetnamespace.
Attributes inherited from Info
Class Method Summary collapse
- .array_complextype ⇒ Object
- .exception_complextype ⇒ Object
-
.fault_complextype ⇒ Object
<xs:complexType name="Fault" final="extension"> <xs:sequence> <xs:element name="faultcode" type="xs:QName" /> <xs:element name="faultstring" type="xs:string" /> <xs:element name="faultactor" type="xs:anyURI" minOccurs="0" /> <xs:element name="detail" type="tns:detail" minOccurs="0" /> </xs:sequence> </xs:complexType>.
- .parse_element(element) ⇒ Object
- .soap_rpc_complextypes ⇒ Object
Instance Method Summary collapse
-
#add_type(complextype) ⇒ Object
ToDo: simpletype must be accepted...
- #binding(name) ⇒ Object
- #bindings ⇒ Object
- #collect_attributes ⇒ Object
- #collect_complextypes ⇒ Object
- #collect_elements ⇒ Object
- #collect_faulttypes ⇒ Object
- #collect_simpletypes ⇒ Object
-
#initialize ⇒ Definitions
constructor
A new instance of Definitions.
- #inspect ⇒ Object
- #message(name) ⇒ Object
- #messages ⇒ Object
- #parse_attr(attr, value) ⇒ Object
- #parse_element(element) ⇒ Object
- #porttype(name) ⇒ Object
- #porttype_binding(name) ⇒ Object
- #porttypes ⇒ Object
- #service(name) ⇒ Object
- #services ⇒ Object
- #soap_rpc_complextypes(binding) ⇒ Object
Methods inherited from Info
Constructor Details
#initialize ⇒ Definitions
Returns a new instance of Definitions.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/wsdl/definitions.rb', line 24 def initialize super @name = nil @targetnamespace = nil @location = nil @importedschema = {} @types = nil @imports = [] @messages = XSD::NamedElements.new @porttypes = XSD::NamedElements.new @bindings = XSD::NamedElements.new @services = XSD::NamedElements.new @anontypes = XSD::NamedElements.new @root = self end |
Instance Attribute Details
#importedschema ⇒ Object (readonly)
Returns the value of attribute importedschema
22 23 24 |
# File 'lib/wsdl/definitions.rb', line 22 def importedschema @importedschema end |
#imports ⇒ Object (readonly)
Returns the value of attribute imports
19 20 21 |
# File 'lib/wsdl/definitions.rb', line 19 def imports @imports end |
#location ⇒ Object
Returns the value of attribute location
21 22 23 |
# File 'lib/wsdl/definitions.rb', line 21 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name
17 18 19 |
# File 'lib/wsdl/definitions.rb', line 17 def name @name end |
#targetnamespace ⇒ Object
Returns the value of attribute targetnamespace
18 19 20 |
# File 'lib/wsdl/definitions.rb', line 18 def targetnamespace @targetnamespace end |
Class Method Details
.array_complextype ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/wsdl/soap/definitions.rb', line 26 def self.array_complextype type = XMLSchema::ComplexType.new(::SOAP::ValueArrayName) type.complexcontent = XMLSchema::ComplexContent.new type.complexcontent.base = ::SOAP::ValueArrayName attr = XMLSchema::Attribute.new attr.ref = ::SOAP::AttrArrayTypeName anytype = XSD::AnyTypeName.dup anytype.name += '[]' attr.arytype = anytype type.complexcontent.attributes << attr type end |
.exception_complextype ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/wsdl/soap/definitions.rb', line 62 def self.exception_complextype type = XMLSchema::ComplexType.new(XSD::QName.new( ::SOAP::Mapping::RubyCustomTypeNamespace, 'SOAPException')) excn_name = XMLSchema::Element.new(XSD::QName.new(nil, 'excn_type_name'), XSD::XSDString::Type) cause = XMLSchema::Element.new(XSD::QName.new(nil, 'cause'), XSD::AnyTypeName) backtrace = XMLSchema::Element.new(XSD::QName.new(nil, 'backtrace'), ::SOAP::ValueArrayName) = XMLSchema::Element.new(XSD::QName.new(nil, 'message'), XSD::XSDString::Type) type.all_elements = [excn_name, cause, backtrace, ] type end |
.fault_complextype ⇒ Object
<xs:complexType name="Fault" final="extension">
<xs:sequence>
<xs:element name="faultcode" type="xs:QName" />
<xs:element name="faultstring" type="xs:string" />
<xs:element name="faultactor" type="xs:anyURI" minOccurs="0" />
<xs:element name="detail" type="tns:detail" minOccurs="0" />
</xs:sequence>
</xs:complexType>
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/wsdl/soap/definitions.rb', line 49 def self.fault_complextype type = XMLSchema::ComplexType.new(::SOAP::EleFaultName) faultcode = XMLSchema::Element.new(::SOAP::EleFaultCodeName, XSD::XSDQName::Type) faultstring = XMLSchema::Element.new(::SOAP::EleFaultStringName, XSD::XSDString::Type) faultactor = XMLSchema::Element.new(::SOAP::EleFaultActorName, XSD::XSDAnyURI::Type) faultactor.minoccurs = 0 detail = XMLSchema::Element.new(::SOAP::EleFaultDetailName, XSD::AnyTypeName) detail.minoccurs = 0 type.all_elements = [faultcode, faultstring, faultactor, detail] type.final = 'extension' type end |
.parse_element(element) ⇒ Object
237 238 239 240 241 242 243 |
# File 'lib/wsdl/definitions.rb', line 237 def self.parse_element(element) if element == DefinitionsName Definitions.new else nil end end |
.soap_rpc_complextypes ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/wsdl/soap/definitions.rb', line 18 def self.soap_rpc_complextypes types = XSD::NamedElements.new types << array_complextype types << fault_complextype types << exception_complextype types end |
Instance Method Details
#add_type(complextype) ⇒ Object
ToDo: simpletype must be accepted...
106 107 108 |
# File 'lib/wsdl/definitions.rb', line 106 def add_type(complextype) @anontypes << complextype end |
#binding(name) ⇒ Object
162 163 164 165 166 167 168 169 170 |
# File 'lib/wsdl/definitions.rb', line 162 def binding(name) binding = @bindings[name] return binding if binding @imports.each do |import| binding = import.content.binding(name) if self.class === import.content return binding if binding end nil end |
#bindings ⇒ Object
126 127 128 129 130 131 132 |
# File 'lib/wsdl/definitions.rb', line 126 def bindings result = @bindings.dup @imports.each do |import| result.concat(import.content.bindings) if self.class === import.content end result end |
#collect_attributes ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/wsdl/definitions.rb', line 53 def collect_attributes result = XSD::NamedElements.new if @types @types.schemas.each do |schema| result.concat(schema.collect_attributes) end end @imports.each do |import| result.concat(import.content.collect_attributes) end result end |
#collect_complextypes ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/wsdl/definitions.rb', line 79 def collect_complextypes result = @anontypes.dup if @types @types.schemas.each do |schema| result.concat(schema.collect_complextypes) end end @imports.each do |import| result.concat(import.content.collect_complextypes) end result end |
#collect_elements ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/wsdl/definitions.rb', line 66 def collect_elements result = XSD::NamedElements.new if @types @types.schemas.each do |schema| result.concat(schema.collect_elements) end end @imports.each do |import| result.concat(import.content.collect_elements) end result end |
#collect_faulttypes ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/wsdl/soap/definitions.rb', line 78 def collect_faulttypes result = [] .each do |name| faultparts = (name).parts if faultparts.size != 1 raise RuntimeError.new("expecting fault message to have only 1 part") end if result.index(faultparts[0].type).nil? result << faultparts[0].type end end result end |
#collect_simpletypes ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/wsdl/definitions.rb', line 92 def collect_simpletypes result = XSD::NamedElements.new if @types @types.schemas.each do |schema| result.concat(schema.collect_simpletypes) end end @imports.each do |import| result.concat(import.content.collect_simpletypes) end result end |
#inspect ⇒ Object
42 43 44 |
# File 'lib/wsdl/definitions.rb', line 42 def inspect sprintf("#<%s:0x%x %s>", self.class.name, __id__, @name || '(unnamed)') end |
#message(name) ⇒ Object
142 143 144 145 146 147 148 149 150 |
# File 'lib/wsdl/definitions.rb', line 142 def (name) = @messages[name] return if @imports.each do |import| = import.content.(name) if self.class === import.content return if end nil end |
#messages ⇒ Object
110 111 112 113 114 115 116 |
# File 'lib/wsdl/definitions.rb', line 110 def result = @messages.dup @imports.each do |import| result.concat(import.content.) if self.class === import.content end result end |
#parse_attr(attr, value) ⇒ Object
226 227 228 229 230 231 232 233 234 235 |
# File 'lib/wsdl/definitions.rb', line 226 def parse_attr(attr, value) case attr when NameAttrName @name = XSD::QName.new(targetnamespace, value.source) when TargetNamespaceAttrName self.targetnamespace = value.source else nil end end |
#parse_element(element) ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/wsdl/definitions.rb', line 192 def parse_element(element) case element when ImportName o = Import.new @imports << o o when TypesName o = Types.new @types = o o when MessageName o = Message.new @messages << o o when PortTypeName o = PortType.new @porttypes << o o when BindingName o = Binding.new @bindings << o o when ServiceName o = Service.new @services << o o when DocumentationName o = Documentation.new o else nil end end |
#porttype(name) ⇒ Object
152 153 154 155 156 157 158 159 160 |
# File 'lib/wsdl/definitions.rb', line 152 def porttype(name) porttype = @porttypes[name] return porttype if porttype @imports.each do |import| porttype = import.content.porttype(name) if self.class === import.content return porttype if porttype end nil end |
#porttype_binding(name) ⇒ Object
182 183 184 185 186 187 188 189 190 |
# File 'lib/wsdl/definitions.rb', line 182 def porttype_binding(name) binding = @bindings.find { |item| item.type == name } return binding if binding @imports.each do |import| binding = import.content.porttype_binding(name) if self.class === import.content return binding if binding end nil end |
#porttypes ⇒ Object
118 119 120 121 122 123 124 |
# File 'lib/wsdl/definitions.rb', line 118 def porttypes result = @porttypes.dup @imports.each do |import| result.concat(import.content.porttypes) if self.class === import.content end result end |
#service(name) ⇒ Object
172 173 174 175 176 177 178 179 180 |
# File 'lib/wsdl/definitions.rb', line 172 def service(name) service = @services[name] return service if service @imports.each do |import| service = import.content.service(name) if self.class === import.content return service if service end nil end |
#services ⇒ Object
134 135 136 137 138 139 140 |
# File 'lib/wsdl/definitions.rb', line 134 def services result = @services.dup @imports.each do |import| result.concat(import.content.services) if self.class === import.content end result end |
#soap_rpc_complextypes(binding) ⇒ Object
73 74 75 76 |
# File 'lib/wsdl/soap/definitions.rb', line 73 def soap_rpc_complextypes(binding) types = rpc_operation_complextypes(binding) types + self.class.soap_rpc_complextypes end |