summaryrefslogtreecommitdiff
path: root/lib/wsdl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wsdl')
-rw-r--r--lib/wsdl/binding.rb65
-rw-r--r--lib/wsdl/data.rb64
-rw-r--r--lib/wsdl/definitions.rb240
-rw-r--r--lib/wsdl/documentation.rb32
-rw-r--r--lib/wsdl/import.rb70
-rw-r--r--lib/wsdl/importer.rb73
-rw-r--r--lib/wsdl/info.rb33
-rw-r--r--lib/wsdl/message.rb54
-rw-r--r--lib/wsdl/operation.rb129
-rw-r--r--lib/wsdl/operationBinding.rb80
-rw-r--r--lib/wsdl/param.rb74
-rw-r--r--lib/wsdl/parser.rb160
-rw-r--r--lib/wsdl/part.rb52
-rw-r--r--lib/wsdl/port.rb84
-rw-r--r--lib/wsdl/portType.rb72
-rw-r--r--lib/wsdl/service.rb61
-rw-r--r--lib/wsdl/soap/address.rb40
-rw-r--r--lib/wsdl/soap/binding.rb48
-rw-r--r--lib/wsdl/soap/body.rb52
-rw-r--r--lib/wsdl/soap/cgiStubCreator.rb73
-rw-r--r--lib/wsdl/soap/classDefCreator.rb112
-rw-r--r--lib/wsdl/soap/classDefCreatorSupport.rb106
-rw-r--r--lib/wsdl/soap/clientSkeltonCreator.rb78
-rw-r--r--lib/wsdl/soap/complexType.rb107
-rw-r--r--lib/wsdl/soap/data.rb41
-rw-r--r--lib/wsdl/soap/definitions.rb152
-rw-r--r--lib/wsdl/soap/driverCreator.rb84
-rw-r--r--lib/wsdl/soap/fault.rb52
-rw-r--r--lib/wsdl/soap/header.rb79
-rw-r--r--lib/wsdl/soap/headerfault.rb56
-rw-r--r--lib/wsdl/soap/mappingRegistryCreator.rb90
-rw-r--r--lib/wsdl/soap/methodDefCreator.rb148
-rw-r--r--lib/wsdl/soap/operation.rb123
-rw-r--r--lib/wsdl/soap/servantSkeltonCreator.rb65
-rw-r--r--lib/wsdl/soap/standaloneServerStubCreator.rb79
-rw-r--r--lib/wsdl/types.rb43
-rw-r--r--lib/wsdl/wsdl.rb23
-rw-r--r--lib/wsdl/xmlSchema/all.rb65
-rw-r--r--lib/wsdl/xmlSchema/any.rb56
-rw-r--r--lib/wsdl/xmlSchema/attribute.rb74
-rw-r--r--lib/wsdl/xmlSchema/choice.rb65
-rw-r--r--lib/wsdl/xmlSchema/complexContent.rb83
-rw-r--r--lib/wsdl/xmlSchema/complexType.rb133
-rw-r--r--lib/wsdl/xmlSchema/content.rb96
-rw-r--r--lib/wsdl/xmlSchema/data.rb68
-rw-r--r--lib/wsdl/xmlSchema/element.rb104
-rw-r--r--lib/wsdl/xmlSchema/enumeration.rb36
-rw-r--r--lib/wsdl/xmlSchema/import.rb44
-rw-r--r--lib/wsdl/xmlSchema/parser.rb162
-rw-r--r--lib/wsdl/xmlSchema/schema.rb106
-rw-r--r--lib/wsdl/xmlSchema/sequence.rb65
-rw-r--r--lib/wsdl/xmlSchema/simpleRestriction.rb48
-rw-r--r--lib/wsdl/xmlSchema/simpleType.rb81
-rw-r--r--lib/wsdl/xmlSchema/unique.rb34
54 files changed, 0 insertions, 4314 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 45eaad8526..0000000000
--- a/lib/wsdl/data.rb
+++ /dev/null
@@ -1,64 +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 'xsd/qname'
-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 c530220fde..0000000000
--- a/lib/wsdl/definitions.rb
+++ /dev/null
@@ -1,240 +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
- sprintf("#<%s:0x%x %s>", self.class.name, __id__, @name || '(unnamed)')
- 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.collect_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.collect_complextypes)
- end
- end
- @imports.each do |import|
- result.concat(import.content.collect_complextypes)
- end
- result
- end
-
- 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
-
- # ToDo: simpletype must be accepted...
- 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 be28446d34..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 prarmeterOrder 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 6387911f79..0000000000
--- a/lib/wsdl/parser.rb
+++ /dev/null
@@ -1,160 +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
- # node could be a pseudo element. pseudo element has its own parent.
- o.parent = parent if o.parent.nil?
- 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/cgiStubCreator.rb b/lib/wsdl/soap/cgiStubCreator.rb
deleted file mode 100644
index e5b64336e7..0000000000
--- a/lib/wsdl/soap/cgiStubCreator.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# WSDL4R - Creating CGI stub code from 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/soap/mappingRegistryCreator'
-require 'wsdl/soap/methodDefCreator'
-require 'wsdl/soap/classDefCreatorSupport'
-
-
-module WSDL
-module SOAP
-
-
-class CGIStubCreator
- include ClassDefCreatorSupport
-
- attr_reader :definitions
-
- def initialize(definitions)
- @definitions = definitions
- end
-
- def dump(service_name)
- STDERR.puts "!!! IMPORTANT !!!"
- STDERR.puts "- CGI stub can only 1 port. Creating stub for the first port... Rests are ignored."
- STDERR.puts "!!! IMPORTANT !!!"
- port = @definitions.service(service_name).ports[0]
- dump_porttype(port.porttype.name)
- end
-
-private
-
- def dump_porttype(name)
- class_name = create_class_name(name)
- methoddef, types = MethodDefCreator.new(@definitions).dump(name)
- mr_creator = MappingRegistryCreator.new(@definitions)
- c1 = ::XSD::CodeGen::ClassDef.new(class_name)
- c1.def_require("soap/rpc/cgistub")
- c1.def_require("soap/mapping/registry")
- c1.def_const("MappingRegistry", "::SOAP::Mapping::Registry.new")
- c1.def_code(mr_creator.dump(types))
- c1.def_code <<-EOD
-Methods = [
-#{ methoddef.gsub(/^/, " ") }
-]
- EOD
- c2 = ::XSD::CodeGen::ClassDef.new(class_name + "App",
- "::SOAP::RPC::CGIStub")
- c2.def_method("initialize", "*arg") do
- <<-EOD
- super(*arg)
- servant = #{class_name}.new
- #{class_name}::Methods.each do |name_as, name, params, soapaction, ns|
- add_method_with_namespace_as(ns, servant, name, name_as, params, soapaction)
- end
- self.mapping_registry = #{class_name}::MappingRegistry
- self.level = Logger::Severity::ERROR
- EOD
- end
- c1.dump + "\n" + c2.dump + format(<<-EOD)
- #{class_name}App.new('app', nil).start
- EOD
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/soap/classDefCreator.rb b/lib/wsdl/soap/classDefCreator.rb
deleted file mode 100644
index 6c7d381932..0000000000
--- a/lib/wsdl/soap/classDefCreator.rb
+++ /dev/null
@@ -1,112 +0,0 @@
-# WSDL4R - Creating class definition from 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/data'
-require 'wsdl/soap/classDefCreatorSupport'
-require 'xsd/codegen'
-
-
-module WSDL
-module SOAP
-
-
-class ClassDefCreator
- include ClassDefCreatorSupport
-
- def initialize(definitions)
- @simpletypes = definitions.collect_simpletypes
- @complextypes = definitions.collect_complextypes
- @faulttypes = definitions.collect_faulttypes
- end
-
- def dump(class_name = nil)
- result = ""
- if class_name
- result = dump_classdef(class_name)
- else
- @complextypes.each do |type|
- case type.compoundtype
- when :TYPE_STRUCT
- result << dump_classdef(type)
- when :TYPE_ARRAY
- result << dump_arraydef(type)
- else
- raise RuntimeError.new("Unknown complexContent definition...")
- end
- result << "\n"
- end
-
- result << @simpletypes.collect { |type|
- dump_simpletypedef(type)
- }.join("\n")
- end
- result
- end
-
-private
-
- def dump_simpletypedef(simpletype)
- qname = simpletype.name
- if simpletype.restriction.enumeration.empty?
- STDERR.puts("#{qname}: simpleType which is not enum type not supported.")
- return ""
- end
- c = XSD::CodeGen::ModuleDef.new(create_class_name(qname))
- c.comment = "#{ qname.namespace }"
- simpletype.restriction.enumeration.each do |value|
- c.def_const(safeconstname(value), value.dump)
- end
- c.dump
- end
-
- def dump_classdef(complextype)
- qname = complextype.name
- if @faulttypes.index(qname)
- c = XSD::CodeGen::ClassDef.new(create_class_name(qname),
- "::StandardError")
- else
- c = XSD::CodeGen::ClassDef.new(create_class_name(qname))
- end
- c.comment = "#{ qname.namespace }"
- c.def_classvar("schema_type", qname.name.dump)
- c.def_classvar("schema_ns", qname.namespace.dump)
- init_lines = ""
- params = []
- complextype.each_element do |element|
- name = element.name.name
- varname = safevarname(name)
- c.def_attr(name, true, varname)
- init_lines << "@#{ varname } = #{ varname }\n"
- params << "#{ varname } = nil"
- end
- complextype.attributes.each do |attribute|
- name = "attr_" + attribute.name
- varname = safevarname(name)
- c.def_attr(name, true, varname)
- init_lines << "@#{ varname } = #{ varname }\n"
- params << "#{ varname } = nil"
- end
- c.def_method("initialize", *params) do
- init_lines
- end
- c.dump
- end
-
- def dump_arraydef(complextype)
- qname = complextype.name
- c = XSD::CodeGen::ClassDef.new(create_class_name(qname), "::Array")
- c.comment = "#{ qname.namespace }"
- c.def_classvar("schema_type", qname.name.dump)
- c.def_classvar("schema_ns", qname.namespace.dump)
- c.dump
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/soap/classDefCreatorSupport.rb b/lib/wsdl/soap/classDefCreatorSupport.rb
deleted file mode 100644
index dbcc55f7b9..0000000000
--- a/lib/wsdl/soap/classDefCreatorSupport.rb
+++ /dev/null
@@ -1,106 +0,0 @@
-# WSDL4R - Creating class code support from WSDL.
-# Copyright (C) 2004 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 'soap/mapping'
-require 'soap/mapping/typeMap'
-require 'xsd/codegen/gensupport'
-
-
-module WSDL
-module SOAP
-
-
-module ClassDefCreatorSupport
- include XSD::CodeGen::GenSupport
-
- def create_class_name(qname)
- if klass = basetype_mapped_class(qname)
- ::SOAP::Mapping::DefaultRegistry.find_mapped_obj_class(klass.name)
- else
- safeconstname(qname.name)
- end
- end
-
- def basetype_mapped_class(name)
- ::SOAP::TypeMap[name]
- end
-
- def dump_method_signature(operation)
- name = operation.name.name
- input = operation.input
- output = operation.output
- fault = operation.fault
- signature = "#{ name }#{ dump_inputparam(input) }"
- str = <<__EOD__
-# SYNOPSIS
-# #{name}#{dump_inputparam(input)}
-#
-# ARGS
-#{dump_inout_type(input).chomp}
-#
-# RETURNS
-#{dump_inout_type(output).chomp}
-#
-__EOD__
- unless fault.empty?
- faultstr = (fault.collect { |f| dump_inout_type(f).chomp }).join(', ')
- str <<<<__EOD__
-# RAISES
-# #{faultstr}
-#
-__EOD__
- end
- str
- end
-
-private
-
- def dump_inout_type(param)
- if param
- message = param.find_message
- params = ""
- message.parts.each do |part|
- next unless part.type
- name = safevarname(part.name)
- typename = safeconstname(part.type.name)
- params << add_at("# #{name}", "#{typename} - #{part.type}\n", 20)
- end
- unless params.empty?
- return params
- end
- end
- "# N/A\n"
- end
-
- def dump_inputparam(input)
- message = input.find_message
- params = ""
- message.parts.each do |part|
- params << ", " unless params.empty?
- params << safevarname(part.name)
- end
- if params.empty?
- ""
- else
- "(#{ params })"
- end
- end
-
- def add_at(base, str, pos)
- if base.size >= pos
- base + ' ' + str
- else
- base + ' ' * (pos - base.size) + str
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/soap/clientSkeltonCreator.rb b/lib/wsdl/soap/clientSkeltonCreator.rb
deleted file mode 100644
index 9c538dd612..0000000000
--- a/lib/wsdl/soap/clientSkeltonCreator.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-# WSDL4R - Creating client skelton code from 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/soap/classDefCreatorSupport'
-
-
-module WSDL
-module SOAP
-
-
-class ClientSkeltonCreator
- include ClassDefCreatorSupport
-
- attr_reader :definitions
-
- def initialize(definitions)
- @definitions = definitions
- end
-
- def dump(service_name)
- result = ""
- @definitions.service(service_name).ports.each do |port|
- result << dump_porttype(port.porttype.name)
- result << "\n"
- end
- result
- end
-
-private
-
- def dump_porttype(name)
- drv_name = create_class_name(name)
-
- result = ""
- result << <<__EOD__
-endpoint_url = ARGV.shift
-obj = #{ drv_name }.new(endpoint_url)
-
-# Uncomment the below line to see SOAP wiredumps.
-# obj.wiredump_dev = STDERR
-
-__EOD__
- @definitions.porttype(name).operations.each do |operation|
- result << dump_method_signature(operation)
- result << dump_input_init(operation.input) << "\n"
- result << dump_operation(operation) << "\n\n"
- end
- result
- end
-
- def dump_operation(operation)
- name = operation.name
- input = operation.input
- "puts obj.#{ safemethodname(name.name) }#{ dump_inputparam(input) }"
- end
-
- def dump_input_init(input)
- result = input.find_message.parts.collect { |part|
- "#{ uncapitalize(part.name) }"
- }.join(" = ")
- if result.empty?
- ""
- else
- result << " = nil"
- end
- result
- 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 2f6e7e19f0..0000000000
--- a/lib/wsdl/soap/definitions.rb
+++ /dev/null
@@ -1,152 +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
-
- def collect_faulttypes
- result = []
- collect_fault_messages.each do |message|
- parts = message(message).parts
- if parts.size != 1
- raise RuntimeError.new("Expecting fault message to have only 1 part.")
- end
- if result.index(parts[0].type).nil?
- result << parts[0].type
- end
- end
- result
- end
-
-private
-
- def collect_fault_messages
- result = []
- porttypes.each do |porttype|
- porttype.operations.each do |operation|
- operation.fault.each do |fault|
- if result.index(fault.message).nil?
- result << fault.message
- end
- end
- end
- end
- result
- end
-
- 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/driverCreator.rb b/lib/wsdl/soap/driverCreator.rb
deleted file mode 100644
index 50be8ed1dc..0000000000
--- a/lib/wsdl/soap/driverCreator.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-# WSDL4R - Creating driver code from 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/soap/mappingRegistryCreator'
-require 'wsdl/soap/methodDefCreator'
-require 'wsdl/soap/classDefCreatorSupport'
-require 'xsd/codegen'
-
-
-module WSDL
-module SOAP
-
-
-class DriverCreator
- include ClassDefCreatorSupport
-
- attr_reader :definitions
-
- def initialize(definitions)
- @definitions = definitions
- end
-
- def dump(porttype = nil)
- if porttype.nil?
- result = ""
- @definitions.porttypes.each do |type|
- result << dump_porttype(type.name)
- result << "\n"
- end
- else
- result = dump_porttype(porttype)
- end
- result
- end
-
-private
-
- def dump_porttype(name)
- class_name = create_class_name(name)
- methoddef, types = MethodDefCreator.new(@definitions).dump(name)
- mr_creator = MappingRegistryCreator.new(@definitions)
- binding = @definitions.bindings.find { |item| item.type == name }
- addresses = @definitions.porttype(name).locations
-
- c = ::XSD::CodeGen::ClassDef.new(class_name, "::SOAP::RPC::Driver")
- c.def_require("soap/rpc/driver")
- c.def_const("MappingRegistry", "::SOAP::Mapping::Registry.new")
- c.def_const("DefaultEndpointUrl", addresses[0].dump)
- c.def_code(mr_creator.dump(types))
- c.def_code <<-EOD
-Methods = [
-#{ methoddef.gsub(/^/, " ") }
-]
- EOD
- c.def_method("initialize", "endpoint_url = nil") do
- <<-EOD
- endpoint_url ||= DefaultEndpointUrl
- super(endpoint_url, nil)
- self.mapping_registry = MappingRegistry
- init_methods
- EOD
- end
- c.def_privatemethod("init_methods") do
- <<-EOD
- Methods.each do |name_as, name, params, soapaction, namespace|
- qname = ::XSD::QName.new(namespace, name_as)
- @proxy.add_method(qname, soapaction, name, params)
- add_rpc_method_interface(name, params)
- end
- EOD
- end
- c.dump
- end
-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/mappingRegistryCreator.rb b/lib/wsdl/soap/mappingRegistryCreator.rb
deleted file mode 100644
index d3b28f47e0..0000000000
--- a/lib/wsdl/soap/mappingRegistryCreator.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-# WSDL4R - Creating MappingRegistry code from 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/soap/classDefCreatorSupport'
-
-
-module WSDL
-module SOAP
-
-
-class MappingRegistryCreator
- include ClassDefCreatorSupport
-
- attr_reader :definitions
-
- def initialize(definitions)
- @definitions = definitions
- @complextypes = @definitions.collect_complextypes
- @types = nil
- end
-
- def dump(types)
- @types = types
- map_cache = []
- map = ""
- @types.each do |type|
- if map_cache.index(type).nil?
- map_cache << type
- if type.namespace != XSD::Namespace
- if typemap = dump_typemap(type)
- map << typemap
- end
- end
- end
- end
- return map
- end
-
-private
-
- def dump_typemap(type)
- if definedtype = @complextypes[type]
- case definedtype.compoundtype
- when :TYPE_STRUCT
- dump_struct_typemap(definedtype)
- when :TYPE_ARRAY
- dump_array_typemap(definedtype)
- else
- raise NotImplementedError.new("Must not reach here.")
- end
- end
- end
-
- def dump_struct_typemap(definedtype)
- ele = definedtype.name
- return <<__EOD__
-MappingRegistry.set(
- #{ create_class_name(ele) },
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => ::XSD::QName.new("#{ ele.namespace }", "#{ ele.name }") }
-)
-__EOD__
- end
-
- def dump_array_typemap(definedtype)
- ele = definedtype.name
- arytype = definedtype.find_arytype || XSD::AnyTypeName
- type = XSD::QName.new(arytype.namespace, arytype.name.sub(/\[(?:,)*\]$/, ''))
- @types << type
- return <<__EOD__
-MappingRegistry.set(
- #{ create_class_name(ele) },
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => ::XSD::QName.new("#{ type.namespace }", "#{ type.name }") }
-)
-__EOD__
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/soap/methodDefCreator.rb b/lib/wsdl/soap/methodDefCreator.rb
deleted file mode 100644
index eded972cdc..0000000000
--- a/lib/wsdl/soap/methodDefCreator.rb
+++ /dev/null
@@ -1,148 +0,0 @@
-# WSDL4R - Creating driver code from 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/soap/classDefCreatorSupport'
-
-
-module WSDL
-module SOAP
-
-
-class MethodDefCreator
- include ClassDefCreatorSupport
-
- attr_reader :definitions
-
- def initialize(definitions)
- @definitions = definitions
- @simpletypes = @definitions.collect_simpletypes
- @complextypes = @definitions.collect_complextypes
- @elements = @definitions.collect_elements
- @types = nil
- end
-
- def dump(porttype)
- @types = []
- result = ""
- operations = @definitions.porttype(porttype).operations
- binding = @definitions.porttype_binding(porttype)
- operations.each do |operation|
- op_bind = binding.operations[operation.name]
- result << ",\n" unless result.empty?
- result << dump_method(operation, op_bind).chomp
- end
- return result, @types
- end
-
-private
-
- def dump_method(operation, binding)
- name = safemethodname(operation.name.name)
- name_as = operation.name.name
- params = collect_parameter(operation)
- soapaction = binding.soapoperation.soapaction
- namespace = binding.input.soapbody.namespace
- paramstr = param2str(params)
- if paramstr.empty?
- paramstr = '[]'
- else
- paramstr = "[\n" << paramstr.gsub(/^/, ' ') << "\n ]"
- end
- return <<__EOD__
-[#{ dq(name_as) }, #{ dq(name) },
- #{ paramstr },
- #{ soapaction ? dq(soapaction) : "nil" }, #{ dq(namespace) }
-]
-__EOD__
- end
-
- def collect_parameter(operation)
- result = operation.inputparts.collect { |part|
- collect_type(part.type)
- param_set('in', definedtype(part), part.name)
- }
- outparts = operation.outputparts
- if outparts.size > 0
- retval = outparts[0]
- collect_type(retval.type)
- result << param_set('retval', definedtype(retval), retval.name)
- cdr(outparts).each { |part|
- collect_type(part.type)
- result << param_set('out', definedtype(part), part.name)
- }
- end
- result
- end
-
- def definedtype(part)
- if mapped = basetype_mapped_class(part.type)
- ['::' + mapped.name]
- elsif definedelement = @elements[part.element]
- raise RuntimeError.new("Part: #{part.name} should be typed for RPC service for now.")
- elsif definedtype = @simpletypes[part.type]
- ['::' + basetype_mapped_class(definedtype.base).name]
- elsif definedtype = @complextypes[part.type]
- case definedtype.compoundtype
- when :TYPE_STRUCT
- ['::SOAP::SOAPStruct', part.type.namespace, part.type.name]
- when :TYPE_ARRAY
- arytype = definedtype.find_arytype || XSD::AnyTypeName
- ns = arytype.namespace
- name = arytype.name.sub(/\[(?:,)*\]$/, '')
- ['::SOAP::SOAPArray', ns, name]
- else
- raise NotImplementedError.new("Must not reach here.")
- end
- else
- raise RuntimeError.new("Part: #{part.name} cannot be resolved.")
- end
- end
-
- def param_set(io_type, type, name)
- [io_type, type, name]
- end
-
- def collect_type(type)
- # ignore inline type definition.
- return if type.nil?
- @types << type
- return unless @complextypes[type]
- @complextypes[type].each_element do |element|
- collect_type(element.type)
- end
- end
-
- def param2str(params)
- params.collect { |param|
- "[#{ dq(param[0]) }, #{ dq(param[2]) }, #{ type2str(param[1]) }]"
- }.join(",\n")
- end
-
- def type2str(type)
- if type.size == 1
- "[#{ type[0] }]"
- else
- "[#{ type[0] }, #{ dq(type[1]) }, #{ dq(type[2]) }]"
- end
- end
-
- def dq(ele)
- "\"" << ele << "\""
- end
-
- def cdr(ary)
- result = ary.dup
- result.shift
- result
- 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/soap/servantSkeltonCreator.rb b/lib/wsdl/soap/servantSkeltonCreator.rb
deleted file mode 100644
index bf293949b8..0000000000
--- a/lib/wsdl/soap/servantSkeltonCreator.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# WSDL4R - Creating servant skelton code from 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/soap/classDefCreatorSupport'
-require 'xsd/codegen'
-
-
-module WSDL
-module SOAP
-
-
-class ServantSkeltonCreator
- include ClassDefCreatorSupport
- include ::XSD::CodeGen::GenSupport
-
- attr_reader :definitions
-
- def initialize(definitions)
- @definitions = definitions
- end
-
- def dump(porttype = nil)
- if porttype.nil?
- result = ""
- @definitions.porttypes.each do |type|
- result << dump_porttype(type.name)
- result << "\n"
- end
- else
- result = dump_porttype(porttype)
- end
- result
- end
-
-private
-
- def dump_porttype(name)
- class_name = create_class_name(name)
- c = ::XSD::CodeGen::ClassDef.new(class_name)
- operations = @definitions.porttype(name).operations
- operations.each do |operation|
- name = operation.name.name
- input = operation.input
- m = ::XSD::CodeGen::MethodDef.new(name,
- input.find_message.parts.collect { |part| safevarname(part.name) }) do
- <<-EOD
- raise NotImplementedError.new
- EOD
- end
- m.comment = dump_method_signature(operation)
- c.add_method(m)
- end
- c.dump
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/soap/standaloneServerStubCreator.rb b/lib/wsdl/soap/standaloneServerStubCreator.rb
deleted file mode 100644
index 34bcfdbba9..0000000000
--- a/lib/wsdl/soap/standaloneServerStubCreator.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-# WSDL4R - Creating standalone server stub code from 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/soap/mappingRegistryCreator'
-require 'wsdl/soap/methodDefCreator'
-require 'wsdl/soap/classDefCreatorSupport'
-
-
-module WSDL
-module SOAP
-
-
-class StandaloneServerStubCreator
- include ClassDefCreatorSupport
-
- attr_reader :definitions
-
- def initialize(definitions)
- @definitions = definitions
- end
-
- def dump(service_name)
- STDERR.puts "!!! IMPORTANT !!!"
- STDERR.puts "- Standalone stub can have only 1 port for now. So creating stub for the first port and rests are ignored."
- STDERR.puts "- Standalone server stub ignores port location defined in WSDL. Location is http://localhost:10080/ by default. Generated client from WSDL must be configured to point this endpoint by hand."
- STDERR.puts "!!! IMPORTANT !!!"
- port = @definitions.service(service_name).ports[0]
- dump_porttype(port.porttype.name)
- end
-
-private
-
- def dump_porttype(name)
- class_name = create_class_name(name)
- methoddef, types = MethodDefCreator.new(@definitions).dump(name)
- mr_creator = MappingRegistryCreator.new(@definitions)
-
- c1 = ::XSD::CodeGen::ClassDef.new(class_name)
- c1.def_require("soap/rpc/standaloneServer")
- c1.def_require("soap/mapping/registry")
- c1.def_const("MappingRegistry", "::SOAP::Mapping::Registry.new")
- c1.def_code(mr_creator.dump(types))
- c1.def_code <<-EOD
-Methods = [
-#{ methoddef.gsub(/^/, " ") }
-]
- EOD
- c2 = ::XSD::CodeGen::ClassDef.new(class_name + "App",
- "::SOAP::RPC::StandaloneServer")
- c2.def_method("initialize", "*arg") do
- <<-EOD
- super(*arg)
- servant = #{class_name}.new
- #{class_name}::Methods.each do |name_as, name, params, soapaction, ns|
- qname = XSD::QName.new(ns, name_as)
- @soaplet.app_scope_router.add_method(servant, qname, soapaction, name, params)
- end
- self.mapping_registry = #{class_name}::MappingRegistry
- EOD
- end
- c1.dump + "\n" + c2.dump + format(<<-EOD)
-
- if $0 == __FILE__
- # Change listen port.
- #{class_name}App.new('app', nil, '0.0.0.0', 10080).start
- end
- EOD
- 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 66ad9e251d..0000000000
--- a/lib/wsdl/xmlSchema/complexContent.rb
+++ /dev/null
@@ -1,83 +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 targetnamespace
- parent.targetnamespace
- 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 056a806dc5..0000000000
--- a/lib/wsdl/xmlSchema/complexType.rb
+++ /dev/null
@@ -1,133 +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 'wsdl/xmlSchema/element'
-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
-
- AnyAsElement = Element.new(XSD::QName.new(nil, 'any'), XSD::AnyTypeName)
- def each_element
- if @content
- @content.elements.each do |element|
- if element.is_a?(Any)
- yield(AnyAsElement)
- else
- yield(element)
- end
- end
- end
- end
-
- def find_element(name)
- if @content
- @content.elements.each do |element|
- if element.is_a?(Any)
- return AnyAsElement if name == AnyAsElement.name
- else
- return element if name == element.name
- end
- end
- end
- nil
- end
-
- def find_element_by_name(name)
- if @content
- @content.elements.each do |element|
- if element.is_a?(Any)
- return AnyAsElement if name == AnyAsElement.name.name
- else
- return element if name == element.name.name
- end
- 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 1283ac2a1d..0000000000
--- a/lib/wsdl/xmlSchema/data.rb
+++ /dev/null
@@ -1,68 +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 'xsd/datatypes'
-require 'wsdl/xmlSchema/schema'
-require 'wsdl/xmlSchema/import'
-require 'wsdl/xmlSchema/simpleType'
-require 'wsdl/xmlSchema/simpleRestriction'
-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'
-require 'wsdl/xmlSchema/enumeration'
-
-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')
-EnumerationName = XSD::QName.new(XSD::Namespace, 'enumeration')
-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')
-ValueAttrName = XSD::QName.new(nil, 'value')
-
-
-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/enumeration.rb b/lib/wsdl/xmlSchema/enumeration.rb
deleted file mode 100644
index cd61572d07..0000000000
--- a/lib/wsdl/xmlSchema/enumeration.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# WSDL4R - XMLSchema enumeration definition for WSDL.
-# Copyright (C) 2004 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 Enumeration < Info
- def initialize
- super
- end
-
- def parse_element(element)
- nil
- end
-
- def parse_attr(attr, value)
- case attr
- when ValueAttrName
- parent.enumeration << value
- value
- 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 5401c5f729..0000000000
--- a/lib/wsdl/xmlSchema/parser.rb
+++ /dev/null
@@ -1,162 +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
- # node could be a pseudo element. pseudo element has its own parent.
- o.parent = parent if o.parent.nil?
- 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 b530a92556..0000000000
--- a/lib/wsdl/xmlSchema/schema.rb
+++ /dev/null
@@ -1,106 +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 :simpletypes
- attr_reader :elements
- attr_reader :attributes
- attr_reader :imports
- attr_accessor :attributeformdefault
- attr_accessor :elementformdefault
-
- def initialize
- super
- @targetnamespace = nil
- @complextypes = XSD::NamedElements.new
- @simpletypes = 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
- o = SimpleType.new
- @simpletypes << o
- o
- 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 collect_simpletypes
- result = XSD::NamedElements.new
- result.concat(@simpletypes)
- 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/simpleRestriction.rb b/lib/wsdl/xmlSchema/simpleRestriction.rb
deleted file mode 100644
index 6986e74423..0000000000
--- a/lib/wsdl/xmlSchema/simpleRestriction.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# WSDL4R - XMLSchema simpleType definition for WSDL.
-# Copyright (C) 2004 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 SimpleRestriction < Info
- attr_reader :base
- attr_reader :enumeration
-
- def initialize
- super
- @base = nil
- @enumeration = [] # NamedElements?
- end
-
- def valid?(value)
- @enumeration.include?(value)
- end
-
- def parse_element(element)
- case element
- when EnumerationName
- Enumeration.new # just a parsing handler
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when BaseAttrName
- @base = value
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/simpleType.rb b/lib/wsdl/xmlSchema/simpleType.rb
deleted file mode 100644
index 830086f99e..0000000000
--- a/lib/wsdl/xmlSchema/simpleType.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-# WSDL4R - XMLSchema simpleType definition for WSDL.
-# Copyright (C) 2004 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 SimpleType < Info
- attr_accessor :name
- attr_reader :derivetype
- attr_reader :restriction
-
- def check_lexical_format(value)
- if @restriction
- check_restriction(value)
- elsif @extension
- raise NotImplementedError
- # ToDo
- else
- raise ArgumentError.new("incomplete simpleType")
- end
- end
-
- def base
- if @restriction
- @restriction.base
- elsif @extension
- @extension.base
- else
- raise ArgumentError.new("incomplete simpleType")
- end
- end
-
- def initialize(name = nil)
- super()
- @name = name
- @derivetype = nil
- @restriction = nil
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def parse_element(element)
- case element
- when RestrictionName
- @restriction = SimpleRestriction.new
- @derivetype = element.name
- @restriction
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when NameAttrName
- @name = XSD::QName.new(targetnamespace, value)
- end
- end
-
-private
-
- def check_restriction(value)
- unless @restriction.valid?(value)
- raise ::XSD::ValueSpaceError.new("#{@name}: cannot accept '#{value}'.")
- 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