diff options
Diffstat (limited to 'lib/wsdl')
42 files changed, 0 insertions, 3238 deletions
diff --git a/lib/wsdl/binding.rb b/lib/wsdl/binding.rb deleted file mode 100644 index e8c9d5be9d..0000000000 --- a/lib/wsdl/binding.rb +++ /dev/null @@ -1,65 +0,0 @@ -# WSDL4R - WSDL binding definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' -require 'xsd/namedelements' - - -module WSDL - - -class Binding < Info - attr_reader :name # required - attr_reader :type # required - attr_reader :operations - attr_reader :soapbinding - - def initialize - super - @name = nil - @type = nil - @operations = XSD::NamedElements.new - @soapbinding = nil - end - - def targetnamespace - parent.targetnamespace - end - - def parse_element(element) - case element - when OperationName - o = OperationBinding.new - @operations << o - o - when SOAPBindingName - o = WSDL::SOAP::Binding.new - @soapbinding = o - o - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when NameAttrName - @name = XSD::QName.new(targetnamespace, value) - when TypeAttrName - @type = value - else - nil - end - end -end - - -end diff --git a/lib/wsdl/data.rb b/lib/wsdl/data.rb deleted file mode 100644 index 8a14dd14d7..0000000000 --- a/lib/wsdl/data.rb +++ /dev/null @@ -1,63 +0,0 @@ -# WSDL4R - WSDL data definitions. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/documentation' -require 'wsdl/definitions' -require 'wsdl/types' -require 'wsdl/message' -require 'wsdl/part' -require 'wsdl/portType' -require 'wsdl/operation' -require 'wsdl/param' -require 'wsdl/binding' -require 'wsdl/operationBinding' -require 'wsdl/service' -require 'wsdl/port' -require 'wsdl/import' - - -module WSDL - - -ArrayTypeAttrName = XSD::QName.new(Namespace, 'arrayType') -BindingName = XSD::QName.new(Namespace, 'binding') -DefinitionsName = XSD::QName.new(Namespace, 'definitions') -DocumentationName = XSD::QName.new(Namespace, 'documentation') -FaultName = XSD::QName.new(Namespace, 'fault') -ImportName = XSD::QName.new(Namespace, 'import') -InputName = XSD::QName.new(Namespace, 'input') -MessageName = XSD::QName.new(Namespace, 'message') -OperationName = XSD::QName.new(Namespace, 'operation') -OutputName = XSD::QName.new(Namespace, 'output') -PartName = XSD::QName.new(Namespace, 'part') -PortName = XSD::QName.new(Namespace, 'port') -PortTypeName = XSD::QName.new(Namespace, 'portType') -ServiceName = XSD::QName.new(Namespace, 'service') -TypesName = XSD::QName.new(Namespace, 'types') - -SchemaName = XSD::QName.new(XSD::Namespace, 'schema') - -SOAPAddressName = XSD::QName.new(SOAPBindingNamespace, 'address') -SOAPBindingName = XSD::QName.new(SOAPBindingNamespace, 'binding') -SOAPHeaderName = XSD::QName.new(SOAPBindingNamespace, 'header') -SOAPBodyName = XSD::QName.new(SOAPBindingNamespace, 'body') -SOAPFaultName = XSD::QName.new(SOAPBindingNamespace, 'fault') -SOAPOperationName = XSD::QName.new(SOAPBindingNamespace, 'operation') - -BindingAttrName = XSD::QName.new(nil, 'binding') -ElementAttrName = XSD::QName.new(nil, 'element') -LocationAttrName = XSD::QName.new(nil, 'location') -MessageAttrName = XSD::QName.new(nil, 'message') -NameAttrName = XSD::QName.new(nil, 'name') -NamespaceAttrName = XSD::QName.new(nil, 'namespace') -ParameterOrderAttrName = XSD::QName.new(nil, 'parameterOrder') -TargetNamespaceAttrName = XSD::QName.new(nil, 'targetNamespace') -TypeAttrName = XSD::QName.new(nil, 'type') - - -end diff --git a/lib/wsdl/definitions.rb b/lib/wsdl/definitions.rb deleted file mode 100644 index 561a335744..0000000000 --- a/lib/wsdl/definitions.rb +++ /dev/null @@ -1,227 +0,0 @@ -# WSDL4R - WSDL definitions. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' -require 'xsd/namedelements' - - -module WSDL - - -class Definitions < Info - attr_reader :name - attr_reader :targetnamespace - attr_reader :imports - - # Overrides Info#root - def root - @root - end - - def root=(root) - @root = root - end - - def initialize - super - @name = nil - @targetnamespace = nil - @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 - - def inspect - name = @name || '(unnamed)' - "#<#{self.class}:#{name}>" - end - - def targetnamespace=(targetnamespace) - @targetnamespace = targetnamespace - if @name - @name = XSD::QName.new(@targetnamespace, @name.name) - end - end - - def collect_elements - result = XSD::NamedElements.new - if @types - @types.schemas.each do |schema| - result.concat(schema.elements) - end - end - @imports.each do |import| - result.concat(import.content.collect_elements) - end - result - end - - def collect_complextypes - result = @anontypes.dup - if @types - @types.schemas.each do |schema| - result.concat(schema.complextypes) - end - end - @imports.each do |import| - result.concat(import.content.collect_complextypes) - end - result - end - - def add_type(complextype) - @anontypes << complextype - end - - def messages - result = @messages.dup - @imports.each do |import| - result.concat(import.content.messages) if self.class === import.content - end - result - end - - def porttypes - result = @porttypes.dup - @imports.each do |import| - result.concat(import.content.porttypes) if self.class === import.content - end - result - end - - def bindings - result = @bindings.dup - @imports.each do |import| - result.concat(import.content.bindings) if self.class === import.content - end - result - end - - def services - result = @services.dup - @imports.each do |import| - result.concat(import.content.services) if self.class === import.content - end - result - end - - def message(name) - message = @messages[name] - return message if message - @imports.each do |import| - message = import.content.message(name) if self.class === import.content - return message if message - end - nil - end - - 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 - - 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 - - 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 - - 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 - - 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 - - def parse_attr(attr, value) - case attr - when NameAttrName - @name = XSD::QName.new(@targetnamespace, value) - when TargetNamespaceAttrName - self.targetnamespace = value - else - nil - end - end - - def self.parse_element(element) - if element == DefinitionsName - Definitions.new - else - nil - end - end - -private - -end - - -end diff --git a/lib/wsdl/documentation.rb b/lib/wsdl/documentation.rb deleted file mode 100644 index 3a7fd7d23e..0000000000 --- a/lib/wsdl/documentation.rb +++ /dev/null @@ -1,32 +0,0 @@ -# WSDL4R - WSDL SOAP documentation element. -# Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL - - -class Documentation < Info - def initialize - super - end - - def parse_element(element) - # Accepts any element. - self - end - - def parse_attr(attr, value) - # Accepts any attribute. - true - end -end - - -end diff --git a/lib/wsdl/import.rb b/lib/wsdl/import.rb deleted file mode 100644 index ab244f6ca6..0000000000 --- a/lib/wsdl/import.rb +++ /dev/null @@ -1,70 +0,0 @@ -# WSDL4R - WSDL import definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' -require 'wsdl/importer' - - -module WSDL - - -class Import < Info - attr_reader :namespace - attr_reader :location - attr_reader :content - - def initialize - super - @namespace = nil - @location = nil - @content = nil - @web_client = nil - end - - def parse_element(element) - case element - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when NamespaceAttrName - @namespace = value - if @content - @content.targetnamespace = @namespace - end - @namespace - when LocationAttrName - @location = value - @content = import(@location) - if @content.is_a?(Definitions) - @content.root = root - if @namespace - @content.targetnamespace = @namespace - end - end - @location - else - nil - end - end - -private - - def import(location) - Importer.import(location) - end -end - - -end diff --git a/lib/wsdl/importer.rb b/lib/wsdl/importer.rb deleted file mode 100644 index fac02b51a0..0000000000 --- a/lib/wsdl/importer.rb +++ /dev/null @@ -1,73 +0,0 @@ -# WSDL4R - WSDL importer library. -# Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' -require 'wsdl/parser' -require 'soap/soap' -require 'soap/property' - - -module WSDL - - -class Importer - def self.import(location) - new.import(location) - end - - def initialize - @web_client = nil - end - - def import(location) - content = nil - if FileTest.exist?(location) - content = File.open(location).read - else - client = web_client.new(nil, "WSDL4R") - if opt = ::SOAP::Property.loadproperty(::SOAP::PropertyName) - client.proxy = opt["client.protocol.http.proxy"] - client.no_proxy = opt["client.protocol.http.no_proxy"] - end - client.proxy ||= ::SOAP::Env::HTTP_PROXY - client.no_proxy ||= ::SOAP::Env::NO_PROXY - content = client.get_content(location) - end - opt = {} - begin - WSDL::Parser.new(opt).parse(content) - rescue WSDL::Parser::ParseError => orgexcn - begin - require 'wsdl/xmlSchema/parser' - WSDL::XMLSchema::Parser.new(opt).parse(content) - rescue - raise orgexcn - end - end - end - -private - - def web_client - @web_client ||= begin - require 'http-access2' - if HTTPAccess2::VERSION < "2.0" - raise LoadError.new("http-access/2.0 or later is required.") - end - HTTPAccess2::Client - rescue LoadError - STDERR.puts "Loading http-access2 failed. Net/http is used." if $DEBUG - require 'soap/netHttpClient' - ::SOAP::NetHttpClient - end - @web_client - end -end - - -end diff --git a/lib/wsdl/info.rb b/lib/wsdl/info.rb deleted file mode 100644 index 657ff5863a..0000000000 --- a/lib/wsdl/info.rb +++ /dev/null @@ -1,33 +0,0 @@ -# WSDL4R - WSDL information base. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -module WSDL - - -class Info - attr_accessor :parent - attr_accessor :id - - def initialize - @parent = nil - @id = nil - end - - def root - @parent.root - end - - def parse_element(element); end # abstract - - def parse_attr(attr, value); end # abstract - - def parse_epilogue; end # abstract -end - - -end diff --git a/lib/wsdl/message.rb b/lib/wsdl/message.rb deleted file mode 100644 index a346708cf4..0000000000 --- a/lib/wsdl/message.rb +++ /dev/null @@ -1,54 +0,0 @@ -# WSDL4R - WSDL message definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL - - -class Message < Info - attr_reader :name # required - attr_reader :parts - - def initialize - super - @name = nil - @parts = [] - end - - def targetnamespace - parent.targetnamespace - end - - def parse_element(element) - case element - when PartName - o = Part.new - @parts << o - o - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when NameAttrName - @name = XSD::QName.new(parent.targetnamespace, value) - else - nil - end - end -end - - -end diff --git a/lib/wsdl/operation.rb b/lib/wsdl/operation.rb deleted file mode 100644 index 228dc85b05..0000000000 --- a/lib/wsdl/operation.rb +++ /dev/null @@ -1,129 +0,0 @@ -# WSDL4R - WSDL operation definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL - - -class Operation < Info - class NameInfo - attr_reader :op_name - attr_reader :optype_name - attr_reader :parts - def initialize(op_name, optype_name, parts) - @op_name = op_name - @optype_name = optype_name - @parts = parts - end - end - - attr_reader :name # required - attr_reader :parameter_order # optional - attr_reader :input - attr_reader :output - attr_reader :fault - attr_reader :type # required - - def initialize - super - @name = nil - @type = nil - @parameter_order = nil - @input = nil - @output = nil - @fault = [] - end - - def targetnamespace - parent.targetnamespace - end - - def input_info - op_name = @name - optype_name = XSD::QName.new(targetnamespace, input.name ? input.name.name : @name.name) - NameInfo.new(op_name, optype_name, inputparts) - end - - def output_info - op_name = @name - optype_name = XSD::QName.new(targetnamespace, output.name ? output.name.name : @name.name) - NameInfo.new(op_name, optype_name, outputparts) - end - - def inputparts - sort_parts(input.find_message.parts) - end - - def outputparts - sort_parts(output.find_message.parts) - end - - def outputname - XSD::QName.new(targetnamespace, - output.name ? output.name.name : @name.name + 'Response') - end - - def parse_element(element) - case element - when InputName - o = Param.new - @input = o - o - when OutputName - o = Param.new - @output = o - o - when FaultName - o = Param.new - @fault << o - o - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when NameAttrName - @name = XSD::QName.new(targetnamespace, value) - when TypeAttrName - @type = value - when ParameterOrderAttrName - @parameter_order = value.split(/\s+/) - else - nil - end - end - -private - - def sort_parts(parts) - return parts.dup unless parameter_order - result = [] - parameter_order.each do |orderitem| - if (ele = parts.find { |part| part.name == orderitem }) - result << ele - end - end - if result.length == 0 - return parts.dup - end - if parts.length != result.length - raise RuntimeError.new("Incomplete parameter order list.") - end - result - end -end - - -end diff --git a/lib/wsdl/operationBinding.rb b/lib/wsdl/operationBinding.rb deleted file mode 100644 index 4c04a884ea..0000000000 --- a/lib/wsdl/operationBinding.rb +++ /dev/null @@ -1,80 +0,0 @@ -# WSDL4R - WSDL bound operation definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL - - -class OperationBinding < Info - attr_reader :name # required - attr_reader :input - attr_reader :output - attr_reader :fault - attr_reader :soapoperation - - def initialize - super - @name = nil - @input = nil - @output = nil - @fault = [] - @soapoperation = nil - end - - def targetnamespace - parent.targetnamespace - end - - def porttype - root.porttype(parent.type) - end - - def find_operation - porttype.operations[@name] - end - - def parse_element(element) - case element - when InputName - o = Param.new - @input = o - o - when OutputName - o = Param.new - @output = o - o - when FaultName - o = Param.new - @fault << o - o - when SOAPOperationName - o = WSDL::SOAP::Operation.new - @soapoperation = o - o - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when NameAttrName - @name = XSD::QName.new(targetnamespace, value) - else - nil - end - end -end - - -end diff --git a/lib/wsdl/param.rb b/lib/wsdl/param.rb deleted file mode 100644 index 06dd3beb7e..0000000000 --- a/lib/wsdl/param.rb +++ /dev/null @@ -1,74 +0,0 @@ -# WSDL4R - WSDL param definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL - - -class Param < Info - attr_reader :message # required - attr_reader :name # optional but required for fault. - attr_reader :soapbody - attr_reader :soapheader - attr_reader :soapfault - - def initialize - super - @message = nil - @name = nil - @soapbody = nil - @soapheader = [] - @soapfault = nil - end - - def targetnamespace - parent.targetnamespace - end - - def find_message - root.message(@message) - end - - def parse_element(element) - case element - when SOAPBodyName - o = WSDL::SOAP::Body.new - @soapbody = o - o - when SOAPHeaderName - o = WSDL::SOAP::Header.new - @soapheader << o - o - when SOAPFaultName - o = WSDL::SOAP::Fault.new - @soap_fault = o - o - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when MessageAttrName - @message = value - when NameAttrName - @name = XSD::QName.new(targetnamespace, value) - else - nil - end - end -end - - -end diff --git a/lib/wsdl/parser.rb b/lib/wsdl/parser.rb deleted file mode 100644 index 7e7a4d8bce..0000000000 --- a/lib/wsdl/parser.rb +++ /dev/null @@ -1,159 +0,0 @@ -# WSDL4R - WSDL XML Instance parser library. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'xsd/qname' -require 'xsd/ns' -require 'xsd/charset' -require 'xsd/datatypes' -require 'xsd/xmlparser' -require 'wsdl/wsdl' -require 'wsdl/data' -require 'wsdl/xmlSchema/data' -require 'wsdl/soap/data' - - -module WSDL - - -class Parser - include WSDL - - class ParseError < Error; end - class FormatDecodeError < ParseError; end - class UnknownElementError < FormatDecodeError; end - class UnknownAttributeError < FormatDecodeError; end - class UnexpectedElementError < FormatDecodeError; end - class ElementConstraintError < FormatDecodeError; end - class AttributeConstraintError < FormatDecodeError; end - -private - - class ParseFrame - attr_reader :ns - attr_reader :name - attr_accessor :node - - private - - def initialize(ns, name, node) - @ns = ns - @name = name - @node = node - end - end - -public - - def initialize(opt = {}) - @parser = XSD::XMLParser.create_parser(self, opt) - @parsestack = nil - @lastnode = nil - end - - def parse(string_or_readable) - @parsestack = [] - @lastnode = nil - @textbuf = '' - @parser.do_parse(string_or_readable) - @lastnode - end - - def charset - @parser.charset - end - - def start_element(name, attrs) - lastframe = @parsestack.last - ns = parent = nil - if lastframe - ns = lastframe.ns.clone_ns - parent = lastframe.node - else - ns = XSD::NS.new - parent = nil - end - attrs = XSD::XMLParser.filter_ns(ns, attrs) - node = decode_tag(ns, name, attrs, parent) - @parsestack << ParseFrame.new(ns, name, node) - end - - def characters(text) - lastframe = @parsestack.last - if lastframe - # Need not to be cloned because character does not have attr. - ns = lastframe.ns - decode_text(ns, text) - else - p text if $DEBUG - end - end - - def end_element(name) - lastframe = @parsestack.pop - unless name == lastframe.name - raise UnexpectedElementError.new("Closing element name '#{ name }' does not match with opening element '#{ lastframe.name }'.") - end - decode_tag_end(lastframe.ns, lastframe.node) - @lastnode = lastframe.node - end - -private - - def decode_tag(ns, name, attrs, parent) - o = nil - element = ns.parse(name) - if !parent - if element == DefinitionsName - o = Definitions.parse_element(element) - else - raise UnknownElementError.new("Unknown element #{ element }.") - end - else - o = parent.parse_element(element) - unless o - STDERR.puts("Unknown element #{ element }.") - o = Documentation.new # which accepts any element. - end - o.parent = parent - end - attrs.each do |key, value| - attr = unless /:/ =~ key - XSD::QName.new(nil, key) - else - ns.parse(key) - end - value_ele = if /:/ !~ value - value - elsif /^http:\/\// =~ value # ToDo: ugly. - value - else - begin - ns.parse(value) - rescue - value - end - end - unless o.parse_attr(attr, value_ele) - STDERR.puts("Unknown attr #{ attr }.") - # raise UnknownAttributeError.new("Unknown attr #{ attr }.") - end - end - o - end - - def decode_tag_end(ns, node) - node.parse_epilogue - end - - def decode_text(ns, text) - @textbuf << text - end -end - - -end diff --git a/lib/wsdl/part.rb b/lib/wsdl/part.rb deleted file mode 100644 index 30f71f15d9..0000000000 --- a/lib/wsdl/part.rb +++ /dev/null @@ -1,52 +0,0 @@ -# WSDL4R - WSDL part definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL - - -class Part < Info - attr_reader :name # required - attr_reader :element # optional - attr_reader :type # optional - - def initialize - super - @name = nil - @element = nil - @type = nil - end - - def parse_element(element) - case element - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when NameAttrName - @name = value - when ElementAttrName - @element = value - when TypeAttrName - @type = value - else - nil - end - end -end - - -end diff --git a/lib/wsdl/port.rb b/lib/wsdl/port.rb deleted file mode 100644 index e6553f1287..0000000000 --- a/lib/wsdl/port.rb +++ /dev/null @@ -1,84 +0,0 @@ -# WSDL4R - WSDL port definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL - - -class Port < Info - attr_reader :name # required - attr_reader :binding # required - attr_reader :soap_address - - def initialize - super - @name = nil - @binding = nil - @soap_address = nil - end - - def targetnamespace - parent.targetnamespace - end - - def porttype - root.porttype(find_binding.type) - end - - def find_binding - root.binding(@binding) - end - - def inputoperation_map - result = {} - find_binding.operations.each do |op_bind| - op_info = op_bind.soapoperation.input_info - result[op_info.op_name] = op_info - end - result - end - - def outputoperation_map - result = {} - find_binding.operations.each do |op_bind| - op_info = op_bind.soapoperation.output_info - result[op_info.op_name] = op_info - end - result - end - - def parse_element(element) - case element - when SOAPAddressName - o = WSDL::SOAP::Address.new - @soap_address = o - o - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when NameAttrName - @name = XSD::QName.new(targetnamespace, value) - when BindingAttrName - @binding = value - else - nil - end - end -end - - -end diff --git a/lib/wsdl/portType.rb b/lib/wsdl/portType.rb deleted file mode 100644 index e3cf9b51ec..0000000000 --- a/lib/wsdl/portType.rb +++ /dev/null @@ -1,72 +0,0 @@ -# WSDL4R - WSDL portType definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' -require 'xsd/namedelements' - - -module WSDL - - -class PortType < Info - attr_reader :name # required - attr_reader :operations - - def targetnamespace - parent.targetnamespace - end - - def initialize - super - @name = nil - @operations = XSD::NamedElements.new - end - - def find_binding - root.bindings.find { |item| item.type == @name } - end - - def locations - bind_name = find_binding.name - result = [] - root.services.each do |service| - service.ports.each do |port| - if port.binding == bind_name - result << port.soap_address.location if port.soap_address - end - end - end - result - end - - def parse_element(element) - case element - when OperationName - o = Operation.new - @operations << o - o - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when NameAttrName - @name = XSD::QName.new(targetnamespace, value) - else - nil - end - end -end - - -end diff --git a/lib/wsdl/service.rb b/lib/wsdl/service.rb deleted file mode 100644 index 0e0843a098..0000000000 --- a/lib/wsdl/service.rb +++ /dev/null @@ -1,61 +0,0 @@ -# WSDL4R - WSDL service definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' -require 'xsd/namedelements' - - -module WSDL - - -class Service < Info - attr_reader :name # required - attr_reader :ports - attr_reader :soap_address - - def initialize - super - @name = nil - @ports = XSD::NamedElements.new - @soap_address = nil - end - - def targetnamespace - parent.targetnamespace - end - - def parse_element(element) - case element - when PortName - o = Port.new - @ports << o - o - when SOAPAddressName - o = WSDL::SOAP::Address.new - @soap_address = o - o - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when NameAttrName - @name = XSD::QName.new(targetnamespace, value) - else - nil - end - end -end - - -end diff --git a/lib/wsdl/soap/address.rb b/lib/wsdl/soap/address.rb deleted file mode 100644 index e4558e4ff8..0000000000 --- a/lib/wsdl/soap/address.rb +++ /dev/null @@ -1,40 +0,0 @@ -# WSDL4R - WSDL SOAP address definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module SOAP - - -class Address < Info - attr_reader :location - - def initialize - super - @location = nil - end - - def parse_element(element) - nil - end - - def parse_attr(attr, value) - case attr - when LocationAttrName - @location = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/soap/binding.rb b/lib/wsdl/soap/binding.rb deleted file mode 100644 index 1cfe9b9cc4..0000000000 --- a/lib/wsdl/soap/binding.rb +++ /dev/null @@ -1,48 +0,0 @@ -# WSDL4R - WSDL SOAP binding definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module SOAP - - -class Binding < Info - attr_reader :style - attr_reader :transport - - def initialize - super - @style = nil - @transport = nil - end - - def parse_element(element) - nil - end - - def parse_attr(attr, value) - case attr - when StyleAttrName - if ["document", "rpc"].include?(value) - @style = value.intern - else - raise AttributeConstraintError.new("Unexpected value #{ value }.") - end - when TransportAttrName - @transport = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/soap/body.rb b/lib/wsdl/soap/body.rb deleted file mode 100644 index 47de6b1e1a..0000000000 --- a/lib/wsdl/soap/body.rb +++ /dev/null @@ -1,52 +0,0 @@ -# WSDL4R - WSDL SOAP body definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module SOAP - - -class Body < Info - attr_reader :parts - attr_reader :use # required - attr_reader :encodingstyle - attr_reader :namespace - - def initialize - super - @parts = nil - @use = nil - @encodingstyle = nil - @namespace = nil - end - - def parse_element(element) - nil - end - - def parse_attr(attr, value) - case attr - when PartsAttrName - @parts = value - when UseAttrName - @use = value - when EncodingStyleAttrName - @encodingstyle = value - when NamespaceAttrName - @namespace = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/soap/complexType.rb b/lib/wsdl/soap/complexType.rb deleted file mode 100644 index 34fc18f1a4..0000000000 --- a/lib/wsdl/soap/complexType.rb +++ /dev/null @@ -1,107 +0,0 @@ -# WSDL4R - SOAP complexType definition for WSDL. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/xmlSchema/complexType' - - -module WSDL -module XMLSchema - - -class ComplexType < Info - def compoundtype - @compoundtype ||= check_type - end - - def check_type - if content - if content.elements.size == 1 and content.elements[0].maxoccurs != 1 - :TYPE_ARRAY - else - :TYPE_STRUCT - end - elsif complexcontent and complexcontent.base == ::SOAP::ValueArrayName - :TYPE_ARRAY - else - raise NotImplementedError.new("Unknown kind of complexType.") - end - end - - def child_type(name = nil) - case compoundtype - when :TYPE_STRUCT - if ele = find_element(name) - ele.type - elsif ele = find_element_by_name(name.name) - ele.type - else - nil - end - when :TYPE_ARRAY - @contenttype ||= content_arytype - end - end - - def child_defined_complextype(name) - ele = nil - case compoundtype - when :TYPE_STRUCT - unless ele = find_element(name) - if name.namespace.nil? - ele = find_element_by_name(name.name) - end - end - when :TYPE_ARRAY - if content.elements.size == 1 - ele = content.elements[0] - else - raise RuntimeError.new("Assert: must not reach.") - end - else - raise RuntimeError.new("Assert: Not implemented.") - end - unless ele - raise RuntimeError.new("Cannot find #{name} as a children of #{@name}.") - end - ele.local_complextype - end - - def find_arytype - unless compoundtype == :TYPE_ARRAY - raise RuntimeError.new("Assert: not for array") - end - if complexcontent - complexcontent.attributes.each do |attribute| - if attribute.ref == ::SOAP::AttrArrayTypeName - return attribute.arytype - end - end - elsif content.elements.size == 1 and content.elements[0].maxoccurs != 1 - return content.elements[0].type - else - raise RuntimeError.new("Assert: Unknown array definition.") - end - nil - end - -private - - def content_arytype - if arytype = find_arytype - ns = arytype.namespace - name = arytype.name.sub(/\[(?:,)*\]$/, '') - XSD::QName.new(ns, name) - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/soap/data.rb b/lib/wsdl/soap/data.rb deleted file mode 100644 index 23aaff83b5..0000000000 --- a/lib/wsdl/soap/data.rb +++ /dev/null @@ -1,41 +0,0 @@ -# WSDL4R - WSDL SOAP binding data definitions. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'xsd/qname' -require 'wsdl/soap/definitions' -require 'wsdl/soap/binding' -require 'wsdl/soap/operation' -require 'wsdl/soap/body' -require 'wsdl/soap/header' -require 'wsdl/soap/headerfault' -require 'wsdl/soap/fault' -require 'wsdl/soap/address' -require 'wsdl/soap/complexType' - - -module WSDL -module SOAP - - -HeaderFaultName = XSD::QName.new(SOAPBindingNamespace, 'headerfault') - -LocationAttrName = XSD::QName.new(nil, 'location') -StyleAttrName = XSD::QName.new(nil, 'style') -TransportAttrName = XSD::QName.new(nil, 'transport') -UseAttrName = XSD::QName.new(nil, 'use') -PartsAttrName = XSD::QName.new(nil, 'parts') -PartAttrName = XSD::QName.new(nil, 'part') -NameAttrName = XSD::QName.new(nil, 'name') -MessageAttrName = XSD::QName.new(nil, 'message') -EncodingStyleAttrName = XSD::QName.new(nil, 'encodingStyle') -NamespaceAttrName = XSD::QName.new(nil, 'namespace') -SOAPActionAttrName = XSD::QName.new(nil, 'soapAction') - - -end -end diff --git a/lib/wsdl/soap/definitions.rb b/lib/wsdl/soap/definitions.rb deleted file mode 100644 index 7a62242204..0000000000 --- a/lib/wsdl/soap/definitions.rb +++ /dev/null @@ -1,124 +0,0 @@ -# WSDL4R - WSDL additional definitions for SOAP. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' -require 'xsd/namedelements' -require 'soap/mapping' - - -module WSDL - - -class Definitions < Info - def self.soap_rpc_complextypes - types = XSD::NamedElements.new - types << array_complextype - types << fault_complextype - types << exception_complextype - types - end - - 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 - -=begin -<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> -=end - 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 - - 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) - message = XMLSchema::Element.new(XSD::QName.new(nil, 'message'), XSD::XSDString::Type) - type.all_elements = [excn_name, cause, backtrace, message] - type - end - - def soap_rpc_complextypes(binding) - types = rpc_operation_complextypes(binding) - types + self.class.soap_rpc_complextypes - end - -private - - def rpc_operation_complextypes(binding) - types = XSD::NamedElements.new - binding.operations.each do |op_bind| - if op_bind_rpc?(op_bind) - operation = op_bind.find_operation - if op_bind.input - type = XMLSchema::ComplexType.new(operation_input_name(operation)) - message = messages[operation.input.message] - type.sequence_elements = elements_from_message(message) - types << type - end - if op_bind.output - type = XMLSchema::ComplexType.new(operation_output_name(operation)) - message = messages[operation.output.message] - type.sequence_elements = elements_from_message(message) - types << type - end - end - end - types - end - - def operation_input_name(operation) - operation.input.name || operation.name - end - - def operation_output_name(operation) - operation.output.name || - XSD::QName.new(operation.name.namespace, operation.name.name + "Response") - end - - def op_bind_rpc?(op_bind) - op_bind.soapoperation and op_bind.soapoperation.operation_style == :rpc - end - - def elements_from_message(message) - message.parts.collect { |part| - qname = XSD::QName.new(nil, part.name) - XMLSchema::Element.new(qname, part.type) - } - end -end - - -end diff --git a/lib/wsdl/soap/fault.rb b/lib/wsdl/soap/fault.rb deleted file mode 100644 index abd3cbe3dd..0000000000 --- a/lib/wsdl/soap/fault.rb +++ /dev/null @@ -1,52 +0,0 @@ -# WSDL4R - WSDL SOAP body definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module SOAP - - -class Fault < Info - attr_reader :name # required - attr_reader :use # required - attr_reader :encodingstyle - attr_reader :namespace - - def initialize - super - @name = nil - @use = nil - @encodingstyle = nil - @namespace = nil - end - - def parse_element(element) - nil - end - - def parse_attr(attr, value) - case attr - when NameAttrName - @name = value - when UseAttrName - @use = value - when EncodingStyleAttrName - @encodingstyle = value - when NamespaceAttrName - @namespace = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/soap/header.rb b/lib/wsdl/soap/header.rb deleted file mode 100644 index f1dd69eafb..0000000000 --- a/lib/wsdl/soap/header.rb +++ /dev/null @@ -1,79 +0,0 @@ -# WSDL4R - WSDL SOAP body definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module SOAP - - -class Header < Info - attr_reader :headerfault - - attr_reader :message # required - attr_reader :part # required - attr_reader :use # required - attr_reader :encodingstyle - attr_reader :namespace - - def initialize - super - @message = nil - @part = nil - @use = nil - @encodingstyle = nil - @namespace = nil - @headerfault = nil - end - - def find_message - root.message(@message) - end - - def find_part - find_message.parts.each do |part| - if part.name == @part - return part - end - end - nil - end - - def parse_element(element) - case element - when HeaderFaultName - o = WSDL::SOAP::HeaderFault.new - @headerfault = o - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when MessageAttrName - @message = value - when PartAttrName - @part = value - when UseAttrName - @use = value - when EncodingStyleAttrName - @encodingstyle = value - when NamespaceAttrName - @namespace = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/soap/headerfault.rb b/lib/wsdl/soap/headerfault.rb deleted file mode 100644 index a6e86661c2..0000000000 --- a/lib/wsdl/soap/headerfault.rb +++ /dev/null @@ -1,56 +0,0 @@ -# WSDL4R - WSDL SOAP body definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module SOAP - - -class HeaderFault < Info - attr_reader :message # required - attr_reader :part # required - attr_reader :use # required - attr_reader :encodingstyle - attr_reader :namespace - - def initialize - super - @message = nil - @part = nil - @use = nil - @encodingstyle = nil - @namespace = nil - end - - def parse_element(element) - nil - end - - def parse_attr(attr, value) - case attr - when MessageAttrName - @message = value - when PartAttrName - @part = value - when UseAttrName - @use = value - when EncodingStyleAttrName - @encodingstyle = value - when NamespaceAttrName - @namespace = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/soap/operation.rb b/lib/wsdl/soap/operation.rb deleted file mode 100644 index bb49f2099c..0000000000 --- a/lib/wsdl/soap/operation.rb +++ /dev/null @@ -1,123 +0,0 @@ -# WSDL4R - WSDL SOAP operation definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module SOAP - - -class Operation < Info - class OperationInfo - attr_reader :style - attr_reader :op_name - attr_reader :optype_name - attr_reader :headerparts - attr_reader :bodyparts - attr_reader :faultpart - attr_reader :soapaction - - def initialize(style, op_name, optype_name, headerparts, bodyparts, faultpart, soapaction) - @style = style - @op_name = op_name - @optype_name = optype_name - @headerparts = headerparts - @bodyparts = bodyparts - @faultpart = faultpart - @soapaction = soapaction - end - end - - attr_reader :soapaction - attr_reader :style - - def initialize - super - @soapaction = nil - @style = nil - end - - def parse_element(element) - nil - end - - def parse_attr(attr, value) - case attr - when StyleAttrName - if ["document", "rpc"].include?(value) - @style = value.intern - else - raise AttributeConstraintError.new("Unexpected value #{ value }.") - end - when SOAPActionAttrName - @soapaction = value - else - nil - end - end - - def input_info - name_info = parent.find_operation.input_info - param_info(name_info, parent.input) - end - - def output_info - name_info = parent.find_operation.output_info - param_info(name_info, parent.output) - end - - def operation_style - return @style if @style - if parent_binding.soapbinding - return parent_binding.soapbinding.style - end - nil - end - -private - - def parent_binding - parent.parent - end - - def param_info(name_info, param) - op_name = name_info.op_name - optype_name = name_info.optype_name - - soapheader = param.soapheader - headerparts = soapheader.collect { |item| item.find_part } - - soapbody = param.soapbody - if soapbody.encodingstyle and - soapbody.encodingstyle != ::SOAP::EncodingNamespace - raise NotImplementedError.new( - "EncodingStyle '#{ soapbody.encodingstyle }' not supported.") - end - if soapbody.namespace - op_name = op_name.dup - op_name.namespace = soapbody.namespace - end - if soapbody.parts - target = soapbody.parts.split(/\s+/) - bodyparts = name_info.parts.find_all { |part| - target.include?(part.name) - } - else - bodyparts = name_info.parts - end - - faultpart = nil - soapaction = parent.soapoperation.soapaction - OperationInfo.new(operation_style, op_name, optype_name, headerparts, bodyparts, faultpart, soapaction) - end -end - - -end -end diff --git a/lib/wsdl/types.rb b/lib/wsdl/types.rb deleted file mode 100644 index 96ae5a4988..0000000000 --- a/lib/wsdl/types.rb +++ /dev/null @@ -1,43 +0,0 @@ -# WSDL4R - WSDL types definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL - - -class Types < Info - attr_reader :schemas - - def initialize - super - @schemas = [] - end - - def parse_element(element) - case element - when SchemaName - o = XMLSchema::Schema.new - @schemas << o - o - when DocumentationName - o = Documentation.new - o - else - nil - end - end - - def parse_attr(attr, value) - nil - end -end - - -end diff --git a/lib/wsdl/wsdl.rb b/lib/wsdl/wsdl.rb deleted file mode 100644 index eb13c18806..0000000000 --- a/lib/wsdl/wsdl.rb +++ /dev/null @@ -1,23 +0,0 @@ -# WSDL4R - Base definitions. -# Copyright (C) 2000, 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'xsd/qname' - - -module WSDL - - -Version = '0.0.2' - -Namespace = 'http://schemas.xmlsoap.org/wsdl/' -SOAPBindingNamespace ='http://schemas.xmlsoap.org/wsdl/soap/' - -class Error < StandardError; end - - -end diff --git a/lib/wsdl/xmlSchema/all.rb b/lib/wsdl/xmlSchema/all.rb deleted file mode 100644 index 53f7ae82e4..0000000000 --- a/lib/wsdl/xmlSchema/all.rb +++ /dev/null @@ -1,65 +0,0 @@ -# WSDL4R - XMLSchema complexType definition for WSDL. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module XMLSchema - - -class All < Info - attr_reader :minoccurs - attr_reader :maxoccurs - attr_reader :elements - - def initialize - super() - @minoccurs = 1 - @maxoccurs = 1 - @elements = [] - end - - def targetnamespace - parent.targetnamespace - end - - def <<(element) - @elements << element - end - - def parse_element(element) - case element - when AnyName - o = Any.new - @elements << o - o - when ElementName - o = Element.new - @elements << o - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when MaxOccursAttrName - @maxoccurs = value - when MinOccursAttrName - @minoccurs = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/any.rb b/lib/wsdl/xmlSchema/any.rb deleted file mode 100644 index 3fc3706182..0000000000 --- a/lib/wsdl/xmlSchema/any.rb +++ /dev/null @@ -1,56 +0,0 @@ -# WSDL4R - XMLSchema any definition for WSDL. -# Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module XMLSchema - - -class Any < Info - attr_accessor :maxoccurs - attr_accessor :minoccurs - attr_accessor :namespace - attr_accessor :process_contents - - def initialize - super() - @maxoccurs = 1 - @minoccurs = 1 - @namespace = '##any' - @process_contents = 'strict' - end - - def targetnamespace - parent.targetnamespace - end - - def parse_element(element) - nil - end - - def parse_attr(attr, value) - case attr - when MaxOccursAttrName - @maxoccurs = value - when MinOccursAttrName - @minoccurs = value - when NamespaceAttrName - @namespace = value - when ProcessContentsAttrName - @process_contents = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/attribute.rb b/lib/wsdl/xmlSchema/attribute.rb deleted file mode 100644 index e5046dd991..0000000000 --- a/lib/wsdl/xmlSchema/attribute.rb +++ /dev/null @@ -1,74 +0,0 @@ -# WSDL4R - XMLSchema attribute definition for WSDL. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module XMLSchema - - -class Attribute < Info - attr_accessor :ref - attr_accessor :use - attr_accessor :form - attr_accessor :name - attr_accessor :type - attr_accessor :default - attr_accessor :fixed - - attr_accessor :arytype - - def initialize - super - @ref = nil - @use = nil - @form = nil - @name = nil - @type = nil - @default = nil - @fixed = nil - - @arytype = nil - end - - def parse_element(element) - nil - end - - def parse_attr(attr, value) - case attr - when RefAttrName - @ref = value - when UseAttrName - @use = value - when FormAttrName - @form = value - when NameAttrName - @name = value - when TypeAttrName - @type = value - when DefaultAttrName - @default = value - when FixedAttrName - @fixed = value - when ArrayTypeAttrName - @arytype = if value.is_a?(XSD::QName) - value - else - XSD::QName.new(XSD::Namespace, value) - end - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/choice.rb b/lib/wsdl/xmlSchema/choice.rb deleted file mode 100644 index 4cf481ec9e..0000000000 --- a/lib/wsdl/xmlSchema/choice.rb +++ /dev/null @@ -1,65 +0,0 @@ -# WSDL4R - XMLSchema complexType definition for WSDL. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module XMLSchema - - -class Choice < Info - attr_reader :minoccurs - attr_reader :maxoccurs - attr_reader :elements - - def initialize - super() - @minoccurs = 1 - @maxoccurs = 1 - @elements = [] - end - - def targetnamespace - parent.targetnamespace - end - - def <<(element) - @elements << element - end - - def parse_element(element) - case element - when AnyName - o = Any.new - @elements << o - o - when ElementName - o = Element.new - @elements << o - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when MaxOccursAttrName - @maxoccurs = value - when MinOccursAttrName - @minoccurs = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/complexContent.rb b/lib/wsdl/xmlSchema/complexContent.rb deleted file mode 100644 index 22f6851864..0000000000 --- a/lib/wsdl/xmlSchema/complexContent.rb +++ /dev/null @@ -1,79 +0,0 @@ -# WSDL4R - XMLSchema complexContent definition for WSDL. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' -require 'xsd/namedelements' - - -module WSDL -module XMLSchema - - -class ComplexContent < Info - attr_accessor :base - attr_reader :derivetype - attr_reader :content - attr_reader :attributes - - def initialize - super - @base = nil - @derivetype = nil - @content = nil - @attributes = XSD::NamedElements.new - end - - def parse_element(element) - case element - when RestrictionName, ExtensionName - @derivetype = element.name - self - when AllName - if @derivetype.nil? - raise Parser::ElementConstraintError.new("base attr not found.") - end - @content = All.new - @content - when SequenceName - if @derivetype.nil? - raise Parser::ElementConstraintError.new("base attr not found.") - end - @content = Sequence.new - @content - when ChoiceName - if @derivetype.nil? - raise Parser::ElementConstraintError.new("base attr not found.") - end - @content = Choice.new - @content - when AttributeName - if @derivetype.nil? - raise Parser::ElementConstraintError.new("base attr not found.") - end - o = Attribute.new - @attributes << o - o - end - end - - def parse_attr(attr, value) - if @derivetype.nil? - return nil - end - case attr - when BaseAttrName - @base = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/complexType.rb b/lib/wsdl/xmlSchema/complexType.rb deleted file mode 100644 index e889482d09..0000000000 --- a/lib/wsdl/xmlSchema/complexType.rb +++ /dev/null @@ -1,119 +0,0 @@ -# WSDL4R - XMLSchema complexType definition for WSDL. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' -require 'wsdl/xmlSchema/content' -require 'xsd/namedelements' - - -module WSDL -module XMLSchema - - -class ComplexType < Info - attr_accessor :name - attr_accessor :complexcontent - attr_accessor :content - attr_accessor :final - attr_accessor :mixed - attr_reader :attributes - - def initialize(name = nil) - super() - @name = name - @complexcontent = nil - @content = nil - @final = nil - @mixed = false - @attributes = XSD::NamedElements.new - end - - def targetnamespace - parent.targetnamespace - end - - def each_element - if @content - @content.elements.each do |element| - yield(element.name, element) - end - end - end - - def find_element(name) - if @content - @content.elements.each do |element| - return element if name == element.name - end - end - nil - end - - def find_element_by_name(name) - if @content - @content.elements.each do |element| - return element if name == element.name.name - end - end - nil - end - - def sequence_elements=(elements) - @content = Sequence.new - elements.each do |element| - @content << element - end - end - - def all_elements=(elements) - @content = All.new - elements.each do |element| - @content << element - end - end - - def parse_element(element) - case element - when AllName - @content = All.new - @content - when SequenceName - @content = Sequence.new - @content - when ChoiceName - @content = Choice.new - @content - when ComplexContentName - @complexcontent = ComplexContent.new - @complexcontent - when AttributeName - o = Attribute.new - @attributes << o - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when FinalAttrName - @final = value - when MixedAttrName - @mixed = (value == 'true') - when NameAttrName - @name = XSD::QName.new(targetnamespace, value) - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/content.rb b/lib/wsdl/xmlSchema/content.rb deleted file mode 100644 index 3aa875e3e7..0000000000 --- a/lib/wsdl/xmlSchema/content.rb +++ /dev/null @@ -1,96 +0,0 @@ -# WSDL4R - XMLSchema complexType definition for WSDL. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module XMLSchema - - -class Content < Info - attr_accessor :final - attr_accessor :mixed - attr_accessor :type - attr_reader :contents - attr_reader :elements - - def initialize - super() - @final = nil - @mixed = false - @type = nil - @contents = [] - @elements = [] - end - - def targetnamespace - parent.targetnamespace - end - - def <<(content) - @contents << content - update_elements - end - - def each - @contents.each do |content| - yield content - end - end - - def parse_element(element) - case element - when AllName, SequenceName, ChoiceName - o = Content.new - o.type = element.name - @contents << o - o - when AnyName - o = Any.new - @contents << o - o - when ElementName - o = Element.new - @contents << o - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when FinalAttrName - @final = value - when MixedAttrName - @mixed = (value == 'true') - else - nil - end - end - - def parse_epilogue - update_elements - end - -private - - def update_elements - @elements = [] - @contents.each do |content| - if content.is_a?(Element) - @elements << [content.name, content] - end - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/data.rb b/lib/wsdl/xmlSchema/data.rb deleted file mode 100644 index 2fa8ad6a91..0000000000 --- a/lib/wsdl/xmlSchema/data.rb +++ /dev/null @@ -1,63 +0,0 @@ -# WSDL4R - XMLSchema data definitions. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/xmlSchema/schema' -require 'wsdl/xmlSchema/import' -require 'wsdl/xmlSchema/complexType' -require 'wsdl/xmlSchema/complexContent' -require 'wsdl/xmlSchema/any' -require 'wsdl/xmlSchema/element' -require 'wsdl/xmlSchema/all' -require 'wsdl/xmlSchema/choice' -require 'wsdl/xmlSchema/sequence' -require 'wsdl/xmlSchema/attribute' -require 'wsdl/xmlSchema/unique' - - -module WSDL -module XMLSchema - - -AllName = XSD::QName.new(XSD::Namespace, 'all') -AnyName = XSD::QName.new(XSD::Namespace, 'any') -AttributeName = XSD::QName.new(XSD::Namespace, 'attribute') -ChoiceName = XSD::QName.new(XSD::Namespace, 'choice') -ComplexContentName = XSD::QName.new(XSD::Namespace, 'complexContent') -ComplexTypeName = XSD::QName.new(XSD::Namespace, 'complexType') -ElementName = XSD::QName.new(XSD::Namespace, 'element') -ExtensionName = XSD::QName.new(XSD::Namespace, 'extension') -ImportName = XSD::QName.new(XSD::Namespace, 'import') -RestrictionName = XSD::QName.new(XSD::Namespace, 'restriction') -SequenceName = XSD::QName.new(XSD::Namespace, 'sequence') -SchemaName = XSD::QName.new(XSD::Namespace, 'schema') -SimpleTypeName = XSD::QName.new(XSD::Namespace, 'simpleType') -UniqueName = XSD::QName.new(XSD::Namespace, 'unique') - -AttributeFormDefaultAttrName = XSD::QName.new(nil, 'attributeFormDefault') -BaseAttrName = XSD::QName.new(nil, 'base') -DefaultAttrName = XSD::QName.new(nil, 'default') -ElementFormDefaultAttrName = XSD::QName.new(nil, 'elementFormDefault') -FinalAttrName = XSD::QName.new(nil, 'final') -FixedAttrName = XSD::QName.new(nil, 'fixed') -FormAttrName = XSD::QName.new(nil, 'form') -IdAttrName = XSD::QName.new(nil, 'id') -MaxOccursAttrName = XSD::QName.new(nil, 'maxOccurs') -MinOccursAttrName = XSD::QName.new(nil, 'minOccurs') -MixedAttrName = XSD::QName.new(nil, 'mixed') -NameAttrName = XSD::QName.new(nil, 'name') -NamespaceAttrName = XSD::QName.new(nil, 'namespace') -NillableAttrName = XSD::QName.new(nil, 'nillable') -RefAttrName = XSD::QName.new(nil, 'ref') -SchemaLocationAttrName = XSD::QName.new(nil, 'schemaLocation') -TargetNamespaceAttrName = XSD::QName.new(nil, 'targetNamespace') -TypeAttrName = XSD::QName.new(nil, 'type') -UseAttrName = XSD::QName.new(nil, 'use') - - -end -end diff --git a/lib/wsdl/xmlSchema/element.rb b/lib/wsdl/xmlSchema/element.rb deleted file mode 100644 index 90e8c0d5d1..0000000000 --- a/lib/wsdl/xmlSchema/element.rb +++ /dev/null @@ -1,104 +0,0 @@ -# WSDL4R - XMLSchema element definition for WSDL. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module XMLSchema - - -class Element < Info - attr_accessor :name # required - attr_accessor :type - attr_accessor :local_complextype - attr_accessor :constraint - attr_accessor :maxoccurs - attr_accessor :minoccurs - attr_accessor :nillable - - def initialize(name = nil, type = XSD::AnyTypeName) - super() - @name = name - @type = type - @local_complextype = nil - @constraint = nil - @maxoccurs = 1 - @minoccurs = 1 - @nillable = nil - end - - def targetnamespace - parent.targetnamespace - end - - def parse_element(element) - case element - when ComplexTypeName - @type = nil - @local_complextype = ComplexType.new - @local_complextype - when UniqueName - @constraint = Unique.new - @constraint - else - nil - end - end - - def parse_attr(attr, value) - case attr - when NameAttrName - #@name = XSD::QName.new(nil, value) - @name = XSD::QName.new(targetnamespace, value) - when TypeAttrName - @type = if value.is_a?(XSD::QName) - value - else - XSD::QName.new(XSD::Namespace, value) - end - when MaxOccursAttrName - case parent - when All - if value != '1' - raise Parser::AttrConstraintError.new( - "Cannot parse #{ value } for #{ attr }.") - end - @maxoccurs = value - when Sequence - @maxoccurs = value - else - raise NotImplementedError.new - end - @maxoccurs - when MinOccursAttrName - case parent - when All - if ['0', '1'].include?(value) - @minoccurs = value - else - raise Parser::AttrConstraintError.new( - "Cannot parse #{ value } for #{ attr }.") - end - when Sequence - @minoccurs = value - else - raise NotImplementedError.new - end - @minoccurs - when NillableAttrName - @nillable = (value == 'true') - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/import.rb b/lib/wsdl/xmlSchema/import.rb deleted file mode 100644 index 2ef3b72ab2..0000000000 --- a/lib/wsdl/xmlSchema/import.rb +++ /dev/null @@ -1,44 +0,0 @@ -# WSDL4R - XMLSchema import definition. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module XMLSchema - - -class Import < Info - attr_reader :namespace - attr_reader :schemalocation - - def initialize - super - @namespace = nil - @schemalocation = nil - end - - def parse_element(element) - nil - end - - def parse_attr(attr, value) - case attr - when NamespaceAttrName - @namespace = value - when SchemaLocationAttrName - @schemalocation = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/parser.rb b/lib/wsdl/xmlSchema/parser.rb deleted file mode 100644 index 688af27c8c..0000000000 --- a/lib/wsdl/xmlSchema/parser.rb +++ /dev/null @@ -1,161 +0,0 @@ -# WSDL4R - WSDL XML Instance parser library. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'xsd/qname' -require 'xsd/ns' -require 'xsd/charset' -require 'xsd/datatypes' -require 'xsd/xmlparser' -require 'wsdl/xmlSchema/data' - - -module WSDL -module XMLSchema - - -class Parser - include XSD - - class ParseError < Error; end - class FormatDecodeError < Error; end - class UnknownElementError < FormatDecodeError; end - class UnknownAttributeError < FormatDecodeError; end - class UnexpectedElementError < FormatDecodeError; end - class ElementConstraintError < FormatDecodeError; end - class AttributeConstraintError < FormatDecodeError; end - -private - - class ParseFrame - attr_reader :ns - attr_reader :name - attr_accessor :node - - private - - def initialize(ns, name, node) - @ns = ns - @name = name - @node = node - end - end - -public - - def initialize(opt = {}) - @parser = XSD::XMLParser.create_parser(self, opt) - @parsestack = nil - @lastnode = nil - end - - def parse(string_or_readable) - @parsestack = [] - @lastnode = nil - @textbuf = '' - @parser.do_parse(string_or_readable) - @lastnode - end - - def charset - @parser.charset - end - - def start_element(name, attrs) - lastframe = @parsestack.last - ns = parent = nil - if lastframe - ns = lastframe.ns.clone_ns - parent = lastframe.node - else - ns = XSD::NS.new - parent = nil - end - attrs = XSD::XMLParser.filter_ns(ns, attrs) - node = decode_tag(ns, name, attrs, parent) - @parsestack << ParseFrame.new(ns, name, node) - end - - def characters(text) - lastframe = @parsestack.last - if lastframe - # Need not to be cloned because character does not have attr. - ns = lastframe.ns - decode_text(ns, text) - else - p text if $DEBUG - end - end - - def end_element(name) - lastframe = @parsestack.pop - unless name == lastframe.name - raise UnexpectedElementError.new("Closing element name '#{ name }' does not match with opening element '#{ lastframe.name }'.") - end - decode_tag_end(lastframe.ns, lastframe.node) - @lastnode = lastframe.node - end - -private - - def decode_tag(ns, name, attrs, parent) - o = nil - element = ns.parse(name) - if !parent - if element == SchemaName - o = Schema.parse_element(element) - else - raise UnknownElementError.new("Unknown element #{ element }.") - end - else - o = parent.parse_element(element) - unless o - raise UnknownElementError.new("Unknown element #{ element }.") - end - o.parent = parent - end - attrs.each do |key, value| - attr = unless /:/ =~ key - XSD::QName.new(nil, key) - else - ns.parse(key) - end - value_ele = if /:/ !~ value - value - elsif /^http:\/\// =~ value # ToDo: ugly. - value - else - begin - ns.parse(value) - rescue - value - end - end - if attr == IdAttrName - o.id = value_ele - else - unless o.parse_attr(attr, value_ele) - STDERR.puts("Unknown attr #{ attr }.") - # raise UnknownAttributeError.new("Unknown attr #{ attr }.") - end - end - end - o - end - - def decode_tag_end(ns, node) - node.parse_epilogue - end - - def decode_text(ns, text) - @textbuf << text - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/schema.rb b/lib/wsdl/xmlSchema/schema.rb deleted file mode 100644 index b2a195d41f..0000000000 --- a/lib/wsdl/xmlSchema/schema.rb +++ /dev/null @@ -1,97 +0,0 @@ -# WSDL4R - XMLSchema schema definition for WSDL. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' -require 'xsd/namedelements' - - -module WSDL -module XMLSchema - - -class Schema < Info - attr_reader :targetnamespace # required - attr_reader :complextypes - attr_reader :elements - attr_reader :attributes - attr_reader :imports - attr_accessor :attributeformdefault - attr_accessor :elementformdefault - - def initialize - super - @targetnamespace = nil - @complextypes = XSD::NamedElements.new - @elements = XSD::NamedElements.new - @attributes = XSD::NamedElements.new - @imports = [] - @elementformdefault = nil - end - - def parse_element(element) - case element - when ImportName - o = Import.new - @imports << o - o - when ComplexTypeName - o = ComplexType.new - @complextypes << o - o - when SimpleTypeName - STDERR.puts("Restriction of basetype with simpleType definition is ignored for now.") - nil - when ElementName - o = Element.new - @elements << o - o - when AttributeName - o = Attribute.new - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when TargetNamespaceAttrName - @targetnamespace = value - when AttributeFormDefaultAttrName - @attributeformdefault = value - when ElementFormDefaultAttrName - @elementformdefault = value - else - nil - end - end - - def collect_elements - result = XSD::NamedElements.new - result.concat(@elements) - result - end - - def collect_complextypes - result = XSD::NamedElements.new - result.concat(@complextypes) - result - end - - def self.parse_element(element) - if element == SchemaName - Schema.new - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/sequence.rb b/lib/wsdl/xmlSchema/sequence.rb deleted file mode 100644 index 3810832ab2..0000000000 --- a/lib/wsdl/xmlSchema/sequence.rb +++ /dev/null @@ -1,65 +0,0 @@ -# WSDL4R - XMLSchema complexType definition for WSDL. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module XMLSchema - - -class Sequence < Info - attr_reader :minoccurs - attr_reader :maxoccurs - attr_reader :elements - - def initialize - super() - @minoccurs = 1 - @maxoccurs = 1 - @elements = [] - end - - def targetnamespace - parent.targetnamespace - end - - def <<(element) - @elements << element - end - - def parse_element(element) - case element - when AnyName - o = Any.new - @elements << o - o - when ElementName - o = Element.new - @elements << o - o - else - nil - end - end - - def parse_attr(attr, value) - case attr - when MaxOccursAttrName - @maxoccurs = value - when MinOccursAttrName - @minoccurs = value - else - nil - end - end -end - - -end -end diff --git a/lib/wsdl/xmlSchema/unique.rb b/lib/wsdl/xmlSchema/unique.rb deleted file mode 100644 index 837ff22b4a..0000000000 --- a/lib/wsdl/xmlSchema/unique.rb +++ /dev/null @@ -1,34 +0,0 @@ -# WSDL4R - XMLSchema unique element. -# Copyright (C) 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. - -# This program is copyrighted free software by NAKAMURA, Hiroshi. You can -# redistribute it and/or modify it under the same terms of Ruby's license; -# either the dual license version in 2003, or any later version. - - -require 'wsdl/info' - - -module WSDL -module XMLSchema - - -class Unique < Info - def initialize - super - end - - def parse_element(element) - # Accepts any element. - self - end - - def parse_attr(attr, value) - # Accepts any attribute. - true - end -end - - -end -end |
