summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 08:14:57 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 08:14:57 +0000
commit889c7de09d40ebdd3620cf9c0ad74d750b512221 (patch)
tree6c16302232c2b655cfd5ea406a9ac202814a8b35
parentefed292c4311c8c182a32ac2afe70c6969815b2d (diff)
Mon Dec 24 17:06:37 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* {lib,test}/{soap,wsdl,xsd}: removed soap4r along to the discussion at ruby-core and ruby-dev. see [ruby-core:12535], [ruby-dev:31969]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/soap/attachment.rb107
-rw-r--r--lib/soap/baseData.rb942
-rw-r--r--lib/soap/element.rb258
-rw-r--r--lib/soap/encodingstyle/aspDotNetHandler.rb213
-rw-r--r--lib/soap/encodingstyle/handler.rb100
-rw-r--r--lib/soap/encodingstyle/literalHandler.rb226
-rw-r--r--lib/soap/encodingstyle/soapHandler.rb582
-rw-r--r--lib/soap/generator.rb274
-rw-r--r--lib/soap/header/handler.rb57
-rw-r--r--lib/soap/header/handlerset.rb70
-rw-r--r--lib/soap/header/simplehandler.rb44
-rw-r--r--lib/soap/httpconfigloader.rb119
-rw-r--r--lib/soap/mapping.rb10
-rw-r--r--lib/soap/mapping/factory.rb355
-rw-r--r--lib/soap/mapping/mapping.rb381
-rw-r--r--lib/soap/mapping/registry.rb541
-rw-r--r--lib/soap/mapping/rubytypeFactory.rb475
-rw-r--r--lib/soap/mapping/typeMap.rb50
-rw-r--r--lib/soap/mapping/wsdlencodedregistry.rb280
-rw-r--r--lib/soap/mapping/wsdlliteralregistry.rb418
-rw-r--r--lib/soap/marshal.rb59
-rw-r--r--lib/soap/mimemessage.rb240
-rw-r--r--lib/soap/netHttpClient.rb190
-rw-r--r--lib/soap/parser.rb251
-rw-r--r--lib/soap/processor.rb66
-rw-r--r--lib/soap/property.rb333
-rw-r--r--lib/soap/rpc/cgistub.rb206
-rw-r--r--lib/soap/rpc/driver.rb254
-rw-r--r--lib/soap/rpc/element.rb325
-rw-r--r--lib/soap/rpc/httpserver.rb129
-rw-r--r--lib/soap/rpc/proxy.rb502
-rw-r--r--lib/soap/rpc/router.rb594
-rw-r--r--lib/soap/rpc/rpc.rb25
-rw-r--r--lib/soap/rpc/soaplet.rb162
-rw-r--r--lib/soap/rpc/standaloneServer.rb43
-rw-r--r--lib/soap/soap.rb140
-rw-r--r--lib/soap/streamHandler.rb229
-rw-r--r--lib/soap/wsdlDriver.rb575
-rw-r--r--lib/wsdl/binding.rb65
-rw-r--r--lib/wsdl/data.rb64
-rw-r--r--lib/wsdl/definitions.rb250
-rw-r--r--lib/wsdl/documentation.rb32
-rw-r--r--lib/wsdl/import.rb80
-rw-r--r--lib/wsdl/importer.rb38
-rw-r--r--lib/wsdl/info.rb39
-rw-r--r--lib/wsdl/message.rb54
-rw-r--r--lib/wsdl/operation.rb130
-rw-r--r--lib/wsdl/operationBinding.rb108
-rw-r--r--lib/wsdl/param.rb85
-rw-r--r--lib/wsdl/parser.rb163
-rw-r--r--lib/wsdl/part.rb52
-rw-r--r--lib/wsdl/port.rb84
-rw-r--r--lib/wsdl/portType.rb73
-rw-r--r--lib/wsdl/service.rb61
-rw-r--r--lib/wsdl/soap/address.rb40
-rw-r--r--lib/wsdl/soap/binding.rb49
-rw-r--r--lib/wsdl/soap/body.rb56
-rw-r--r--lib/wsdl/soap/cgiStubCreator.rb76
-rw-r--r--lib/wsdl/soap/classDefCreator.rb314
-rw-r--r--lib/wsdl/soap/classDefCreatorSupport.rb126
-rw-r--r--lib/wsdl/soap/clientSkeltonCreator.rb78
-rw-r--r--lib/wsdl/soap/complexType.rb161
-rw-r--r--lib/wsdl/soap/data.rb42
-rw-r--r--lib/wsdl/soap/definitions.rb149
-rw-r--r--lib/wsdl/soap/driverCreator.rb95
-rw-r--r--lib/wsdl/soap/element.rb28
-rw-r--r--lib/wsdl/soap/fault.rb56
-rw-r--r--lib/wsdl/soap/header.rb86
-rw-r--r--lib/wsdl/soap/headerfault.rb56
-rw-r--r--lib/wsdl/soap/mappingRegistryCreator.rb92
-rw-r--r--lib/wsdl/soap/methodDefCreator.rb228
-rw-r--r--lib/wsdl/soap/operation.rb122
-rw-r--r--lib/wsdl/soap/servantSkeltonCreator.rb67
-rw-r--r--lib/wsdl/soap/standaloneServerStubCreator.rb85
-rw-r--r--lib/wsdl/soap/wsdl2ruby.rb176
-rw-r--r--lib/wsdl/types.rb43
-rw-r--r--lib/wsdl/wsdl.rb23
-rw-r--r--lib/wsdl/xmlSchema/all.rb69
-rw-r--r--lib/wsdl/xmlSchema/annotation.rb34
-rw-r--r--lib/wsdl/xmlSchema/any.rb56
-rw-r--r--lib/wsdl/xmlSchema/attribute.rb127
-rw-r--r--lib/wsdl/xmlSchema/choice.rb69
-rw-r--r--lib/wsdl/xmlSchema/complexContent.rb92
-rw-r--r--lib/wsdl/xmlSchema/complexType.rb139
-rw-r--r--lib/wsdl/xmlSchema/content.rb96
-rw-r--r--lib/wsdl/xmlSchema/data.rb80
-rw-r--r--lib/wsdl/xmlSchema/element.rb154
-rw-r--r--lib/wsdl/xmlSchema/enumeration.rb36
-rw-r--r--lib/wsdl/xmlSchema/import.rb65
-rw-r--r--lib/wsdl/xmlSchema/importer.rb87
-rw-r--r--lib/wsdl/xmlSchema/include.rb54
-rw-r--r--lib/wsdl/xmlSchema/length.rb35
-rw-r--r--lib/wsdl/xmlSchema/parser.rb166
-rw-r--r--lib/wsdl/xmlSchema/pattern.rb36
-rw-r--r--lib/wsdl/xmlSchema/schema.rb143
-rw-r--r--lib/wsdl/xmlSchema/sequence.rb69
-rw-r--r--lib/wsdl/xmlSchema/simpleContent.rb65
-rw-r--r--lib/wsdl/xmlSchema/simpleExtension.rb54
-rw-r--r--lib/wsdl/xmlSchema/simpleRestriction.rb73
-rw-r--r--lib/wsdl/xmlSchema/simpleType.rb73
-rw-r--r--lib/wsdl/xmlSchema/unique.rb34
-rw-r--r--lib/wsdl/xmlSchema/xsd2ruby.rb107
-rw-r--r--lib/xsd/charset.rb187
-rw-r--r--lib/xsd/codegen.rb12
-rw-r--r--lib/xsd/codegen/classdef.rb203
-rw-r--r--lib/xsd/codegen/commentdef.rb34
-rw-r--r--lib/xsd/codegen/gensupport.rb166
-rw-r--r--lib/xsd/codegen/methoddef.rb63
-rw-r--r--lib/xsd/codegen/moduledef.rb191
-rw-r--r--lib/xsd/datatypes.rb1269
-rw-r--r--lib/xsd/datatypes1999.rb20
-rw-r--r--lib/xsd/iconvcharset.rb33
-rw-r--r--lib/xsd/mapping.rb42
-rw-r--r--lib/xsd/namedelements.rb95
-rw-r--r--lib/xsd/ns.rb140
-rw-r--r--lib/xsd/qname.rb78
-rw-r--r--lib/xsd/xmlparser.rb61
-rw-r--r--lib/xsd/xmlparser/parser.rb96
-rw-r--r--lib/xsd/xmlparser/rexmlparser.rb54
-rw-r--r--lib/xsd/xmlparser/xmlparser.rb50
-rw-r--r--lib/xsd/xmlparser/xmlscanner.rb147
-rw-r--r--test/soap/asp.net/hello.wsdl96
-rw-r--r--test/soap/asp.net/test_aspdotnet.rb111
-rw-r--r--test/soap/calc/calc.rb17
-rw-r--r--test/soap/calc/calc2.rb29
-rw-r--r--test/soap/calc/server.cgi13
-rw-r--r--test/soap/calc/server.rb17
-rw-r--r--test/soap/calc/server2.rb20
-rw-r--r--test/soap/calc/test_calc.rb49
-rw-r--r--test/soap/calc/test_calc2.rb53
-rw-r--r--test/soap/calc/test_calc_cgi.rb69
-rw-r--r--test/soap/fault/test_customfault.rb58
-rw-r--r--test/soap/header/server.cgi119
-rw-r--r--test/soap/header/test_authheader.rb240
-rw-r--r--test/soap/header/test_authheader_cgi.rb121
-rw-r--r--test/soap/header/test_simplehandler.rb116
-rw-r--r--test/soap/helloworld/hw_s.rb16
-rw-r--r--test/soap/helloworld/test_helloworld.rb40
-rw-r--r--test/soap/marshal/test_digraph.rb56
-rw-r--r--test/soap/marshal/test_marshal.rb26
-rw-r--r--test/soap/marshal/test_struct.rb47
-rw-r--r--test/soap/ssl/README1
-rw-r--r--test/soap/ssl/ca.cert23
-rw-r--r--test/soap/ssl/client.cert19
-rw-r--r--test/soap/ssl/client.key15
-rw-r--r--test/soap/ssl/server.cert19
-rw-r--r--test/soap/ssl/server.key15
-rw-r--r--test/soap/ssl/sslsvr.rb57
-rw-r--r--test/soap/ssl/subca.cert21
-rw-r--r--test/soap/ssl/test_ssl.rb204
-rw-r--r--test/soap/struct/test_struct.rb77
-rw-r--r--test/soap/swa/test_file.rb73
-rw-r--r--test/soap/test_basetype.rb970
-rw-r--r--test/soap/test_envelopenamespace.rb92
-rw-r--r--test/soap/test_httpconfigloader.rb39
-rw-r--r--test/soap/test_mapping.rb59
-rw-r--r--test/soap/test_no_indent.rb86
-rw-r--r--test/soap/test_property.rb424
-rw-r--r--test/soap/test_soapelement.rb122
-rw-r--r--test/soap/test_streamhandler.rb209
-rw-r--r--test/soap/test_styleuse.rb333
-rw-r--r--test/soap/wsdlDriver/README.txt2
-rw-r--r--test/soap/wsdlDriver/calc.wsdl126
-rw-r--r--test/soap/wsdlDriver/document.wsdl54
-rw-r--r--test/soap/wsdlDriver/echo_version.rb20
-rw-r--r--test/soap/wsdlDriver/simpletype.wsdl63
-rw-r--r--test/soap/wsdlDriver/test_calc.rb88
-rw-r--r--test/soap/wsdlDriver/test_document.rb78
-rw-r--r--test/soap/wsdlDriver/test_simpletype.rb87
-rw-r--r--test/wsdl/any/any.wsdl50
-rw-r--r--test/wsdl/any/expectedDriver.rb54
-rw-r--r--test/wsdl/any/expectedEcho.rb14
-rw-r--r--test/wsdl/any/expectedService.rb52
-rw-r--r--test/wsdl/any/test_any.rb46
-rw-r--r--test/wsdl/axisArray/axisArray.wsdl60
-rw-r--r--test/wsdl/axisArray/itemList.rb27
-rw-r--r--test/wsdl/axisArray/test_axisarray.rb69
-rw-r--r--test/wsdl/datetime/DatetimeService.rb44
-rw-r--r--test/wsdl/datetime/datetime.rb0
-rw-r--r--test/wsdl/datetime/datetime.wsdl45
-rw-r--r--test/wsdl/datetime/datetimeServant.rb21
-rw-r--r--test/wsdl/datetime/test_datetime.rb82
-rw-r--r--test/wsdl/document/document.wsdl74
-rw-r--r--test/wsdl/document/number.wsdl54
-rw-r--r--test/wsdl/document/ping_nosoapaction.wsdl66
-rw-r--r--test/wsdl/document/test_nosoapaction.rb109
-rw-r--r--test/wsdl/document/test_number.rb99
-rw-r--r--test/wsdl/document/test_rpc.rb177
-rw-r--r--test/wsdl/emptycomplextype.wsdl31
-rw-r--r--test/wsdl/map/map.wsdl92
-rw-r--r--test/wsdl/map/map.xml43
-rw-r--r--test/wsdl/map/test_map.rb99
-rw-r--r--test/wsdl/marshal/person.wsdl21
-rw-r--r--test/wsdl/marshal/person_org.rb22
-rw-r--r--test/wsdl/marshal/test_wsdlmarshal.rb80
-rw-r--r--test/wsdl/multiplefault.wsdl68
-rw-r--r--test/wsdl/qualified/lp.wsdl47
-rw-r--r--test/wsdl/qualified/lp.xsd26
-rw-r--r--test/wsdl/qualified/np.wsdl50
-rw-r--r--test/wsdl/qualified/test_qualified.rb154
-rw-r--r--test/wsdl/qualified/test_unqualified.rb143
-rw-r--r--test/wsdl/raa/RAA.rb243
-rw-r--r--test/wsdl/raa/RAAServant.rb99
-rw-r--r--test/wsdl/raa/RAAService.rb100
-rw-r--r--test/wsdl/raa/README.txt8
-rw-r--r--test/wsdl/raa/raa.wsdl264
-rw-r--r--test/wsdl/raa/server.rb103
-rw-r--r--test/wsdl/raa/test_raa.rb71
-rw-r--r--test/wsdl/ref/expectedProduct.rb90
-rw-r--r--test/wsdl/ref/product.wsdl86
-rw-r--r--test/wsdl/ref/test_ref.rb42
-rw-r--r--test/wsdl/rpc/rpc.wsdl75
-rw-r--r--test/wsdl/rpc/test-rpc-lit.wsdl364
-rw-r--r--test/wsdl/rpc/test-rpc-lit12.wsdl455
-rw-r--r--test/wsdl/rpc/test_rpc.rb118
-rw-r--r--test/wsdl/rpc/test_rpc_lit.rb399
-rw-r--r--test/wsdl/simpletype/rpc/expectedClient.rb34
-rw-r--r--test/wsdl/simpletype/rpc/expectedDriver.rb62
-rw-r--r--test/wsdl/simpletype/rpc/expectedEchoVersion.rb23
-rw-r--r--test/wsdl/simpletype/rpc/expectedServant.rb32
-rw-r--r--test/wsdl/simpletype/rpc/expectedService.rb60
-rw-r--r--test/wsdl/simpletype/rpc/rpc.wsdl80
-rw-r--r--test/wsdl/simpletype/rpc/test_rpc.rb50
-rw-r--r--test/wsdl/simpletype/simpletype.wsdl95
-rw-r--r--test/wsdl/simpletype/test_simpletype.rb99
-rw-r--r--test/wsdl/soap/soapbodyparts.wsdl103
-rw-r--r--test/wsdl/soap/test_soapbodyparts.rb79
-rw-r--r--test/wsdl/test_emptycomplextype.rb21
-rw-r--r--test/wsdl/test_fault.rb51
-rw-r--r--test/wsdl/test_multiplefault.rb39
-rw-r--r--test/xsd/codegen/test_classdef.rb214
-rw-r--r--test/xsd/noencoding.xml4
-rw-r--r--test/xsd/test_noencoding.rb32
-rw-r--r--test/xsd/test_xmlschemaparser.rb22
-rw-r--r--test/xsd/test_xsd.rb1511
-rw-r--r--test/xsd/xmlschema.xml12
237 files changed, 5 insertions, 30253 deletions
diff --git a/ChangeLog b/ChangeLog
index 844c45e97d..120d90b5d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Dec 24 17:06:37 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * {lib,test}/{soap,wsdl,xsd}: removed soap4r along to the discussion
+ at ruby-core and ruby-dev. see [ruby-core:12535], [ruby-dev:31969].
+
Mon Dec 24 17:06:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* load.c (rb_feature_p): returns loading path name too.
diff --git a/lib/soap/attachment.rb b/lib/soap/attachment.rb
deleted file mode 100644
index 1a59b14018..0000000000
--- a/lib/soap/attachment.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-# soap/attachment.rb: SOAP4R - SwA implementation.
-# Copyright (C) 2002, 2003 Jamie Herre and 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 'soap/baseData'
-require 'soap/mapping'
-
-
-module SOAP
-
-
-class SOAPAttachment < SOAPExternalReference
- attr_reader :data
-
- def initialize(value)
- super()
- @data = value
- end
-
-private
-
- def external_contentid
- @data.contentid
- end
-end
-
-
-class Attachment
- attr_reader :io
- attr_accessor :contenttype
-
- def initialize(string_or_readable = nil)
- @string_or_readable = string_or_readable
- @contenttype = "application/octet-stream"
- @contentid = nil
- end
-
- def contentid
- @contentid ||= Attachment.contentid(self)
- end
-
- def contentid=(contentid)
- @contentid = contentid
- end
-
- def mime_contentid
- '<' + contentid + '>'
- end
-
- def content
- if @content == nil and @string_or_readable != nil
- @content = @string_or_readable.respond_to?(:read) ?
- @string_or_readable.read : @string_or_readable
- end
- @content
- end
-
- def to_s
- content
- end
-
- def write(out)
- out.write(content)
- end
-
- def save(filename)
- File.open(filename, "wb") do |f|
- write(f)
- end
- end
-
- def self.contentid(obj)
- # this needs to be fixed
- [obj.__id__.to_s, Process.pid.to_s].join('.')
- end
-
- def self.mime_contentid(obj)
- '<' + contentid(obj) + '>'
- end
-end
-
-
-module Mapping
- class AttachmentFactory < SOAP::Mapping::Factory
- def obj2soap(soap_class, obj, info, map)
- soap_obj = soap_class.new(obj)
- mark_marshalled_obj(obj, soap_obj)
- soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- obj = node.data
- mark_unmarshalled_obj(node, obj)
- return true, obj
- end
- end
-
- DefaultRegistry.add(::SOAP::Attachment, ::SOAP::SOAPAttachment,
- AttachmentFactory.new, nil)
-end
-
-
-end
diff --git a/lib/soap/baseData.rb b/lib/soap/baseData.rb
deleted file mode 100644
index 72a6e0723d..0000000000
--- a/lib/soap/baseData.rb
+++ /dev/null
@@ -1,942 +0,0 @@
-# soap/baseData.rb: SOAP4R - Base type library
-# Copyright (C) 2000, 2001, 2003-2005 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 'soap/soap'
-
-
-module SOAP
-
-
-###
-## Mix-in module for SOAP base type classes.
-#
-module SOAPModuleUtils
- include SOAP
-
-public
-
- def decode(elename)
- d = self.new
- d.elename = elename
- d
- end
-end
-
-
-###
-## for SOAP type(base and compound)
-#
-module SOAPType
- attr_accessor :encodingstyle
- attr_accessor :elename
- attr_accessor :id
- attr_reader :precedents
- attr_accessor :root
- attr_accessor :parent
- attr_accessor :position
- attr_reader :extraattr
- attr_accessor :definedtype
-
- def initialize(*arg)
- super
- @encodingstyle = nil
- @elename = XSD::QName::EMPTY
- @id = nil
- @precedents = []
- @root = false
- @parent = nil
- @position = nil
- @definedtype = nil
- @extraattr = {}
- end
-
- def inspect
- if self.is_a?(XSD::NSDBase)
- sprintf("#<%s:0x%x %s %s>", self.class.name, __id__, self.elename, self.type)
- else
- sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.elename)
- end
- end
-
- def rootnode
- node = self
- while node = node.parent
- break if SOAPEnvelope === node
- end
- node
- end
-end
-
-
-###
-## for SOAP base type
-#
-module SOAPBasetype
- include SOAPType
- include SOAP
-
- def initialize(*arg)
- super
- end
-end
-
-
-###
-## for SOAP compound type
-#
-module SOAPCompoundtype
- include SOAPType
- include SOAP
-
- def initialize(*arg)
- super
- end
-end
-
-
-###
-## Convenience datatypes.
-#
-class SOAPReference < XSD::NSDBase
- include SOAPBasetype
- extend SOAPModuleUtils
-
-public
-
- attr_accessor :refid
-
- # Override the definition in SOAPBasetype.
- def initialize(obj = nil)
- super()
- @type = XSD::QName::EMPTY
- @refid = nil
- @obj = nil
- __setobj__(obj) if obj
- end
-
- def __getobj__
- @obj
- end
-
- def __setobj__(obj)
- @obj = obj
- @refid = @obj.id || SOAPReference.create_refid(@obj)
- @obj.id = @refid unless @obj.id
- @obj.precedents << self
- # Copies NSDBase information
- @obj.type = @type unless @obj.type
- end
-
- # Why don't I use delegate.rb?
- # -> delegate requires target object type at initialize time.
- # Why don't I use forwardable.rb?
- # -> forwardable requires a list of forwarding methods.
- #
- # ToDo: Maybe I should use forwardable.rb and give it a methods list like
- # delegate.rb...
- #
- def method_missing(msg_id, *params)
- if @obj
- @obj.send(msg_id, *params)
- else
- nil
- end
- end
-
- def refidstr
- '#' + @refid
- end
-
- def self.create_refid(obj)
- 'id' + obj.__id__.to_s
- end
-
- def self.decode(elename, refidstr)
- if /\A#(.*)\z/ =~ refidstr
- refid = $1
- elsif /\Acid:(.*)\z/ =~ refidstr
- refid = $1
- else
- raise ArgumentError.new("illegal refid #{refidstr}")
- end
- d = super(elename)
- d.refid = refid
- d
- end
-end
-
-
-class SOAPExternalReference < XSD::NSDBase
- include SOAPBasetype
- extend SOAPModuleUtils
-
- def initialize
- super()
- @type = XSD::QName::EMPTY
- end
-
- def referred
- rootnode.external_content[external_contentid] = self
- end
-
- def refidstr
- 'cid:' + external_contentid
- end
-
-private
-
- def external_contentid
- raise NotImplementedError.new
- end
-end
-
-
-class SOAPNil < XSD::XSDNil
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-# SOAPRawString is for sending raw string. In contrast to SOAPString,
-# SOAP4R does not do XML encoding and does not convert its CES. The string it
-# holds is embedded to XML instance directly as a 'xsd:string'.
-class SOAPRawString < XSD::XSDString
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-
-###
-## Basic datatypes.
-#
-class SOAPAnySimpleType < XSD::XSDAnySimpleType
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPString < XSD::XSDString
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPBoolean < XSD::XSDBoolean
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPDecimal < XSD::XSDDecimal
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPFloat < XSD::XSDFloat
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPDouble < XSD::XSDDouble
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPDuration < XSD::XSDDuration
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPDateTime < XSD::XSDDateTime
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPTime < XSD::XSDTime
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPDate < XSD::XSDDate
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPGYearMonth < XSD::XSDGYearMonth
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPGYear < XSD::XSDGYear
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPGMonthDay < XSD::XSDGMonthDay
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPGDay < XSD::XSDGDay
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPGMonth < XSD::XSDGMonth
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPHexBinary < XSD::XSDHexBinary
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPBase64 < XSD::XSDBase64Binary
- include SOAPBasetype
- extend SOAPModuleUtils
- Type = QName.new(EncodingNamespace, Base64Literal)
-
-public
- # Override the definition in SOAPBasetype.
- def initialize(value = nil)
- super(value)
- @type = Type
- end
-
- def as_xsd
- @type = XSD::XSDBase64Binary::Type
- end
-end
-
-class SOAPAnyURI < XSD::XSDAnyURI
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPQName < XSD::XSDQName
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-
-class SOAPInteger < XSD::XSDInteger
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPNonPositiveInteger < XSD::XSDNonPositiveInteger
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPNegativeInteger < XSD::XSDNegativeInteger
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPLong < XSD::XSDLong
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPInt < XSD::XSDInt
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPShort < XSD::XSDShort
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPByte < XSD::XSDByte
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPNonNegativeInteger < XSD::XSDNonNegativeInteger
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPUnsignedLong < XSD::XSDUnsignedLong
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPUnsignedInt < XSD::XSDUnsignedInt
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPUnsignedShort < XSD::XSDUnsignedShort
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPUnsignedByte < XSD::XSDUnsignedByte
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-class SOAPPositiveInteger < XSD::XSDPositiveInteger
- include SOAPBasetype
- extend SOAPModuleUtils
-end
-
-
-###
-## Compound datatypes.
-#
-class SOAPStruct < XSD::NSDBase
- include SOAPCompoundtype
- include Enumerable
-
-public
-
- def initialize(type = nil)
- super()
- @type = type || XSD::QName::EMPTY
- @array = []
- @data = []
- end
-
- def to_s()
- str = ''
- self.each do |key, data|
- str << "#{key}: #{data}\n"
- end
- str
- end
-
- def add(name, value)
- add_member(name, value)
- end
-
- def [](idx)
- if idx.is_a?(Range)
- @data[idx]
- elsif idx.is_a?(Integer)
- if (idx > @array.size)
- raise ArrayIndexOutOfBoundsError.new('In ' << @type.name)
- end
- @data[idx]
- else
- if @array.include?(idx)
- @data[@array.index(idx)]
- else
- nil
- end
- end
- end
-
- def []=(idx, data)
- if @array.include?(idx)
- data.parent = self if data.respond_to?(:parent=)
- @data[@array.index(idx)] = data
- else
- add(idx, data)
- end
- end
-
- def key?(name)
- @array.include?(name)
- end
-
- def members
- @array
- end
-
- def to_obj
- hash = {}
- proptype = {}
- each do |k, v|
- value = v.respond_to?(:to_obj) ? v.to_obj : v.to_s
- case proptype[k]
- when :single
- hash[k] = [hash[k], value]
- proptype[k] = :multi
- when :multi
- hash[k] << value
- else
- hash[k] = value
- proptype[k] = :single
- end
- end
- hash
- end
-
- def each
- idx = 0
- while idx < @array.length
- yield(@array[idx], @data[idx])
- idx += 1
- end
- end
-
- def replace
- members.each do |member|
- self[member] = yield(self[member])
- end
- end
-
- def self.decode(elename, type)
- s = SOAPStruct.new(type)
- s.elename = elename
- s
- end
-
-private
-
- def add_member(name, value = nil)
- value = SOAPNil.new() if value.nil?
- @array.push(name)
- value.elename = value.elename.dup_name(name)
- @data.push(value)
- value.parent = self if value.respond_to?(:parent=)
- value
- end
-end
-
-
-# SOAPElement is not typed so it is not derived from NSDBase.
-class SOAPElement
- include Enumerable
-
- attr_accessor :encodingstyle
-
- attr_accessor :elename
- attr_accessor :id
- attr_reader :precedents
- attr_accessor :root
- attr_accessor :parent
- attr_accessor :position
- attr_accessor :extraattr
-
- attr_accessor :qualified
-
- def initialize(elename, text = nil)
- if !elename.is_a?(XSD::QName)
- elename = XSD::QName.new(nil, elename)
- end
- @encodingstyle = LiteralNamespace
- @elename = elename
- @id = nil
- @precedents = []
- @root = false
- @parent = nil
- @position = nil
- @extraattr = {}
-
- @qualified = nil
-
- @array = []
- @data = []
- @text = text
- end
-
- def inspect
- sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.elename)
- end
-
- # Text interface.
- attr_accessor :text
- alias data text
-
- # Element interfaces.
- def add(value)
- add_member(value.elename.name, value)
- end
-
- def [](idx)
- if @array.include?(idx)
- @data[@array.index(idx)]
- else
- nil
- end
- end
-
- def []=(idx, data)
- if @array.include?(idx)
- data.parent = self if data.respond_to?(:parent=)
- @data[@array.index(idx)] = data
- else
- add(data)
- end
- end
-
- def key?(name)
- @array.include?(name)
- end
-
- def members
- @array
- end
-
- def to_obj
- if members.empty?
- @text
- else
- hash = {}
- proptype = {}
- each do |k, v|
- value = v.respond_to?(:to_obj) ? v.to_obj : v.to_s
- case proptype[k]
- when :single
- hash[k] = [hash[k], value]
- proptype[k] = :multi
- when :multi
- hash[k] << value
- else
- hash[k] = value
- proptype[k] = :single
- end
- end
- hash
- end
- end
-
- def each
- idx = 0
- while idx < @array.length
- yield(@array[idx], @data[idx])
- idx += 1
- end
- end
-
- def self.decode(elename)
- o = SOAPElement.new(elename)
- o
- end
-
- def self.from_obj(obj, namespace = nil)
- o = SOAPElement.new(nil)
- case obj
- when nil
- o.text = nil
- when Hash
- obj.each do |elename, value|
- if value.is_a?(Array)
- value.each do |subvalue|
- child = from_obj(subvalue, namespace)
- child.elename = to_elename(elename, namespace)
- o.add(child)
- end
- else
- child = from_obj(value, namespace)
- child.elename = to_elename(elename, namespace)
- o.add(child)
- end
- end
- else
- o.text = obj.to_s
- end
- o
- end
-
- def self.to_elename(obj, namespace = nil)
- if obj.is_a?(XSD::QName)
- obj
- elsif /\A(.+):([^:]+)\z/ =~ obj.to_s
- XSD::QName.new($1, $2)
- else
- XSD::QName.new(namespace, obj.to_s)
- end
- end
-
-private
-
- def add_member(name, value)
- add_accessor(name)
- @array.push(name)
- @data.push(value)
- value.parent = self if value.respond_to?(:parent=)
- value
- end
-
- if RUBY_VERSION > "1.7.0"
- def add_accessor(name)
- methodname = name
- if self.respond_to?(methodname)
- methodname = safe_accessor_name(methodname)
- end
- Mapping.define_singleton_method(self, methodname) do
- @data[@array.index(name)]
- end
- Mapping.define_singleton_method(self, methodname + '=') do |value|
- @data[@array.index(name)] = value
- end
- end
- else
- def add_accessor(name)
- methodname = safe_accessor_name(name)
- instance_eval <<-EOS
- def #{methodname}
- @data[@array.index(#{name.dump})]
- end
-
- def #{methodname}=(value)
- @data[@array.index(#{name.dump})] = value
- end
- EOS
- end
- end
-
- def safe_accessor_name(name)
- "var_" << name.gsub(/[^a-zA-Z0-9_]/, '')
- end
-end
-
-
-class SOAPArray < XSD::NSDBase
- include SOAPCompoundtype
- include Enumerable
-
-public
-
- attr_accessor :sparse
-
- attr_reader :offset, :rank
- attr_accessor :size, :size_fixed
- attr_reader :arytype
-
- def initialize(type = nil, rank = 1, arytype = nil)
- super()
- @type = type || ValueArrayName
- @rank = rank
- @data = Array.new
- @sparse = false
- @offset = Array.new(rank, 0)
- @size = Array.new(rank, 0)
- @size_fixed = false
- @position = nil
- @arytype = arytype
- end
-
- def offset=(var)
- @offset = var
- @sparse = true
- end
-
- def add(value)
- self[*(@offset)] = value
- end
-
- def [](*idxary)
- if idxary.size != @rank
- raise ArgumentError.new("given #{idxary.size} params does not match rank: #{@rank}")
- end
-
- retrieve(idxary)
- end
-
- def []=(*idxary)
- value = idxary.slice!(-1)
-
- if idxary.size != @rank
- raise ArgumentError.new("given #{idxary.size} params(#{idxary})" +
- " does not match rank: #{@rank}")
- end
-
- idx = 0
- while idx < idxary.size
- if idxary[idx] + 1 > @size[idx]
- @size[idx] = idxary[idx] + 1
- end
- idx += 1
- end
-
- data = retrieve(idxary[0, idxary.size - 1])
- data[idxary.last] = value
-
- if value.is_a?(SOAPType)
- value.elename = ITEM_NAME
- # Sync type
- unless @type.name
- @type = XSD::QName.new(value.type.namespace,
- SOAPArray.create_arytype(value.type.name, @rank))
- end
- value.type ||= @type
- end
-
- @offset = idxary
- value.parent = self if value.respond_to?(:parent=)
- offsetnext
- end
-
- def each
- @data.each do |data|
- yield(data)
- end
- end
-
- def to_a
- @data.dup
- end
-
- def replace
- @data = deep_map(@data) do |ele|
- yield(ele)
- end
- end
-
- def deep_map(ary, &block)
- ary.collect do |ele|
- if ele.is_a?(Array)
- deep_map(ele, &block)
- else
- new_obj = yield(ele)
- new_obj.elename = ITEM_NAME
- new_obj
- end
- end
- end
-
- def include?(var)
- traverse_data(@data) do |v, *rank|
- if v.is_a?(SOAPBasetype) && v.data == var
- return true
- end
- end
- false
- end
-
- def traverse
- traverse_data(@data) do |v, *rank|
- unless @sparse
- yield(v)
- else
- yield(v, *rank) if v && !v.is_a?(SOAPNil)
- end
- end
- end
-
- def soap2array(ary)
- traverse_data(@data) do |v, *position|
- iteary = ary
- rank = 1
- while rank < position.size
- idx = position[rank - 1]
- if iteary[idx].nil?
- iteary = iteary[idx] = Array.new
- else
- iteary = iteary[idx]
- end
- rank += 1
- end
- if block_given?
- iteary[position.last] = yield(v)
- else
- iteary[position.last] = v
- end
- end
- end
-
- def position
- @position
- end
-
-private
-
- ITEM_NAME = XSD::QName.new(nil, 'item')
-
- def retrieve(idxary)
- data = @data
- rank = 1
- while rank <= idxary.size
- idx = idxary[rank - 1]
- if data[idx].nil?
- data = data[idx] = Array.new
- else
- data = data[idx]
- end
- rank += 1
- end
- data
- end
-
- def traverse_data(data, rank = 1)
- idx = 0
- while idx < ranksize(rank)
- if rank < @rank
- traverse_data(data[idx], rank + 1) do |*v|
- v[1, 0] = idx
- yield(*v)
- end
- else
- yield(data[idx], idx)
- end
- idx += 1
- end
- end
-
- def ranksize(rank)
- @size[rank - 1]
- end
-
- def offsetnext
- move = false
- idx = @offset.size - 1
- while !move && idx >= 0
- @offset[idx] += 1
- if @size_fixed
- if @offset[idx] < @size[idx]
- move = true
- else
- @offset[idx] = 0
- idx -= 1
- end
- else
- move = true
- end
- end
- end
-
- # Module function
-
-public
-
- def self.decode(elename, type, arytype)
- typestr, nofary = parse_type(arytype.name)
- rank = nofary.count(',') + 1
- plain_arytype = XSD::QName.new(arytype.namespace, typestr)
- o = SOAPArray.new(type, rank, plain_arytype)
- size = []
- nofary.split(',').each do |s|
- if s.empty?
- size.clear
- break
- else
- size << s.to_i
- end
- end
- unless size.empty?
- o.size = size
- o.size_fixed = true
- end
- o.elename = elename
- o
- end
-
-private
-
- def self.create_arytype(typename, rank)
- "#{typename}[" << ',' * (rank - 1) << ']'
- end
-
- TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$')
-
- def self.parse_type(string)
- TypeParseRegexp =~ string
- return $1, $2
- end
-end
-
-
-require 'soap/mapping/typeMap'
-
-
-end
diff --git a/lib/soap/element.rb b/lib/soap/element.rb
deleted file mode 100644
index cc58b5d341..0000000000
--- a/lib/soap/element.rb
+++ /dev/null
@@ -1,258 +0,0 @@
-# SOAP4R - SOAP elements library
-# Copyright (C) 2000, 2001, 2003-2005 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 'soap/baseData'
-
-
-module SOAP
-
-
-###
-## SOAP elements
-#
-module SOAPEnvelopeElement; end
-
-class SOAPFault < SOAPStruct
- include SOAPEnvelopeElement
- include SOAPCompoundtype
-
-public
-
- def faultcode
- self['faultcode']
- end
-
- def faultstring
- self['faultstring']
- end
-
- def faultactor
- self['faultactor']
- end
-
- def detail
- self['detail']
- end
-
- def faultcode=(rhs)
- self['faultcode'] = rhs
- end
-
- def faultstring=(rhs)
- self['faultstring'] = rhs
- end
-
- def faultactor=(rhs)
- self['faultactor'] = rhs
- end
-
- def detail=(rhs)
- self['detail'] = rhs
- end
-
- def initialize(faultcode = nil, faultstring = nil, faultactor = nil, detail = nil)
- super(EleFaultName)
- @elename = EleFaultName
- @encodingstyle = EncodingNamespace
-
- if faultcode
- self.faultcode = faultcode
- self.faultstring = faultstring
- self.faultactor = faultactor
- self.detail = detail
- self.faultcode.elename = EleFaultCodeName if self.faultcode
- self.faultstring.elename = EleFaultStringName if self.faultstring
- self.faultactor.elename = EleFaultActorName if self.faultactor
- self.detail.elename = EleFaultDetailName if self.detail
- end
- faultcode.parent = self if faultcode
- faultstring.parent = self if faultstring
- faultactor.parent = self if faultactor
- detail.parent = self if detail
- end
-
- def encode(generator, ns, attrs = {})
- SOAPGenerator.assign_ns(attrs, ns, EnvelopeNamespace)
- SOAPGenerator.assign_ns(attrs, ns, EncodingNamespace)
- attrs[ns.name(AttrEncodingStyleName)] = EncodingNamespace
- name = ns.name(@elename)
- generator.encode_tag(name, attrs)
- yield(self.faultcode)
- yield(self.faultstring)
- yield(self.faultactor)
- yield(self.detail) if self.detail
- generator.encode_tag_end(name, true)
- end
-end
-
-
-class SOAPBody < SOAPStruct
- include SOAPEnvelopeElement
-
- def initialize(data = nil, is_fault = false)
- super(nil)
- @elename = EleBodyName
- @encodingstyle = nil
- if data
- if data.respond_to?(:elename)
- add(data.elename.name, data)
- else
- data.to_a.each do |datum|
- add(datum.elename.name, datum)
- end
- end
- end
- @is_fault = is_fault
- end
-
- def encode(generator, ns, attrs = {})
- name = ns.name(@elename)
- generator.encode_tag(name, attrs)
- if @is_fault
- yield(@data)
- else
- @data.each do |data|
- yield(data)
- end
- end
- generator.encode_tag_end(name, true)
- end
-
- def root_node
- @data.each do |node|
- if node.root == 1
- return node
- end
- end
- # No specified root...
- @data.each do |node|
- if node.root != 0
- return node
- end
- end
-
- raise Parser::FormatDecodeError.new('no root element')
- end
-end
-
-
-class SOAPHeaderItem < XSD::NSDBase
- include SOAPEnvelopeElement
- include SOAPCompoundtype
-
-public
-
- attr_accessor :element
- attr_accessor :mustunderstand
- attr_accessor :encodingstyle
-
- def initialize(element, mustunderstand = true, encodingstyle = nil)
- super()
- @type = nil
- @element = element
- @mustunderstand = mustunderstand
- @encodingstyle = encodingstyle
- element.parent = self if element
- end
-
- def encode(generator, ns, attrs = {})
- attrs.each do |key, value|
- @element.extraattr[key] = value
- end
- @element.extraattr[ns.name(AttrMustUnderstandName)] =
- (@mustunderstand ? '1' : '0')
- if @encodingstyle
- @element.extraattr[ns.name(AttrEncodingStyleName)] = @encodingstyle
- end
- @element.encodingstyle = @encodingstyle if !@element.encodingstyle
- yield(@element)
- end
-end
-
-
-class SOAPHeader < SOAPStruct
- include SOAPEnvelopeElement
-
- def initialize
- super(nil)
- @elename = EleHeaderName
- @encodingstyle = nil
- end
-
- def encode(generator, ns, attrs = {})
- name = ns.name(@elename)
- generator.encode_tag(name, attrs)
- @data.each do |data|
- yield(data)
- end
- generator.encode_tag_end(name, true)
- end
-
- def add(name, value)
- mu = (value.extraattr[AttrMustUnderstandName] == '1')
- encstyle = value.extraattr[AttrEncodingStyleName]
- item = SOAPHeaderItem.new(value, mu, encstyle)
- super(name, item)
- end
-
- def length
- @data.length
- end
- alias size length
-end
-
-
-class SOAPEnvelope < XSD::NSDBase
- include SOAPEnvelopeElement
- include SOAPCompoundtype
-
- attr_reader :header
- attr_reader :body
- attr_reader :external_content
-
- def initialize(header = nil, body = nil)
- super()
- @type = nil
- @elename = EleEnvelopeName
- @encodingstyle = nil
- @header = header
- @body = body
- @external_content = {}
- header.parent = self if header
- body.parent = self if body
- end
-
- def header=(header)
- header.parent = self
- @header = header
- end
-
- def body=(body)
- body.parent = self
- @body = body
- end
-
- def encode(generator, ns, attrs = {})
- SOAPGenerator.assign_ns(attrs, ns, elename.namespace, SOAPNamespaceTag)
- name = ns.name(@elename)
- generator.encode_tag(name, attrs)
-
- yield(@header) if @header and @header.length > 0
- yield(@body)
-
- generator.encode_tag_end(name, true)
- end
-
- def to_ary
- [header, body]
- end
-end
-
-
-end
diff --git a/lib/soap/encodingstyle/aspDotNetHandler.rb b/lib/soap/encodingstyle/aspDotNetHandler.rb
deleted file mode 100644
index fd7e0fa217..0000000000
--- a/lib/soap/encodingstyle/aspDotNetHandler.rb
+++ /dev/null
@@ -1,213 +0,0 @@
-# SOAP4R - ASP.NET EncodingStyle handler library
-# Copyright (C) 2001, 2003, 2005 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 'soap/encodingstyle/handler'
-
-
-module SOAP
-module EncodingStyle
-
-
-class ASPDotNetHandler < Handler
- Namespace = 'http://tempuri.org/ASP.NET'
- add_handler
-
- def initialize(charset = nil)
- super(charset)
- @textbuf = ''
- @decode_typemap = nil
- end
-
-
- ###
- ## encode interface.
- #
- def encode_data(generator, ns, data, parent)
- attrs = {}
- # ASPDotNetHandler is intended to be used for accessing an ASP.NET doc/lit
- # service as an rpc/encoded service. in the situation, local elements
- # should be qualified. propagate parent's namespace to children.
- if data.elename.namespace.nil?
- data.elename.namespace = parent.elename.namespace
- end
- name = generator.encode_name(ns, data, attrs)
- case data
- when SOAPRawString
- generator.encode_tag(name, attrs)
- generator.encode_rawstring(data.to_s)
- when XSD::XSDString
- generator.encode_tag(name, attrs)
- generator.encode_string(@charset ?
- XSD::Charset.encoding_to_xml(data.to_s, @charset) : data.to_s)
- when XSD::XSDAnySimpleType
- generator.encode_tag(name, attrs)
- generator.encode_string(data.to_s)
- when SOAPStruct
- generator.encode_tag(name, attrs)
- data.each do |key, value|
- generator.encode_child(ns, value, data)
- end
- when SOAPArray
- generator.encode_tag(name, attrs)
- data.traverse do |child, *rank|
- data.position = nil
- generator.encode_child(ns, child, data)
- end
- else
- raise EncodingStyleError.new(
- "unknown object:#{data} in this encodingStyle")
- end
- end
-
- def encode_data_end(generator, ns, data, parent)
- name = generator.encode_name_end(ns, data)
- cr = data.is_a?(SOAPCompoundtype)
- generator.encode_tag_end(name, cr)
- end
-
-
- ###
- ## decode interface.
- #
- class SOAPTemporalObject
- attr_accessor :parent
-
- def initialize
- @parent = nil
- end
- end
-
- class SOAPUnknown < SOAPTemporalObject
- def initialize(handler, elename)
- super()
- @handler = handler
- @elename = elename
- end
-
- def as_struct
- o = SOAPStruct.decode(@elename, XSD::AnyTypeName)
- o.parent = @parent
- o.type.name = @name
- @handler.decode_parent(@parent, o)
- o
- end
-
- def as_string
- o = SOAPString.decode(@elename)
- o.parent = @parent
- @handler.decode_parent(@parent, o)
- o
- end
-
- def as_nil
- o = SOAPNil.decode(@elename)
- o.parent = @parent
- @handler.decode_parent(@parent, o)
- o
- end
- end
-
- def decode_tag(ns, elename, attrs, parent)
- @textbuf = ''
- o = SOAPUnknown.new(self, elename)
- o.parent = parent
- o
- end
-
- def decode_tag_end(ns, node)
- o = node.node
- if o.is_a?(SOAPUnknown)
- newnode = o.as_string
-# if /\A\s*\z/ =~ @textbuf
-# o.as_struct
-# else
-# o.as_string
-# end
- node.replace_node(newnode)
- o = node.node
- end
-
- decode_textbuf(o)
- @textbuf = ''
- end
-
- def decode_text(ns, text)
- # @textbuf is set at decode_tag_end.
- @textbuf << text
- end
-
- def decode_prologue
- end
-
- def decode_epilogue
- end
-
- def decode_parent(parent, node)
- case parent.node
- when SOAPUnknown
- newparent = parent.node.as_struct
- node.parent = newparent
- parent.replace_node(newparent)
- decode_parent(parent, node)
-
- when SOAPStruct
- data = parent.node[node.elename.name]
- case data
- when nil
- parent.node.add(node.elename.name, node)
- when SOAPArray
- name, type_ns = node.elename.name, node.type.namespace
- data.add(node)
- node.elename, node.type.namespace = name, type_ns
- else
- parent.node[node.elename.name] = SOAPArray.new
- name, type_ns = data.elename.name, data.type.namespace
- parent.node[node.elename.name].add(data)
- data.elename.name, data.type.namespace = name, type_ns
- name, type_ns = node.elename.name, node.type.namespace
- parent.node[node.elename.name].add(node)
- node.elename.name, node.type.namespace = name, type_ns
- end
-
- when SOAPArray
- if node.position
- parent.node[*(decode_arypos(node.position))] = node
- parent.node.sparse = true
- else
- parent.node.add(node)
- end
-
- when SOAPBasetype
- raise EncodingStyleError.new("SOAP base type must not have a child")
-
- else
- # SOAPUnknown does not have parent.
- # raise EncodingStyleError.new("illegal parent: #{parent}")
- end
- end
-
-private
-
- def decode_textbuf(node)
- if node.is_a?(XSD::XSDString)
- if @charset
- node.set(XSD::Charset.encoding_from_xml(@textbuf, @charset))
- else
- node.set(@textbuf)
- end
- else
- # Nothing to do...
- end
- end
-end
-
-ASPDotNetHandler.new
-
-
-end
-end
diff --git a/lib/soap/encodingstyle/handler.rb b/lib/soap/encodingstyle/handler.rb
deleted file mode 100644
index c015417435..0000000000
--- a/lib/soap/encodingstyle/handler.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-# SOAP4R - EncodingStyle handler library
-# Copyright (C) 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 'soap/soap'
-require 'soap/baseData'
-require 'soap/element'
-
-
-module SOAP
-module EncodingStyle
-
-
-class Handler
- @@handlers = {}
-
- class EncodingStyleError < Error; end
-
- class << self
- def uri
- self::Namespace
- end
-
- def handler(uri)
- @@handlers[uri]
- end
-
- def each
- @@handlers.each do |key, value|
- yield(value)
- end
- end
-
- private
-
- def add_handler
- @@handlers[self.uri] = self
- end
- end
-
- attr_reader :charset
- attr_accessor :generate_explicit_type
- def decode_typemap=(definedtypes)
- @decode_typemap = definedtypes
- end
-
- def initialize(charset)
- @charset = charset
- @generate_explicit_type = true
- @decode_typemap = nil
- end
-
- ###
- ## encode interface.
- #
- # Returns a XML instance as a string.
- def encode_data(generator, ns, data, parent)
- raise NotImplementError
- end
-
- def encode_data_end(generator, ns, data, parent)
- raise NotImplementError
- end
-
- def encode_prologue
- end
-
- def encode_epilogue
- end
-
- ###
- ## decode interface.
- #
- # Returns SOAP/OM data.
- def decode_tag(ns, name, attrs, parent)
- raise NotImplementError.new('Method decode_tag must be defined in derived class.')
- end
-
- def decode_tag_end(ns, name)
- raise NotImplementError.new('Method decode_tag_end must be defined in derived class.')
- end
-
- def decode_text(ns, text)
- raise NotImplementError.new('Method decode_text must be defined in derived class.')
- end
-
- def decode_prologue
- end
-
- def decode_epilogue
- end
-end
-
-
-end
-end
diff --git a/lib/soap/encodingstyle/literalHandler.rb b/lib/soap/encodingstyle/literalHandler.rb
deleted file mode 100644
index 59c7205366..0000000000
--- a/lib/soap/encodingstyle/literalHandler.rb
+++ /dev/null
@@ -1,226 +0,0 @@
-# SOAP4R - XML Literal EncodingStyle handler library
-# Copyright (C) 2001, 2003-2005 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 'soap/encodingstyle/handler'
-
-
-module SOAP
-module EncodingStyle
-
-
-class LiteralHandler < Handler
- Namespace = SOAP::LiteralNamespace
- add_handler
-
- def initialize(charset = nil)
- super(charset)
- @textbuf = ''
- end
-
-
- ###
- ## encode interface.
- #
- def encode_data(generator, ns, data, parent)
- attrs = {}
- name = generator.encode_name(ns, data, attrs)
- data.extraattr.each do |k, v|
- # ToDo: check generator.attributeformdefault here
- if k.is_a?(XSD::QName)
- if k.namespace
- SOAPGenerator.assign_ns(attrs, ns, k.namespace)
- k = ns.name(k)
- else
- k = k.name
- end
- end
- attrs[k] = v
- end
- case data
- when SOAPRawString
- generator.encode_tag(name, attrs)
- generator.encode_rawstring(data.to_s)
- when XSD::XSDString
- generator.encode_tag(name, attrs)
- str = data.to_s
- str = XSD::Charset.encoding_to_xml(str, @charset) if @charset
- generator.encode_string(str)
- when XSD::XSDAnySimpleType
- generator.encode_tag(name, attrs)
- generator.encode_string(data.to_s)
- when SOAPStruct
- generator.encode_tag(name, attrs)
- data.each do |key, value|
- generator.encode_child(ns, value, data)
- end
- when SOAPArray
- generator.encode_tag(name, attrs)
- data.traverse do |child, *rank|
- data.position = nil
- generator.encode_child(ns, child, data)
- end
- when SOAPElement
- # passes 2 times for simplifying namespace definition
- data.each do |key, value|
- if value.elename.namespace
- SOAPGenerator.assign_ns(attrs, ns, value.elename.namespace)
- end
- end
- generator.encode_tag(name, attrs)
- generator.encode_rawstring(data.text) if data.text
- data.each do |key, value|
- generator.encode_child(ns, value, data)
- end
- else
- raise EncodingStyleError.new(
- "unknown object:#{data} in this encodingStyle")
- end
- end
-
- def encode_data_end(generator, ns, data, parent)
- name = generator.encode_name_end(ns, data)
- cr = (data.is_a?(SOAPCompoundtype) or
- (data.is_a?(SOAPElement) and !data.text))
- generator.encode_tag_end(name, cr)
- end
-
-
- ###
- ## decode interface.
- #
- class SOAPTemporalObject
- attr_accessor :parent
-
- def initialize
- @parent = nil
- end
- end
-
- class SOAPUnknown < SOAPTemporalObject
- def initialize(handler, elename, extraattr)
- super()
- @handler = handler
- @elename = elename
- @extraattr = extraattr
- end
-
- def as_element
- o = SOAPElement.decode(@elename)
- o.parent = @parent
- o.extraattr.update(@extraattr)
- @handler.decode_parent(@parent, o)
- o
- end
-
- def as_string
- o = SOAPString.decode(@elename)
- o.parent = @parent
- o.extraattr.update(@extraattr)
- @handler.decode_parent(@parent, o)
- o
- end
-
- def as_nil
- o = SOAPNil.decode(@elename)
- o.parent = @parent
- o.extraattr.update(@extraattr)
- @handler.decode_parent(@parent, o)
- o
- end
- end
-
- def decode_tag(ns, elename, attrs, parent)
- @textbuf = ''
- o = SOAPUnknown.new(self, elename, decode_attrs(ns, attrs))
- o.parent = parent
- o
- end
-
- def decode_tag_end(ns, node)
- o = node.node
- if o.is_a?(SOAPUnknown)
- newnode = if /\A\s*\z/ =~ @textbuf
- o.as_element
- else
- o.as_string
- end
- node.replace_node(newnode)
- o = node.node
- end
-
- decode_textbuf(o)
- @textbuf = ''
- end
-
- def decode_text(ns, text)
- # @textbuf is set at decode_tag_end.
- @textbuf << text
- end
-
- def decode_attrs(ns, attrs)
- extraattr = {}
- attrs.each do |key, value|
- qname = ns.parse_local(key)
- extraattr[qname] = value
- end
- extraattr
- end
-
- def decode_prologue
- end
-
- def decode_epilogue
- end
-
- def decode_parent(parent, node)
- return unless parent.node
- case parent.node
- when SOAPUnknown
- newparent = parent.node.as_element
- node.parent = newparent
- parent.replace_node(newparent)
- decode_parent(parent, node)
- when SOAPElement
- parent.node.add(node)
- node.parent = parent.node
- when SOAPStruct
- parent.node.add(node.elename.name, node)
- node.parent = parent.node
- when SOAPArray
- if node.position
- parent.node[*(decode_arypos(node.position))] = node
- parent.node.sparse = true
- else
- parent.node.add(node)
- end
- node.parent = parent.node
- else
- raise EncodingStyleError.new("illegal parent: #{parent.node}")
- end
- end
-
-private
-
- def decode_textbuf(node)
- if node.is_a?(XSD::XSDString)
- if @charset
- node.set(XSD::Charset.encoding_from_xml(@textbuf, @charset))
- else
- node.set(@textbuf)
- end
- else
- # Nothing to do...
- end
- end
-end
-
-LiteralHandler.new
-
-
-end
-end
diff --git a/lib/soap/encodingstyle/soapHandler.rb b/lib/soap/encodingstyle/soapHandler.rb
deleted file mode 100644
index a522392625..0000000000
--- a/lib/soap/encodingstyle/soapHandler.rb
+++ /dev/null
@@ -1,582 +0,0 @@
-# SOAP4R - SOAP EncodingStyle handler library
-# Copyright (C) 2001, 2003, 2005 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 'soap/encodingstyle/handler'
-
-
-module SOAP
-module EncodingStyle
-
-
-class SOAPHandler < Handler
- Namespace = SOAP::EncodingNamespace
- add_handler
-
- def initialize(charset = nil)
- super(charset)
- @refpool = []
- @idpool = []
- @textbuf = ''
- @is_first_top_ele = true
- end
-
-
- ###
- ## encode interface.
- #
- def encode_data(generator, ns, data, parent)
- attrs = encode_attrs(generator, ns, data, parent)
- if parent && parent.is_a?(SOAPArray) && parent.position
- attrs[ns.name(AttrPositionName)] = "[#{parent.position.join(',')}]"
- end
- name = generator.encode_name(ns, data, attrs)
- case data
- when SOAPReference
- attrs['href'] = data.refidstr
- generator.encode_tag(name, attrs)
- when SOAPExternalReference
- data.referred
- attrs['href'] = data.refidstr
- generator.encode_tag(name, attrs)
- when SOAPRawString
- generator.encode_tag(name, attrs)
- generator.encode_rawstring(data.to_s)
- when XSD::XSDString
- generator.encode_tag(name, attrs)
- generator.encode_string(@charset ?
- XSD::Charset.encoding_to_xml(data.to_s, @charset) : data.to_s)
- when XSD::XSDAnySimpleType
- generator.encode_tag(name, attrs)
- generator.encode_string(data.to_s)
- when SOAPStruct
- generator.encode_tag(name, attrs)
- data.each do |key, value|
- generator.encode_child(ns, value, data)
- end
- when SOAPArray
- generator.encode_tag(name, attrs)
- data.traverse do |child, *rank|
- data.position = data.sparse ? rank : nil
- generator.encode_child(ns, child, data)
- end
- else
- raise EncodingStyleError.new(
- "unknown object:#{data} in this encodingStyle")
- end
- end
-
- def encode_data_end(generator, ns, data, parent)
- name = generator.encode_name_end(ns, data)
- cr = data.is_a?(SOAPCompoundtype)
- generator.encode_tag_end(name, cr)
- end
-
-
- ###
- ## decode interface.
- #
- class SOAPTemporalObject
- attr_accessor :parent
- attr_accessor :position
- attr_accessor :id
- attr_accessor :root
-
- def initialize
- @parent = nil
- @position = nil
- @id = nil
- @root = nil
- end
- end
-
- class SOAPUnknown < SOAPTemporalObject
- attr_reader :type
- attr_accessor :definedtype
- attr_reader :extraattr
-
- def initialize(handler, elename, type, extraattr)
- super()
- @handler = handler
- @elename = elename
- @type = type
- @extraattr = extraattr
- @definedtype = nil
- end
-
- def as_struct
- o = SOAPStruct.decode(@elename, @type)
- o.id = @id
- o.root = @root
- o.parent = @parent
- o.position = @position
- o.extraattr.update(@extraattr)
- @handler.decode_parent(@parent, o)
- o
- end
-
- def as_string
- o = SOAPString.decode(@elename)
- o.id = @id
- o.root = @root
- o.parent = @parent
- o.position = @position
- o.extraattr.update(@extraattr)
- @handler.decode_parent(@parent, o)
- o
- end
-
- def as_nil
- o = SOAPNil.decode(@elename)
- o.id = @id
- o.root = @root
- o.parent = @parent
- o.position = @position
- o.extraattr.update(@extraattr)
- @handler.decode_parent(@parent, o)
- o
- end
- end
-
- def decode_tag(ns, elename, attrs, parent)
- @textbuf = ''
- is_nil, type, arytype, root, offset, position, href, id, extraattr =
- decode_attrs(ns, attrs)
- o = nil
- if is_nil
- o = SOAPNil.decode(elename)
- elsif href
- o = SOAPReference.decode(elename, href)
- @refpool << o
- elsif @decode_typemap
- o = decode_tag_by_wsdl(ns, elename, type, parent.node, arytype, extraattr)
- else
- o = decode_tag_by_type(ns, elename, type, parent.node, arytype, extraattr)
- end
-
- if o.is_a?(SOAPArray)
- if offset
- o.offset = decode_arypos(offset)
- o.sparse = true
- else
- o.sparse = false
- end
- end
-
- o.parent = parent
- o.id = id
- o.root = root
- o.position = position
-
- unless o.is_a?(SOAPTemporalObject)
- @idpool << o if o.id
- decode_parent(parent, o)
- end
- o
- end
-
- def decode_tag_end(ns, node)
- o = node.node
- if o.is_a?(SOAPUnknown)
- newnode = if /\A\s*\z/ =~ @textbuf
- o.as_struct
- else
- o.as_string
- end
- if newnode.id
- @idpool << newnode
- end
- node.replace_node(newnode)
- o = node.node
- end
- decode_textbuf(o)
- # unlink definedtype
- o.definedtype = nil
- end
-
- def decode_text(ns, text)
- @textbuf << text
- end
-
- def decode_prologue
- @refpool.clear
- @idpool.clear
- @is_first_top_ele = true
- end
-
- def decode_epilogue
- decode_resolve_id
- end
-
- def decode_parent(parent, node)
- return unless parent.node
- case parent.node
- when SOAPUnknown
- newparent = parent.node.as_struct
- node.parent = newparent
- if newparent.id
- @idpool << newparent
- end
- parent.replace_node(newparent)
- decode_parent(parent, node)
- when SOAPStruct
- parent.node.add(node.elename.name, node)
- node.parent = parent.node
- when SOAPArray
- if node.position
- parent.node[*(decode_arypos(node.position))] = node
- parent.node.sparse = true
- else
- parent.node.add(node)
- end
- node.parent = parent.node
- else
- raise EncodingStyleError.new("illegal parent: #{parent.node}")
- end
- end
-
-private
-
- def content_ranksize(typename)
- typename.scan(/\[[\d,]*\]$/)[0]
- end
-
- def content_typename(typename)
- typename.sub(/\[,*\]$/, '')
- end
-
- def create_arytype(ns, data)
- XSD::QName.new(data.arytype.namespace,
- content_typename(data.arytype.name) + "[#{data.size.join(',')}]")
- end
-
- def encode_attrs(generator, ns, data, parent)
- attrs = {}
- return attrs if data.is_a?(SOAPReference)
-
- if !parent || parent.encodingstyle != EncodingNamespace
- if @generate_explicit_type
- SOAPGenerator.assign_ns(attrs, ns, EnvelopeNamespace)
- attrs[ns.name(AttrEncodingStyleName)] = EncodingNamespace
- end
- data.encodingstyle = EncodingNamespace
- end
-
- if data.is_a?(SOAPNil)
- attrs[ns.name(XSD::AttrNilName)] = XSD::NilValue
- elsif @generate_explicit_type
- if data.type.namespace
- SOAPGenerator.assign_ns(attrs, ns, data.type.namespace)
- end
- if data.is_a?(SOAPArray)
- if data.arytype.namespace
- SOAPGenerator.assign_ns(attrs, ns, data.arytype.namespace)
- end
- SOAPGenerator.assign_ns(attrs, ns, EncodingNamespace)
- attrs[ns.name(AttrArrayTypeName)] = ns.name(create_arytype(ns, data))
- if data.type.name
- attrs[ns.name(XSD::AttrTypeName)] = ns.name(data.type)
- end
- elsif parent && parent.is_a?(SOAPArray) && (parent.arytype == data.type)
- # No need to add.
- elsif !data.type.namespace
- # No need to add.
- else
- attrs[ns.name(XSD::AttrTypeName)] = ns.name(data.type)
- end
- end
-
- data.extraattr.each do |key, value|
- SOAPGenerator.assign_ns(attrs, ns, key.namespace)
- attrs[ns.name(key)] = encode_attr_value(generator, ns, key, value)
- end
- if data.id
- attrs['id'] = data.id
- end
- attrs
- end
-
- def encode_attr_value(generator, ns, qname, value)
- if value.is_a?(SOAPType)
- ref = SOAPReference.new(value)
- generator.add_reftarget(qname.name, value)
- ref.refidstr
- else
- value.to_s
- end
- end
-
- def decode_tag_by_wsdl(ns, elename, typestr, parent, arytypestr, extraattr)
- o = nil
- if parent.class == SOAPBody
- # root element: should branch by root attribute?
- if @is_first_top_ele
- # Unqualified name is allowed here.
- @is_first_top_ele = false
- type = @decode_typemap[elename] ||
- @decode_typemap.find_name(elename.name)
- if type
- o = SOAPStruct.new(elename)
- o.definedtype = type
- return o
- end
- end
- # multi-ref element.
- if typestr
- typename = ns.parse(typestr)
- typedef = @decode_typemap[typename]
- if typedef
- return decode_definedtype(elename, typename, typedef, arytypestr)
- end
- end
- return decode_tag_by_type(ns, elename, typestr, parent, arytypestr,
- extraattr)
- end
-
- if parent.type == XSD::AnyTypeName
- return decode_tag_by_type(ns, elename, typestr, parent, arytypestr,
- extraattr)
- end
-
- # parent.definedtype == nil means the parent is SOAPUnknown. SOAPUnknown
- # is generated by decode_tag_by_type when its type is anyType.
- parenttype = parent.definedtype || @decode_typemap[parent.type]
- unless parenttype
- return decode_tag_by_type(ns, elename, typestr, parent, arytypestr,
- extraattr)
- end
-
- definedtype_name = parenttype.child_type(elename)
- if definedtype_name and (klass = TypeMap[definedtype_name])
- return decode_basetype(klass, elename)
- elsif definedtype_name == XSD::AnyTypeName
- return decode_tag_by_type(ns, elename, typestr, parent, arytypestr,
- extraattr)
- end
-
- if definedtype_name
- typedef = @decode_typemap[definedtype_name]
- else
- typedef = parenttype.child_defined_complextype(elename)
- end
- decode_definedtype(elename, definedtype_name, typedef, arytypestr)
- end
-
- def decode_definedtype(elename, typename, typedef, arytypestr)
- unless typedef
- raise EncodingStyleError.new("unknown type '#{typename}'")
- end
- if typedef.is_a?(::WSDL::XMLSchema::SimpleType)
- decode_defined_simpletype(elename, typename, typedef, arytypestr)
- else
- decode_defined_complextype(elename, typename, typedef, arytypestr)
- end
- end
-
- def decode_basetype(klass, elename)
- klass.decode(elename)
- end
-
- def decode_defined_simpletype(elename, typename, typedef, arytypestr)
- o = decode_basetype(TypeMap[typedef.base], elename)
- o.definedtype = typedef
- o
- end
-
- def decode_defined_complextype(elename, typename, typedef, arytypestr)
- case typedef.compoundtype
- when :TYPE_STRUCT, :TYPE_MAP
- o = SOAPStruct.decode(elename, typename)
- o.definedtype = typedef
- return o
- when :TYPE_ARRAY
- expected_arytype = typedef.find_arytype
- if arytypestr
- actual_arytype = XSD::QName.new(expected_arytype.namespace,
- content_typename(expected_arytype.name) <<
- content_ranksize(arytypestr))
- o = SOAPArray.decode(elename, typename, actual_arytype)
- else
- o = SOAPArray.new(typename, 1, expected_arytype)
- o.elename = elename
- end
- o.definedtype = typedef
- return o
- when :TYPE_EMPTY
- o = SOAPNil.decode(elename)
- o.definedtype = typedef
- return o
- else
- raise RuntimeError.new(
- "Unknown kind of complexType: #{typedef.compoundtype}")
- end
- nil
- end
-
- def decode_tag_by_type(ns, elename, typestr, parent, arytypestr, extraattr)
- if arytypestr
- type = typestr ? ns.parse(typestr) : ValueArrayName
- node = SOAPArray.decode(elename, type, ns.parse(arytypestr))
- node.extraattr.update(extraattr)
- return node
- end
-
- type = nil
- if typestr
- type = ns.parse(typestr)
- elsif parent.is_a?(SOAPArray)
- type = parent.arytype
- else
- # Since it's in dynamic(without any type) encoding process,
- # assumes entity as its type itself.
- # <SOAP-ENC:Array ...> => type Array in SOAP-ENC.
- # <Country xmlns="foo"> => type Country in foo.
- type = elename
- end
-
- if (klass = TypeMap[type])
- node = decode_basetype(klass, elename)
- node.extraattr.update(extraattr)
- return node
- end
-
- # Unknown type... Struct or String
- SOAPUnknown.new(self, elename, type, extraattr)
- end
-
- def decode_textbuf(node)
- case node
- when XSD::XSDHexBinary, XSD::XSDBase64Binary
- node.set_encoded(@textbuf)
- when XSD::XSDString
- if @charset
- @textbuf = XSD::Charset.encoding_from_xml(@textbuf, @charset)
- end
- if node.definedtype
- node.definedtype.check_lexical_format(@textbuf)
- end
- node.set(@textbuf)
- when SOAPNil
- # Nothing to do.
- when SOAPBasetype
- node.set(@textbuf)
- else
- # Nothing to do...
- end
- @textbuf = ''
- end
-
- NilLiteralMap = {
- 'true' => true,
- '1' => true,
- 'false' => false,
- '0' => false
- }
- RootLiteralMap = {
- '1' => 1,
- '0' => 0
- }
- def decode_attrs(ns, attrs)
- is_nil = false
- type = nil
- arytype = nil
- root = nil
- offset = nil
- position = nil
- href = nil
- id = nil
- extraattr = {}
-
- attrs.each do |key, value|
- qname = ns.parse(key)
- case qname.namespace
- when XSD::InstanceNamespace
- case qname.name
- when XSD::NilLiteral
- is_nil = NilLiteralMap[value] or
- raise EncodingStyleError.new("cannot accept attribute value: #{value} as the value of xsi:#{XSD::NilLiteral} (expected 'true', 'false', '1', or '0')")
- next
- when XSD::AttrType
- type = value
- next
- end
- when EncodingNamespace
- case qname.name
- when AttrArrayType
- arytype = value
- next
- when AttrRoot
- root = RootLiteralMap[value] or
- raise EncodingStyleError.new(
- "illegal root attribute value: #{value}")
- next
- when AttrOffset
- offset = value
- next
- when AttrPosition
- position = value
- next
- end
- end
- if key == 'href'
- href = value
- next
- elsif key == 'id'
- id = value
- next
- end
- qname = ns.parse_local(key)
- extraattr[qname] = decode_attr_value(ns, qname, value)
- end
-
- return is_nil, type, arytype, root, offset, position, href, id, extraattr
- end
-
- def decode_attr_value(ns, qname, value)
- if /\A#/ =~ value
- o = SOAPReference.decode(nil, value)
- @refpool << o
- o
- else
- value
- end
- end
-
- def decode_arypos(position)
- /^\[(.+)\]$/ =~ position
- $1.split(',').collect { |s| s.to_i }
- end
-
- def decode_resolve_id
- count = @refpool.length # To avoid infinite loop
- while !@refpool.empty? && count > 0
- @refpool = @refpool.find_all { |ref|
- o = @idpool.find { |item|
- item.id == ref.refid
- }
- if o.is_a?(SOAPReference)
- true # link of link.
- elsif o
- ref.__setobj__(o)
- false
- elsif o = ref.rootnode.external_content[ref.refid]
- ref.__setobj__(o)
- false
- else
- raise EncodingStyleError.new("unresolved reference: #{ref.refid}")
- end
- }
- count -= 1
- end
- end
-end
-
-SOAPHandler.new
-
-
-end
-end
diff --git a/lib/soap/generator.rb b/lib/soap/generator.rb
deleted file mode 100644
index d0c07b058a..0000000000
--- a/lib/soap/generator.rb
+++ /dev/null
@@ -1,274 +0,0 @@
-# SOAP4R - SOAP XML Instance Generator library.
-# Copyright (C) 2001, 2003, 2005 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/ns'
-require 'soap/soap'
-require 'soap/baseData'
-require 'soap/encodingstyle/handler'
-
-
-module SOAP
-
-
-###
-## CAUTION: MT-unsafe
-#
-class SOAPGenerator
- include SOAP
-
- class FormatEncodeError < Error; end
-
-public
-
- attr_accessor :charset
- attr_accessor :default_encodingstyle
- attr_accessor :generate_explicit_type
- attr_accessor :use_numeric_character_reference
-
- def initialize(opt = {})
- @reftarget = nil
- @handlers = {}
- @charset = opt[:charset] || XSD::Charset.xml_encoding_label
- @default_encodingstyle = opt[:default_encodingstyle] || EncodingNamespace
- @generate_explicit_type =
- opt.key?(:generate_explicit_type) ? opt[:generate_explicit_type] : true
- @elementformdefault = opt[:elementformdefault]
- @attributeformdefault = opt[:attributeformdefault]
- @use_numeric_character_reference = opt[:use_numeric_character_reference]
- @indentstr = opt[:no_indent] ? '' : ' '
- @buf = @indent = @curr = nil
- end
-
- def generate(obj, io = nil)
- @buf = io || ''
- @indent = ''
-
- prologue
- @handlers.each do |uri, handler|
- handler.encode_prologue
- end
-
- ns = XSD::NS.new
- @buf << xmldecl
- encode_data(ns, obj, nil)
-
- @handlers.each do |uri, handler|
- handler.encode_epilogue
- end
- epilogue
-
- @buf
- end
-
- def encode_data(ns, obj, parent)
- if obj.is_a?(SOAPEnvelopeElement)
- encode_element(ns, obj, parent)
- return
- end
- if @reftarget && !obj.precedents.empty?
- add_reftarget(obj.elename.name, obj)
- ref = SOAPReference.new(obj)
- ref.elename = ref.elename.dup_name(obj.elename.name)
- obj.precedents.clear # Avoid cyclic delay.
- obj.encodingstyle = parent.encodingstyle
- # SOAPReference is encoded here.
- obj = ref
- end
- encodingstyle = obj.encodingstyle
- # Children's encodingstyle is derived from its parent.
- encodingstyle ||= parent.encodingstyle if parent
- obj.encodingstyle = encodingstyle
- handler = find_handler(encodingstyle || @default_encodingstyle)
- unless handler
- raise FormatEncodeError.new("Unknown encodingStyle: #{ encodingstyle }.")
- end
- if !obj.elename.name
- raise FormatEncodeError.new("Element name not defined: #{ obj }.")
- end
- handler.encode_data(self, ns, obj, parent)
- handler.encode_data_end(self, ns, obj, parent)
- end
-
- def add_reftarget(name, node)
- unless @reftarget
- raise FormatEncodeError.new("Reftarget is not defined.")
- end
- @reftarget.add(name, node)
- end
-
- def encode_child(ns, child, parent)
- indent_backup, @indent = @indent, @indent + @indentstr
- encode_data(ns.clone_ns, child, parent)
- @indent = indent_backup
- end
-
- def encode_element(ns, obj, parent)
- attrs = {}
- if obj.is_a?(SOAPBody)
- @reftarget = obj
- obj.encode(self, ns, attrs) do |child|
- indent_backup, @indent = @indent, @indent + @indentstr
- encode_data(ns.clone_ns, child, obj)
- @indent = indent_backup
- end
- @reftarget = nil
- else
- if obj.is_a?(SOAPEnvelope)
- # xsi:nil="true" can appear even if dumping without explicit type.
- SOAPGenerator.assign_ns(attrs, ns,
- XSD::InstanceNamespace, XSINamespaceTag)
- if @generate_explicit_type
- SOAPGenerator.assign_ns(attrs, ns, XSD::Namespace, XSDNamespaceTag)
- end
- end
- obj.encode(self, ns, attrs) do |child|
- indent_backup, @indent = @indent, @indent + @indentstr
- encode_data(ns.clone_ns, child, obj)
- @indent = indent_backup
- end
- end
- end
-
- def encode_name(ns, data, attrs)
- if element_local?(data)
- data.elename.name
- else
- if element_qualified?(data)
- SOAPGenerator.assign_ns(attrs, ns, data.elename.namespace, '')
- else
- SOAPGenerator.assign_ns(attrs, ns, data.elename.namespace)
- end
- ns.name(data.elename)
- end
- end
-
- def encode_name_end(ns, data)
- if element_local?(data)
- data.elename.name
- else
- ns.name(data.elename)
- end
- end
-
- def encode_tag(elename, attrs = nil)
- if attrs.nil? or attrs.empty?
- @buf << "\n#{ @indent }<#{ elename }>"
- return
- end
- ary = []
- attrs.each do |key, value|
- ary << %Q[#{ key }="#{ value }"] unless value.nil?
- end
- case ary.size
- when 0
- @buf << "\n#{ @indent }<#{ elename }>"
- when 1
- @buf << %Q[\n#{ @indent }<#{ elename } #{ ary[0] }>]
- else
- @buf << "\n#{ @indent }<#{ elename } " <<
- ary.join("\n#{ @indent }#{ @indentstr * 2 }") <<
- '>'
- end
- end
-
- def encode_tag_end(elename, cr = nil)
- if cr
- @buf << "\n#{ @indent }</#{ elename }>"
- else
- @buf << "</#{ elename }>"
- end
- end
-
- def encode_rawstring(str)
- @buf << str
- end
-
- EncodeMap = {
- '&' => '&amp;',
- '<' => '&lt;',
- '>' => '&gt;',
- '"' => '&quot;',
- '\'' => '&apos;',
- "\r" => '&#xd;'
- }
- EncodeCharRegexp = Regexp.new("[#{EncodeMap.keys.join}]")
- def encode_string(str)
- if @use_numeric_character_reference and !XSD::Charset.is_us_ascii(str)
- str.gsub!(EncodeCharRegexp) { |c| EncodeMap[c] }
- @buf << str.unpack("U*").collect { |c|
- if c == 0x9 or c == 0xa or c == 0xd or (c >= 0x20 and c <= 0x7f)
- c.chr
- else
- sprintf("&#x%x;", c)
- end
- }.join
- else
- @buf << str.gsub(EncodeCharRegexp) { |c| EncodeMap[c] }
- end
- end
-
- def element_local?(element)
- element.elename.namespace.nil?
- end
-
- def element_qualified?(element)
- if element.respond_to?(:qualified)
- if element.qualified.nil?
- @elementformdefault
- else
- element.qualified
- end
- else
- @elementformdefault
- end
- end
-
- def self.assign_ns(attrs, ns, namespace, tag = nil)
- if namespace.nil?
- raise FormatEncodeError.new("empty namespace")
- end
- unless ns.assigned?(namespace)
- tag = ns.assign(namespace, tag)
- if tag == ''
- attr = 'xmlns'
- else
- attr = "xmlns:#{tag}"
- end
- attrs[attr] = namespace
- end
- end
-
-private
-
- def prologue
- end
-
- def epilogue
- end
-
- def find_handler(encodingstyle)
- unless @handlers.key?(encodingstyle)
- handler = SOAP::EncodingStyle::Handler.handler(encodingstyle).new(@charset)
- handler.generate_explicit_type = @generate_explicit_type
- handler.encode_prologue
- @handlers[encodingstyle] = handler
- end
- @handlers[encodingstyle]
- end
-
- def xmldecl
- if @charset
- %Q[<?xml version="1.0" encoding="#{ @charset }" ?>]
- else
- %Q[<?xml version="1.0" ?>]
- end
- end
-end
-
-
-end
diff --git a/lib/soap/header/handler.rb b/lib/soap/header/handler.rb
deleted file mode 100644
index 7da2836e24..0000000000
--- a/lib/soap/header/handler.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-# SOAP4R - SOAP Header handler item
-# Copyright (C) 2003, 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 'soap/element'
-
-
-module SOAP
-module Header
-
-
-class Handler
- attr_reader :elename
- attr_reader :mustunderstand
- attr_reader :encodingstyle
-
- def initialize(elename)
- @elename = elename
- @mustunderstand = false
- @encodingstyle = nil
- end
-
- # Should return a SOAP/OM, a SOAPHeaderItem or nil.
- def on_outbound
- nil
- end
-
- # Given header is a SOAPHeaderItem or nil.
- def on_inbound(header, mustunderstand = false)
- # do something.
- end
-
- def on_outbound_headeritem
- item = on_outbound
- if item.nil?
- nil
- elsif item.is_a?(::SOAP::SOAPHeaderItem)
- item.elename = @elename
- item
- else
- item.elename = @elename
- ::SOAP::SOAPHeaderItem.new(item, @mustunderstand, @encodingstyle)
- end
- end
-
- def on_inbound_headeritem(header)
- on_inbound(header.element, header.mustunderstand)
- end
-end
-
-
-end
-end
diff --git a/lib/soap/header/handlerset.rb b/lib/soap/header/handlerset.rb
deleted file mode 100644
index a8eee03023..0000000000
--- a/lib/soap/header/handlerset.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-# SOAP4R - SOAP Header handler set
-# Copyright (C) 2003, 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 'xsd/namedelements'
-
-
-module SOAP
-module Header
-
-
-class HandlerSet
- def initialize
- @store = XSD::NamedElements.new
- end
-
- def dup
- obj = HandlerSet.new
- obj.store = @store.dup
- obj
- end
-
- def add(handler)
- @store << handler
- end
- alias << add
-
- def delete(handler)
- @store.delete(handler)
- end
-
- def include?(handler)
- @store.include?(handler)
- end
-
- # returns: Array of SOAPHeaderItem
- def on_outbound
- @store.collect { |handler|
- handler.on_outbound_headeritem
- }.compact
- end
-
- # headers: SOAPHeaderItem enumerable object
- def on_inbound(headers)
- headers.each do |name, item|
- handler = @store.find { |handler|
- handler.elename == item.element.elename
- }
- if handler
- handler.on_inbound_headeritem(item)
- elsif item.mustunderstand
- raise UnhandledMustUnderstandHeaderError.new(item.element.elename.to_s)
- end
- end
- end
-
-protected
-
- def store=(store)
- @store = store
- end
-end
-
-
-end
-end
diff --git a/lib/soap/header/simplehandler.rb b/lib/soap/header/simplehandler.rb
deleted file mode 100644
index 7b206f77db..0000000000
--- a/lib/soap/header/simplehandler.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# SOAP4R - SOAP Simple header item handler
-# Copyright (C) 2003-2005 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 'soap/header/handler'
-require 'soap/baseData'
-
-
-module SOAP
-module Header
-
-
-class SimpleHandler < SOAP::Header::Handler
- def initialize(elename)
- super(elename)
- end
-
- # Should return a Hash, String or nil.
- def on_simple_outbound
- nil
- end
-
- # Given header is a Hash, String or nil.
- def on_simple_inbound(header, mustunderstand)
- end
-
- def on_outbound
- h = on_simple_outbound
- h ? SOAPElement.from_obj(h, elename.namespace) : nil
- end
-
- def on_inbound(header, mustunderstand)
- h = header.respond_to?(:to_obj) ? header.to_obj : header.data
- on_simple_inbound(h, mustunderstand)
- end
-end
-
-
-end
-end
diff --git a/lib/soap/httpconfigloader.rb b/lib/soap/httpconfigloader.rb
deleted file mode 100644
index cd7bca8a65..0000000000
--- a/lib/soap/httpconfigloader.rb
+++ /dev/null
@@ -1,119 +0,0 @@
-# SOAP4R - HTTP config loader.
-# Copyright (C) 2005 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 'soap/property'
-
-
-module SOAP
-
-
-module HTTPConfigLoader
-module_function
-
- def set_options(client, options)
- client.proxy = options["proxy"]
- options.add_hook("proxy") do |key, value|
- client.proxy = value
- end
- client.no_proxy = options["no_proxy"]
- options.add_hook("no_proxy") do |key, value|
- client.no_proxy = value
- end
- if client.respond_to?(:protocol_version=)
- client.protocol_version = options["protocol_version"]
- options.add_hook("protocol_version") do |key, value|
- client.protocol_version = value
- end
- end
- ssl_config = options["ssl_config"] ||= ::SOAP::Property.new
- set_ssl_config(client, ssl_config)
- ssl_config.add_hook(true) do |key, value|
- set_ssl_config(client, ssl_config)
- end
- basic_auth = options["basic_auth"] ||= ::SOAP::Property.new
- set_basic_auth(client, basic_auth)
- basic_auth.add_hook do |key, value|
- set_basic_auth(client, basic_auth)
- end
- options.add_hook("connect_timeout") do |key, value|
- client.connect_timeout = value
- end
- options.add_hook("send_timeout") do |key, value|
- client.send_timeout = value
- end
- options.add_hook("receive_timeout") do |key, value|
- client.receive_timeout = value
- end
- end
-
- def set_basic_auth(client, basic_auth)
- basic_auth.values.each do |url, userid, passwd|
- client.set_basic_auth(url, userid, passwd)
- end
- end
-
- def set_ssl_config(client, ssl_config)
- ssl_config.each do |key, value|
- cfg = client.ssl_config
- if cfg.nil?
- raise NotImplementedError.new("SSL not supported")
- end
- case key
- when 'client_cert'
- cfg.client_cert = cert_from_file(value)
- when 'client_key'
- cfg.client_key = key_from_file(value)
- when 'client_ca'
- cfg.client_ca = value
- when 'ca_path'
- cfg.set_trust_ca(value)
- when 'ca_file'
- cfg.set_trust_ca(value)
- when 'crl'
- cfg.set_crl(value)
- when 'verify_mode'
- cfg.verify_mode = ssl_config_int(value)
- when 'verify_depth'
- cfg.verify_depth = ssl_config_int(value)
- when 'options'
- cfg.options = value
- when 'ciphers'
- cfg.ciphers = value
- when 'verify_callback'
- cfg.verify_callback = value
- when 'cert_store'
- cfg.cert_store = value
- else
- raise ArgumentError.new("unknown ssl_config property #{key}")
- end
- end
- end
-
- def ssl_config_int(value)
- if value.nil? or value.to_s.empty?
- nil
- else
- begin
- Integer(value)
- rescue ArgumentError
- ::SOAP::Property::Util.const_from_name(value.to_s)
- end
- end
- end
-
- def cert_from_file(filename)
- OpenSSL::X509::Certificate.new(File.open(filename) { |f| f.read })
- end
-
- def key_from_file(filename)
- OpenSSL::PKey::RSA.new(File.open(filename) { |f| f.read })
- end
-end
-
-
-end
diff --git a/lib/soap/mapping.rb b/lib/soap/mapping.rb
deleted file mode 100644
index b83f8b484a..0000000000
--- a/lib/soap/mapping.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# SOAP4R - Ruby type mapping utility.
-# 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 'soap/mapping/mapping'
-require 'soap/mapping/registry'
diff --git a/lib/soap/mapping/factory.rb b/lib/soap/mapping/factory.rb
deleted file mode 100644
index a237f330d2..0000000000
--- a/lib/soap/mapping/factory.rb
+++ /dev/null
@@ -1,355 +0,0 @@
-# SOAP4R - Mapping factory.
-# Copyright (C) 2000, 2001, 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 SOAP
-module Mapping
-
-
-class Factory
- include TraverseSupport
-
- def initialize
- # nothing to do
- end
-
- def obj2soap(soap_class, obj, info, map)
- raise NotImplementError.new
- # return soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- raise NotImplementError.new
- # return convert_succeeded_or_not, obj
- end
-
- def setiv2obj(obj, node, map)
- return if node.nil?
- if obj.is_a?(Array)
- setiv2ary(obj, node, map)
- else
- setiv2struct(obj, node, map)
- end
- end
-
- def setiv2soap(node, obj, map)
- if obj.class.class_variables.include?('@@schema_element')
- obj.class.class_eval('@@schema_element').each do |name, info|
- type, qname = info
- if qname
- elename = qname.name
- else
- elename = Mapping.name2elename(name)
- end
- node.add(elename,
- Mapping._obj2soap(obj.instance_variable_get('@' + name), map))
- end
- else
- # should we sort instance_variables?
- obj.instance_variables.each do |var|
- name = var.to_s.sub(/^@/, '')
- elename = Mapping.name2elename(name)
- node.add(elename,
- Mapping._obj2soap(obj.instance_variable_get(var), map))
- end
- end
- end
-
-private
-
- def setiv2ary(obj, node, map)
- node.each do |name, value|
- Array.instance_method(:<<).bind(obj).call(Mapping._soap2obj(value, map))
- end
- end
-
- def setiv2struct(obj, node, map)
- vars = {}
- node.each do |name, value|
- vars[Mapping.elename2name(name)] = Mapping._soap2obj(value, map)
- end
- Mapping.set_attributes(obj, vars)
- end
-end
-
-class StringFactory_ < Factory
- def initialize(allow_original_mapping = false)
- super()
- @allow_original_mapping = allow_original_mapping
- end
-
- def obj2soap(soap_class, obj, info, map)
- if !@allow_original_mapping and !obj.instance_variables.empty?
- return nil
- end
- begin
- unless XSD::Charset.is_ces(obj, Thread.current[:SOAPExternalCES])
- return nil
- end
- encoded = XSD::Charset.encoding_conv(obj,
- Thread.current[:SOAPExternalCES], XSD::Charset.encoding)
- soap_obj = soap_class.new(encoded)
- rescue XSD::ValueSpaceError
- return nil
- end
- mark_marshalled_obj(obj, soap_obj)
- soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- obj = Mapping.create_empty_object(obj_class)
- decoded = XSD::Charset.encoding_conv(node.data, XSD::Charset.encoding,
- Thread.current[:SOAPExternalCES])
- obj.replace(decoded)
- mark_unmarshalled_obj(node, obj)
- return true, obj
- end
-end
-
-class BasetypeFactory_ < Factory
- def initialize(allow_original_mapping = false)
- super()
- @allow_original_mapping = allow_original_mapping
- end
-
- def obj2soap(soap_class, obj, info, map)
- if !@allow_original_mapping and !obj.instance_variables.empty?
- return nil
- end
- soap_obj = nil
- begin
- soap_obj = soap_class.new(obj)
- rescue XSD::ValueSpaceError
- return nil
- end
- if @allow_original_mapping
- # Basetype except String should not be multiref-ed in SOAP/1.1.
- mark_marshalled_obj(obj, soap_obj)
- end
- soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- obj = node.data
- mark_unmarshalled_obj(node, obj)
- return true, obj
- end
-end
-
-class DateTimeFactory_ < Factory
- def initialize(allow_original_mapping = false)
- super()
- @allow_original_mapping = allow_original_mapping
- end
-
- def obj2soap(soap_class, obj, info, map)
- if !@allow_original_mapping and
- Time === obj and !obj.instance_variables.empty?
- return nil
- end
- soap_obj = nil
- begin
- soap_obj = soap_class.new(obj)
- rescue XSD::ValueSpaceError
- return nil
- end
- mark_marshalled_obj(obj, soap_obj)
- soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- if node.respond_to?(:to_obj)
- obj = node.to_obj(obj_class)
- return false if obj.nil?
- mark_unmarshalled_obj(node, obj)
- return true, obj
- else
- return false
- end
- end
-end
-
-class Base64Factory_ < Factory
- def obj2soap(soap_class, obj, info, map)
- return nil unless obj.instance_variables.empty?
- soap_obj = soap_class.new(obj)
- mark_marshalled_obj(obj, soap_obj) if soap_obj
- soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- obj = node.string
- mark_unmarshalled_obj(node, obj)
- return true, obj
- end
-end
-
-class URIFactory_ < Factory
- def obj2soap(soap_class, obj, info, map)
- soap_obj = soap_class.new(obj)
- mark_marshalled_obj(obj, soap_obj) if soap_obj
- soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- obj = node.data
- mark_unmarshalled_obj(node, obj)
- return true, obj
- end
-end
-
-class ArrayFactory_ < Factory
- def initialize(allow_original_mapping = false)
- super()
- @allow_original_mapping = allow_original_mapping
- end
-
- # [[1], [2]] is converted to Array of Array, not 2-D Array.
- # To create M-D Array, you must call Mapping.ary2md.
- def obj2soap(soap_class, obj, info, map)
- if !@allow_original_mapping and !obj.instance_variables.empty?
- return nil
- end
- arytype = Mapping.obj2element(obj)
- if arytype.name
- arytype.namespace ||= RubyTypeNamespace
- else
- arytype = XSD::AnyTypeName
- end
- soap_obj = SOAPArray.new(ValueArrayName, 1, arytype)
- mark_marshalled_obj(obj, soap_obj)
- obj.each do |item|
- soap_obj.add(Mapping._obj2soap(item, map))
- end
- soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- obj = Mapping.create_empty_object(obj_class)
- mark_unmarshalled_obj(node, obj)
- node.soap2array(obj) do |elem|
- elem ? Mapping._soap2obj(elem, map) : nil
- end
- return true, obj
- end
-end
-
-class TypedArrayFactory_ < Factory
- def initialize(allow_original_mapping = false)
- super()
- @allow_original_mapping = allow_original_mapping
- end
-
- def obj2soap(soap_class, obj, info, map)
- if !@allow_original_mapping and !obj.instance_variables.empty?
- return nil
- end
- arytype = info[:type] || info[0]
- soap_obj = SOAPArray.new(ValueArrayName, 1, arytype)
- mark_marshalled_obj(obj, soap_obj)
- obj.each do |var|
- soap_obj.add(Mapping._obj2soap(var, map))
- end
- soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- if node.rank > 1
- return false
- end
- arytype = info[:type] || info[0]
- unless node.arytype == arytype
- return false
- end
- obj = Mapping.create_empty_object(obj_class)
- mark_unmarshalled_obj(node, obj)
- node.soap2array(obj) do |elem|
- elem ? Mapping._soap2obj(elem, map) : nil
- end
- return true, obj
- end
-end
-
-class TypedStructFactory_ < Factory
- def obj2soap(soap_class, obj, info, map)
- type = info[:type] || info[0]
- soap_obj = soap_class.new(type)
- mark_marshalled_obj(obj, soap_obj)
- if obj.class <= SOAP::Marshallable
- setiv2soap(soap_obj, obj, map)
- else
- setiv2soap(soap_obj, obj, map)
- end
- soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- type = info[:type] || info[0]
- unless node.type == type
- return false
- end
- obj = Mapping.create_empty_object(obj_class)
- mark_unmarshalled_obj(node, obj)
- setiv2obj(obj, node, map)
- return true, obj
- end
-end
-
-MapQName = XSD::QName.new(ApacheSOAPTypeNamespace, 'Map')
-class HashFactory_ < Factory
- def initialize(allow_original_mapping = false)
- super()
- @allow_original_mapping = allow_original_mapping
- end
-
- def obj2soap(soap_class, obj, info, map)
- if !@allow_original_mapping and !obj.instance_variables.empty?
- return nil
- end
- if !obj.default.nil? or
- (obj.respond_to?(:default_proc) and obj.default_proc)
- return nil
- end
- soap_obj = SOAPStruct.new(MapQName)
- mark_marshalled_obj(obj, soap_obj)
- obj.each do |key, value|
- elem = SOAPStruct.new
- elem.add("key", Mapping._obj2soap(key, map))
- elem.add("value", Mapping._obj2soap(value, map))
- # ApacheAxis allows only 'item' here.
- soap_obj.add("item", elem)
- end
- soap_obj
- end
-
- def soap2obj(obj_class, node, info, map)
- unless node.type == MapQName
- return false
- end
- if node.class == SOAPStruct and node.key?('default')
- return false
- end
- obj = Mapping.create_empty_object(obj_class)
- mark_unmarshalled_obj(node, obj)
- if node.class == SOAPStruct
- node.each do |key, value|
- obj[Mapping._soap2obj(value['key'], map)] =
- Mapping._soap2obj(value['value'], map)
- end
- else
- node.each do |value|
- obj[Mapping._soap2obj(value['key'], map)] =
- Mapping._soap2obj(value['value'], map)
- end
- end
- return true, obj
- end
-end
-
-
-end
-end
diff --git a/lib/soap/mapping/mapping.rb b/lib/soap/mapping/mapping.rb
deleted file mode 100644
index 2b68601205..0000000000
--- a/lib/soap/mapping/mapping.rb
+++ /dev/null
@@ -1,381 +0,0 @@
-# SOAP4R - Ruby type mapping utility.
-# Copyright (C) 2000, 2001, 2003-2005 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/codegen/gensupport'
-
-
-module SOAP
-
-
-module Mapping
- RubyTypeNamespace = 'http://www.ruby-lang.org/xmlns/ruby/type/1.6'
- RubyTypeInstanceNamespace =
- 'http://www.ruby-lang.org/xmlns/ruby/type-instance'
- RubyCustomTypeNamespace = 'http://www.ruby-lang.org/xmlns/ruby/type/custom'
- ApacheSOAPTypeNamespace = 'http://xml.apache.org/xml-soap'
-
-
- # TraverseSupport breaks following thread variables.
- # Thread.current[:SOAPMarshalDataKey]
- module TraverseSupport
- def mark_marshalled_obj(obj, soap_obj)
- raise if obj.nil?
- Thread.current[:SOAPMarshalDataKey][obj.__id__] = soap_obj
- end
-
- def mark_unmarshalled_obj(node, obj)
- return if obj.nil?
- # node.id is not Object#id but SOAPReference#id
- Thread.current[:SOAPMarshalDataKey][node.id] = obj
- end
- end
-
-
- EMPTY_OPT = {}
- def self.obj2soap(obj, registry = nil, type = nil, opt = EMPTY_OPT)
- registry ||= Mapping::DefaultRegistry
- soap_obj = nil
- protect_threadvars(:SOAPMarshalDataKey, :SOAPExternalCES, :SOAPMarshalNoReference) do
- Thread.current[:SOAPMarshalDataKey] = {}
- Thread.current[:SOAPExternalCES] = opt[:external_ces] || $KCODE
- Thread.current[:SOAPMarshalNoReference] = opt[:no_reference]
- soap_obj = _obj2soap(obj, registry, type)
- end
- soap_obj
- end
-
- def self.soap2obj(node, registry = nil, klass = nil, opt = EMPTY_OPT)
- registry ||= Mapping::DefaultRegistry
- obj = nil
- protect_threadvars(:SOAPMarshalDataKey, :SOAPExternalCES, :SOAPMarshalNoReference) do
- Thread.current[:SOAPMarshalDataKey] = {}
- Thread.current[:SOAPExternalCES] = opt[:external_ces] || $KCODE
- Thread.current[:SOAPMarshalNoReference] = opt[:no_reference]
- obj = _soap2obj(node, registry, klass)
- end
- obj
- end
-
- def self.ary2soap(ary, type_ns = XSD::Namespace, typename = XSD::AnyTypeLiteral, registry = nil, opt = EMPTY_OPT)
- registry ||= Mapping::DefaultRegistry
- type = XSD::QName.new(type_ns, typename)
- soap_ary = SOAPArray.new(ValueArrayName, 1, type)
- protect_threadvars(:SOAPMarshalDataKey, :SOAPExternalCES, :SOAPMarshalNoReference) do
- Thread.current[:SOAPMarshalDataKey] = {}
- Thread.current[:SOAPExternalCES] = opt[:external_ces] || $KCODE
- Thread.current[:SOAPMarshalNoReference] = opt[:no_reference]
- ary.each do |ele|
- soap_ary.add(_obj2soap(ele, registry, type))
- end
- end
- soap_ary
- end
-
- def self.ary2md(ary, rank, type_ns = XSD::Namespace, typename = XSD::AnyTypeLiteral, registry = nil, opt = EMPTY_OPT)
- registry ||= Mapping::DefaultRegistry
- type = XSD::QName.new(type_ns, typename)
- md_ary = SOAPArray.new(ValueArrayName, rank, type)
- protect_threadvars(:SOAPMarshalDataKey, :SOAPExternalCES, :SOAPMarshalNoReference) do
- Thread.current[:SOAPMarshalDataKey] = {}
- Thread.current[:SOAPExternalCES] = opt[:external_ces] || $KCODE
- Thread.current[:SOAPMarshalNoReference] = opt[:no_reference]
- add_md_ary(md_ary, ary, [], registry)
- end
- md_ary
- end
-
- def self.fault2exception(fault, registry = nil)
- registry ||= Mapping::DefaultRegistry
- detail = if fault.detail
- soap2obj(fault.detail, registry) || ""
- else
- ""
- end
- if detail.is_a?(Mapping::SOAPException)
- begin
- e = detail.to_e
- remote_backtrace = e.backtrace
- e.set_backtrace(nil)
- raise e # ruby sets current caller as local backtrace of e => e2.
- rescue Exception => e
- e.set_backtrace(remote_backtrace + e.backtrace[1..-1])
- raise
- end
- else
- fault.detail = detail
- fault.set_backtrace(
- if detail.is_a?(Array)
- detail
- else
- [detail.to_s]
- end
- )
- raise
- end
- end
-
- def self._obj2soap(obj, registry, type = nil)
- if referent = Thread.current[:SOAPMarshalDataKey][obj.__id__] and
- !Thread.current[:SOAPMarshalNoReference]
- SOAPReference.new(referent)
- elsif registry
- registry.obj2soap(obj, type)
- else
- raise MappingError.new("no mapping registry given")
- end
- end
-
- def self._soap2obj(node, registry, klass = nil)
- if node.nil?
- return nil
- elsif node.is_a?(SOAPReference)
- target = node.__getobj__
- # target.id is not Object#id but SOAPReference#id
- if referent = Thread.current[:SOAPMarshalDataKey][target.id] and
- !Thread.current[:SOAPMarshalNoReference]
- return referent
- else
- return _soap2obj(target, registry, klass)
- end
- end
- return registry.soap2obj(node, klass)
- end
-
- if Object.respond_to?(:allocate)
- # ruby/1.7 or later.
- def self.create_empty_object(klass)
- klass.allocate
- end
- else
- MARSHAL_TAG = {
- String => ['"', 1],
- Regexp => ['/', 2],
- Array => ['[', 1],
- Hash => ['{', 1]
- }
- def self.create_empty_object(klass)
- if klass <= Struct
- name = klass.name
- return ::Marshal.load(sprintf("\004\006S:%c%s\000", name.length + 5, name))
- end
- if MARSHAL_TAG.has_key?(klass)
- tag, terminate = MARSHAL_TAG[klass]
- return ::Marshal.load(sprintf("\004\006%s%s", tag, "\000" * terminate))
- end
- MARSHAL_TAG.each do |k, v|
- if klass < k
- name = klass.name
- tag, terminate = v
- return ::Marshal.load(sprintf("\004\006C:%c%s%s%s", name.length + 5, name, tag, "\000" * terminate))
- end
- end
- name = klass.name
- ::Marshal.load(sprintf("\004\006o:%c%s\000", name.length + 5, name))
- end
- end
-
- # Allow only (Letter | '_') (Letter | Digit | '-' | '_')* here.
- # Caution: '.' is not allowed here.
- # To follow XML spec., it should be NCName.
- # (denied chars) => .[0-F][0-F]
- # ex. a.b => a.2eb
- #
- def self.name2elename(name)
- name.to_s.gsub(/([^a-zA-Z0-9:_\-]+)/n) {
- '.' << $1.unpack('H2' * $1.size).join('.')
- }.gsub(/::/n, '..')
- end
-
- def self.elename2name(name)
- name.gsub(/\.\./n, '::').gsub(/((?:\.[0-9a-fA-F]{2})+)/n) {
- [$1.delete('.')].pack('H*')
- }
- end
-
- def self.const_from_name(name, lenient = false)
- const = ::Object
- name.sub(/\A::/, '').split('::').each do |const_str|
- if XSD::CodeGen::GenSupport.safeconstname?(const_str)
- if const.const_defined?(const_str)
- const = const.const_get(const_str)
- next
- end
- elsif lenient
- const_str = XSD::CodeGen::GenSupport.safeconstname(const_str)
- if const.const_defined?(const_str)
- const = const.const_get(const_str)
- next
- end
- end
- return nil
- end
- const
- end
-
- def self.class_from_name(name, lenient = false)
- const = const_from_name(name, lenient)
- if const.is_a?(::Class)
- const
- else
- nil
- end
- end
-
- def self.module_from_name(name, lenient = false)
- const = const_from_name(name, lenient)
- if const.is_a?(::Module)
- const
- else
- nil
- end
- end
-
- def self.class2qname(klass)
- name = schema_type_definition(klass)
- namespace = schema_ns_definition(klass)
- XSD::QName.new(namespace, name)
- end
-
- def self.class2element(klass)
- type = Mapping.class2qname(klass)
- type.name ||= Mapping.name2elename(klass.name)
- type.namespace ||= RubyCustomTypeNamespace
- type
- end
-
- def self.obj2element(obj)
- name = namespace = nil
- ivars = obj.instance_variables
- if ivars.include?('@schema_type')
- name = obj.instance_variable_get('@schema_type')
- end
- if ivars.include?('@schema_ns')
- namespace = obj.instance_variable_get('@schema_ns')
- end
- if !name or !namespace
- class2qname(obj.class)
- else
- XSD::QName.new(namespace, name)
- end
- end
-
- def self.define_singleton_method(obj, name, &block)
- sclass = (class << obj; self; end)
- sclass.class_eval {
- define_method(name, &block)
- }
- end
-
- def self.get_attribute(obj, attr_name)
- if obj.is_a?(::Hash)
- obj[attr_name] || obj[attr_name.intern]
- else
- name = XSD::CodeGen::GenSupport.safevarname(attr_name)
- if obj.instance_variables.include?('@' + name)
- obj.instance_variable_get('@' + name)
- elsif ((obj.is_a?(::Struct) or obj.is_a?(Marshallable)) and
- obj.respond_to?(name))
- obj.__send__(name)
- end
- end
- end
-
- def self.set_attributes(obj, values)
- if obj.is_a?(::SOAP::Mapping::Object)
- values.each do |attr_name, value|
- obj.__add_xmlele_value(attr_name, value)
- end
- else
- values.each do |attr_name, value|
- name = XSD::CodeGen::GenSupport.safevarname(attr_name)
- setter = name + "="
- if obj.respond_to?(setter)
- obj.__send__(setter, value)
- else
- obj.instance_variable_set('@' + name, value)
- begin
- define_attr_accessor(obj, name,
- proc { instance_variable_get('@' + name) },
- proc { |value| instance_variable_set('@' + name, value) })
- rescue TypeError
- # singleton class may not exist (e.g. Float)
- end
- end
- end
- end
- end
-
- def self.define_attr_accessor(obj, name, getterproc, setterproc = nil)
- define_singleton_method(obj, name, &getterproc)
- define_singleton_method(obj, name + '=', &setterproc) if setterproc
- end
-
- def self.schema_type_definition(klass)
- class_schema_variable(:schema_type, klass)
- end
-
- def self.schema_ns_definition(klass)
- class_schema_variable(:schema_ns, klass)
- end
-
- def self.schema_element_definition(klass)
- schema_element = class_schema_variable(:schema_element, klass) or return nil
- schema_ns = schema_ns_definition(klass)
- elements = []
- as_array = []
- schema_element.each do |varname, definition|
- class_name, name = definition
- if /\[\]$/ =~ class_name
- class_name = class_name.sub(/\[\]$/, '')
- as_array << (name ? name.name : varname)
- end
- elements << [name || XSD::QName.new(schema_ns, varname), class_name]
- end
- [elements, as_array]
- end
-
- def self.schema_attribute_definition(klass)
- class_schema_variable(:schema_attribute, klass)
- end
-
- class << Mapping
- private
-
- def class_schema_variable(sym, klass)
- var = "@@#{sym}"
- klass.class_variables.include?(var) ? klass.class_eval(var) : nil
- end
-
- def protect_threadvars(*symbols)
- backup = {}
- begin
- symbols.each do |sym|
- backup[sym] = Thread.current[sym]
- end
- yield
- ensure
- symbols.each do |sym|
- Thread.current[sym] = backup[sym]
- end
- end
- end
-
- def add_md_ary(md_ary, ary, indices, registry)
- for idx in 0..(ary.size - 1)
- if ary[idx].is_a?(Array)
- add_md_ary(md_ary, ary[idx], indices + [idx], registry)
- else
- md_ary[*(indices + [idx])] = _obj2soap(ary[idx], registry)
- end
- end
- end
- end
-end
-
-
-end
diff --git a/lib/soap/mapping/registry.rb b/lib/soap/mapping/registry.rb
deleted file mode 100644
index a4183fea57..0000000000
--- a/lib/soap/mapping/registry.rb
+++ /dev/null
@@ -1,541 +0,0 @@
-# SOAP4R - Mapping registry.
-# Copyright (C) 2000, 2001, 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 'soap/baseData'
-require 'soap/mapping/mapping'
-require 'soap/mapping/typeMap'
-require 'soap/mapping/factory'
-require 'soap/mapping/rubytypeFactory'
-
-
-module SOAP
-
-
-module Marshallable
- # @@type_ns = Mapping::RubyCustomTypeNamespace
-end
-
-
-module Mapping
-
-
-module MappedException; end
-
-
-RubyTypeName = XSD::QName.new(RubyTypeInstanceNamespace, 'rubyType')
-RubyExtendName = XSD::QName.new(RubyTypeInstanceNamespace, 'extends')
-RubyIVarName = XSD::QName.new(RubyTypeInstanceNamespace, 'ivars')
-
-
-# Inner class to pass an exception.
-class SOAPException; include Marshallable
- attr_reader :excn_type_name, :cause
- def initialize(e)
- @excn_type_name = Mapping.name2elename(e.class.to_s)
- @cause = e
- end
-
- def to_e
- if @cause.is_a?(::Exception)
- @cause.extend(::SOAP::Mapping::MappedException)
- return @cause
- elsif @cause.respond_to?(:message) and @cause.respond_to?(:backtrace)
- e = RuntimeError.new(@cause.message)
- e.set_backtrace(@cause.backtrace)
- return e
- end
- klass = Mapping.class_from_name(Mapping.elename2name(@excn_type_name.to_s))
- if klass.nil? or not klass <= ::Exception
- return RuntimeError.new(@cause.inspect)
- end
- obj = klass.new(@cause.message)
- obj.extend(::SOAP::Mapping::MappedException)
- obj
- end
-end
-
-
-# For anyType object: SOAP::Mapping::Object not ::Object
-class Object; include Marshallable
- def initialize
- @__xmlele_type = {}
- @__xmlele = []
- @__xmlattr = {}
- end
-
- def inspect
- sprintf("#<%s:0x%x%s>", self.class.name, __id__,
- @__xmlele.collect { |name, value| " #{name}=#{value.inspect}" }.join)
- end
-
- def __xmlattr
- @__xmlattr
- end
-
- def __xmlele
- @__xmlele
- end
-
- def [](qname)
- unless qname.is_a?(XSD::QName)
- qname = XSD::QName.new(nil, qname)
- end
- @__xmlele.each do |k, v|
- return v if k == qname
- end
- # fallback
- @__xmlele.each do |k, v|
- return v if k.name == qname.name
- end
- nil
- end
-
- def []=(qname, value)
- unless qname.is_a?(XSD::QName)
- qname = XSD::QName.new(nil, qname)
- end
- found = false
- @__xmlele.each do |pair|
- if pair[0] == qname
- found = true
- pair[1] = value
- end
- end
- unless found
- __define_attr_accessor(qname)
- @__xmlele << [qname, value]
- end
- @__xmlele_type[qname] = :single
- end
-
- def __add_xmlele_value(qname, value)
- found = false
- @__xmlele.map! do |k, v|
- if k == qname
- found = true
- [k, __set_xmlele_value(k, v, value)]
- else
- [k, v]
- end
- end
- unless found
- __define_attr_accessor(qname)
- @__xmlele << [qname, value]
- @__xmlele_type[qname] = :single
- end
- value
- end
-
-private
-
- if RUBY_VERSION > "1.7.0"
- def __define_attr_accessor(qname)
- name = XSD::CodeGen::GenSupport.safemethodname(qname.name)
- Mapping.define_attr_accessor(self, name,
- proc { self[qname] },
- proc { |value| self[qname] = value })
- end
- else
- def __define_attr_accessor(qname)
- name = XSD::CodeGen::GenSupport.safemethodname(qname.name)
- instance_eval <<-EOS
- def #{name}
- self[#{qname.dump}]
- end
-
- def #{name}=(value)
- self[#{qname.dump}] = value
- end
- EOS
- end
- end
-
- def __set_xmlele_value(key, org, value)
- case @__xmlele_type[key]
- when :multi
- org << value
- org
- when :single
- @__xmlele_type[key] = :multi
- [org, value]
- else
- raise RuntimeError.new("unknown type")
- end
- end
-end
-
-
-class MappingError < Error; end
-
-
-class Registry
- class Map
- def initialize(registry)
- @obj2soap = {}
- @soap2obj = {}
- @registry = registry
- end
-
- def obj2soap(obj)
- klass = obj.class
- if map = @obj2soap[klass]
- map.each do |soap_class, factory, info|
- ret = factory.obj2soap(soap_class, obj, info, @registry)
- return ret if ret
- end
- end
- ancestors = klass.ancestors
- ancestors.delete(klass)
- ancestors.delete(::Object)
- ancestors.delete(::Kernel)
- ancestors.each do |klass|
- if map = @obj2soap[klass]
- map.each do |soap_class, factory, info|
- if info[:derived_class]
- ret = factory.obj2soap(soap_class, obj, info, @registry)
- return ret if ret
- end
- end
- end
- end
- nil
- end
-
- def soap2obj(node, klass = nil)
- if map = @soap2obj[node.class]
- map.each do |obj_class, factory, info|
- next if klass and obj_class != klass
- conv, obj = factory.soap2obj(obj_class, node, info, @registry)
- return true, obj if conv
- end
- end
- return false, nil
- end
-
- # Give priority to former entry.
- def init(init_map = [])
- clear
- init_map.reverse_each do |obj_class, soap_class, factory, info|
- add(obj_class, soap_class, factory, info)
- end
- end
-
- # Give priority to latter entry.
- def add(obj_class, soap_class, factory, info)
- info ||= {}
- (@obj2soap[obj_class] ||= []).unshift([soap_class, factory, info])
- (@soap2obj[soap_class] ||= []).unshift([obj_class, factory, info])
- end
-
- def clear
- @obj2soap.clear
- @soap2obj.clear
- end
-
- def find_mapped_soap_class(target_obj_class)
- map = @obj2soap[target_obj_class]
- map.empty? ? nil : map[0][1]
- end
-
- def find_mapped_obj_class(target_soap_class)
- map = @soap2obj[target_soap_class]
- map.empty? ? nil : map[0][0]
- end
- end
-
- StringFactory = StringFactory_.new
- BasetypeFactory = BasetypeFactory_.new
- DateTimeFactory = DateTimeFactory_.new
- ArrayFactory = ArrayFactory_.new
- Base64Factory = Base64Factory_.new
- URIFactory = URIFactory_.new
- TypedArrayFactory = TypedArrayFactory_.new
- TypedStructFactory = TypedStructFactory_.new
-
- HashFactory = HashFactory_.new
-
- SOAPBaseMap = [
- [::NilClass, ::SOAP::SOAPNil, BasetypeFactory],
- [::TrueClass, ::SOAP::SOAPBoolean, BasetypeFactory],
- [::FalseClass, ::SOAP::SOAPBoolean, BasetypeFactory],
- [::String, ::SOAP::SOAPString, StringFactory],
- [::DateTime, ::SOAP::SOAPDateTime, DateTimeFactory],
- [::Date, ::SOAP::SOAPDate, DateTimeFactory],
- [::Time, ::SOAP::SOAPDateTime, DateTimeFactory],
- [::Time, ::SOAP::SOAPTime, DateTimeFactory],
- [::Float, ::SOAP::SOAPDouble, BasetypeFactory,
- {:derived_class => true}],
- [::Float, ::SOAP::SOAPFloat, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPInt, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPLong, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPInteger, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPShort, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPByte, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPNonPositiveInteger, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPNegativeInteger, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPNonNegativeInteger, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPPositiveInteger, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPUnsignedLong, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPUnsignedInt, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPUnsignedShort, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPUnsignedByte, BasetypeFactory,
- {:derived_class => true}],
- [::URI::Generic, ::SOAP::SOAPAnyURI, URIFactory,
- {:derived_class => true}],
- [::String, ::SOAP::SOAPBase64, Base64Factory],
- [::String, ::SOAP::SOAPHexBinary, Base64Factory],
- [::String, ::SOAP::SOAPDecimal, BasetypeFactory],
- [::String, ::SOAP::SOAPDuration, BasetypeFactory],
- [::String, ::SOAP::SOAPGYearMonth, BasetypeFactory],
- [::String, ::SOAP::SOAPGYear, BasetypeFactory],
- [::String, ::SOAP::SOAPGMonthDay, BasetypeFactory],
- [::String, ::SOAP::SOAPGDay, BasetypeFactory],
- [::String, ::SOAP::SOAPGMonth, BasetypeFactory],
- [::String, ::SOAP::SOAPQName, BasetypeFactory],
-
- [::Hash, ::SOAP::SOAPArray, HashFactory],
- [::Hash, ::SOAP::SOAPStruct, HashFactory],
-
- [::Array, ::SOAP::SOAPArray, ArrayFactory,
- {:derived_class => true}],
-
- [::SOAP::Mapping::SOAPException,
- ::SOAP::SOAPStruct, TypedStructFactory,
- {:type => XSD::QName.new(RubyCustomTypeNamespace, "SOAPException")}],
- ]
-
- RubyOriginalMap = [
- [::NilClass, ::SOAP::SOAPNil, BasetypeFactory],
- [::TrueClass, ::SOAP::SOAPBoolean, BasetypeFactory],
- [::FalseClass, ::SOAP::SOAPBoolean, BasetypeFactory],
- [::String, ::SOAP::SOAPString, StringFactory],
- [::DateTime, ::SOAP::SOAPDateTime, DateTimeFactory],
- [::Date, ::SOAP::SOAPDate, DateTimeFactory],
- [::Time, ::SOAP::SOAPDateTime, DateTimeFactory],
- [::Time, ::SOAP::SOAPTime, DateTimeFactory],
- [::Float, ::SOAP::SOAPDouble, BasetypeFactory,
- {:derived_class => true}],
- [::Float, ::SOAP::SOAPFloat, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPInt, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPLong, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPInteger, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPShort, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPByte, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPNonPositiveInteger, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPNegativeInteger, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPNonNegativeInteger, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPPositiveInteger, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPUnsignedLong, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPUnsignedInt, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPUnsignedShort, BasetypeFactory,
- {:derived_class => true}],
- [::Integer, ::SOAP::SOAPUnsignedByte, BasetypeFactory,
- {:derived_class => true}],
- [::URI::Generic, ::SOAP::SOAPAnyURI, URIFactory,
- {:derived_class => true}],
- [::String, ::SOAP::SOAPBase64, Base64Factory],
- [::String, ::SOAP::SOAPHexBinary, Base64Factory],
- [::String, ::SOAP::SOAPDecimal, BasetypeFactory],
- [::String, ::SOAP::SOAPDuration, BasetypeFactory],
- [::String, ::SOAP::SOAPGYearMonth, BasetypeFactory],
- [::String, ::SOAP::SOAPGYear, BasetypeFactory],
- [::String, ::SOAP::SOAPGMonthDay, BasetypeFactory],
- [::String, ::SOAP::SOAPGDay, BasetypeFactory],
- [::String, ::SOAP::SOAPGMonth, BasetypeFactory],
- [::String, ::SOAP::SOAPQName, BasetypeFactory],
-
- [::Hash, ::SOAP::SOAPArray, HashFactory],
- [::Hash, ::SOAP::SOAPStruct, HashFactory],
-
- # Does not allow Array's subclass here.
- [::Array, ::SOAP::SOAPArray, ArrayFactory],
-
- [::SOAP::Mapping::SOAPException,
- ::SOAP::SOAPStruct, TypedStructFactory,
- {:type => XSD::QName.new(RubyCustomTypeNamespace, "SOAPException")}],
- ]
-
- attr_accessor :default_factory
- attr_accessor :excn_handler_obj2soap
- attr_accessor :excn_handler_soap2obj
-
- def initialize(config = {})
- @config = config
- @map = Map.new(self)
- if @config[:allow_original_mapping]
- @allow_original_mapping = true
- @map.init(RubyOriginalMap)
- else
- @allow_original_mapping = false
- @map.init(SOAPBaseMap)
- end
- @allow_untyped_struct = @config.key?(:allow_untyped_struct) ?
- @config[:allow_untyped_struct] : true
- @rubytype_factory = RubytypeFactory.new(
- :allow_untyped_struct => @allow_untyped_struct,
- :allow_original_mapping => @allow_original_mapping
- )
- @default_factory = @rubytype_factory
- @excn_handler_obj2soap = nil
- @excn_handler_soap2obj = nil
- end
-
- def add(obj_class, soap_class, factory, info = nil)
- @map.add(obj_class, soap_class, factory, info)
- end
- alias set add
-
- # general Registry ignores type_qname
- def obj2soap(obj, type_qname = nil)
- soap = _obj2soap(obj)
- if @allow_original_mapping
- addextend2soap(soap, obj)
- end
- soap
- end
-
- def soap2obj(node, klass = nil)
- obj = _soap2obj(node, klass)
- if @allow_original_mapping
- addextend2obj(obj, node.extraattr[RubyExtendName])
- addiv2obj(obj, node.extraattr[RubyIVarName])
- end
- obj
- end
-
- def find_mapped_soap_class(obj_class)
- @map.find_mapped_soap_class(obj_class)
- end
-
- def find_mapped_obj_class(soap_class)
- @map.find_mapped_obj_class(soap_class)
- end
-
-private
-
- def _obj2soap(obj)
- ret = nil
- if obj.is_a?(SOAPStruct) or obj.is_a?(SOAPArray)
- obj.replace do |ele|
- Mapping._obj2soap(ele, self)
- end
- return obj
- elsif obj.is_a?(SOAPBasetype)
- return obj
- end
- begin
- ret = @map.obj2soap(obj) ||
- @default_factory.obj2soap(nil, obj, nil, self)
- return ret if ret
- rescue MappingError
- end
- if @excn_handler_obj2soap
- ret = @excn_handler_obj2soap.call(obj) { |yield_obj|
- Mapping._obj2soap(yield_obj, self)
- }
- return ret if ret
- end
- raise MappingError.new("Cannot map #{ obj.class.name } to SOAP/OM.")
- end
-
- # Might return nil as a mapping result.
- def _soap2obj(node, klass = nil)
- if node.extraattr.key?(RubyTypeName)
- conv, obj = @rubytype_factory.soap2obj(nil, node, nil, self)
- return obj if conv
- else
- conv, obj = @map.soap2obj(node, klass)
- return obj if conv
- conv, obj = @default_factory.soap2obj(nil, node, nil, self)
- return obj if conv
- end
- if @excn_handler_soap2obj
- begin
- return @excn_handler_soap2obj.call(node) { |yield_node|
- Mapping._soap2obj(yield_node, self)
- }
- rescue Exception
- end
- end
- raise MappingError.new("Cannot map #{ node.type.name } to Ruby object.")
- end
-
- def addiv2obj(obj, attr)
- return unless attr
- vars = {}
- attr.__getobj__.each do |name, value|
- vars[name] = Mapping._soap2obj(value, self)
- end
- Mapping.set_attributes(obj, vars)
- end
-
- if RUBY_VERSION >= '1.8.0'
- def addextend2obj(obj, attr)
- return unless attr
- attr.split(/ /).reverse_each do |mstr|
- obj.extend(Mapping.module_from_name(mstr))
- end
- end
- else
- # (class < false; self; end).ancestors includes "TrueClass" under 1.6...
- def addextend2obj(obj, attr)
- return unless attr
- attr.split(/ /).reverse_each do |mstr|
- m = Mapping.module_from_name(mstr)
- obj.extend(m)
- end
- end
- end
-
- def addextend2soap(node, obj)
- return if obj.is_a?(Symbol) or obj.is_a?(Fixnum)
- list = (class << obj; self; end).ancestors - obj.class.ancestors
- unless list.empty?
- node.extraattr[RubyExtendName] = list.collect { |c|
- unless c.name
- raise TypeError.new("singleton can't be dumped #{ obj }")
- end
- c.name
- }.join(" ")
- end
- end
-
-end
-
-
-DefaultRegistry = Registry.new
-RubyOriginalRegistry = Registry.new(:allow_original_mapping => true)
-
-
-end
-end
diff --git a/lib/soap/mapping/rubytypeFactory.rb b/lib/soap/mapping/rubytypeFactory.rb
deleted file mode 100644
index 4c629e10d6..0000000000
--- a/lib/soap/mapping/rubytypeFactory.rb
+++ /dev/null
@@ -1,475 +0,0 @@
-# SOAP4R - Ruby type mapping factory.
-# Copyright (C) 2000-2003, 2005 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 SOAP
-module Mapping
-
-
-class RubytypeFactory < Factory
- TYPE_STRING = XSD::QName.new(RubyTypeNamespace, 'String')
- TYPE_TIME = XSD::QName.new(RubyTypeNamespace, 'Time')
- TYPE_ARRAY = XSD::QName.new(RubyTypeNamespace, 'Array')
- TYPE_REGEXP = XSD::QName.new(RubyTypeNamespace, 'Regexp')
- TYPE_RANGE = XSD::QName.new(RubyTypeNamespace, 'Range')
- TYPE_CLASS = XSD::QName.new(RubyTypeNamespace, 'Class')
- TYPE_MODULE = XSD::QName.new(RubyTypeNamespace, 'Module')
- TYPE_SYMBOL = XSD::QName.new(RubyTypeNamespace, 'Symbol')
- TYPE_STRUCT = XSD::QName.new(RubyTypeNamespace, 'Struct')
- TYPE_HASH = XSD::QName.new(RubyTypeNamespace, 'Map')
-
- def initialize(config = {})
- @config = config
- @allow_untyped_struct = @config.key?(:allow_untyped_struct) ?
- @config[:allow_untyped_struct] : true
- @allow_original_mapping = @config.key?(:allow_original_mapping) ?
- @config[:allow_original_mapping] : false
- @string_factory = StringFactory_.new(true)
- @basetype_factory = BasetypeFactory_.new(true)
- @datetime_factory = DateTimeFactory_.new(true)
- @array_factory = ArrayFactory_.new(true)
- @hash_factory = HashFactory_.new(true)
- end
-
- def obj2soap(soap_class, obj, info, map)
- param = nil
- case obj
- when ::Symbol
- unless @allow_original_mapping
- return nil
- end
- param = SOAPStruct.new(TYPE_SYMBOL)
- mark_marshalled_obj(obj, param)
- param.add('id', SOAPString.new(obj.id2name))
- addiv2soapattr(param, obj, map)
- when ::String
- unless @allow_original_mapping
- return nil
- end
- param = @string_factory.obj2soap(SOAPString, obj, info, map)
- if obj.class != String
- param.extraattr[RubyTypeName] = obj.class.name
- end
- addiv2soapattr(param, obj, map)
- when ::Time
- unless @allow_original_mapping
- return nil
- end
- param = @datetime_factory.obj2soap(SOAPDateTime, obj, info, map)
- if obj.class != Time
- param.extraattr[RubyTypeName] = obj.class.name
- end
- addiv2soapattr(param, obj, map)
- when ::Array
- unless @allow_original_mapping
- return nil
- end
- param = @array_factory.obj2soap(nil, obj, info, map)
- if obj.class != Array
- param.extraattr[RubyTypeName] = obj.class.name
- end
- addiv2soapattr(param, obj, map)
- when ::NilClass
- unless @allow_original_mapping
- return nil
- end
- param = @basetype_factory.obj2soap(SOAPNil, obj, info, map)
- addiv2soapattr(param, obj, map)
- when ::FalseClass, ::TrueClass
- unless @allow_original_mapping
- return nil
- end
- param = @basetype_factory.obj2soap(SOAPBoolean, obj, info, map)
- addiv2soapattr(param, obj, map)
- when ::Integer
- unless @allow_original_mapping
- return nil
- end
- param = @basetype_factory.obj2soap(SOAPInt, obj, info, map)
- param ||= @basetype_factory.obj2soap(SOAPInteger, obj, info, map)
- param ||= @basetype_factory.obj2soap(SOAPDecimal, obj, info, map)
- addiv2soapattr(param, obj, map)
- when ::Float
- unless @allow_original_mapping
- return nil
- end
- param = @basetype_factory.obj2soap(SOAPDouble, obj, info, map)
- if obj.class != Float
- param.extraattr[RubyTypeName] = obj.class.name
- end
- addiv2soapattr(param, obj, map)
- when ::Hash
- unless @allow_original_mapping
- return nil
- end
- if obj.respond_to?(:default_proc) && obj.default_proc
- raise TypeError.new("cannot dump hash with default proc")
- end
- param = SOAPStruct.new(TYPE_HASH)
- mark_marshalled_obj(obj, param)
- if obj.class != Hash
- param.extraattr[RubyTypeName] = obj.class.name
- end
- obj.each do |key, value|
- elem = SOAPStruct.new # Undefined type.
- elem.add("key", Mapping._obj2soap(key, map))
- elem.add("value", Mapping._obj2soap(value, map))
- param.add("item", elem)
- end
- param.add('default', Mapping._obj2soap(obj.default, map))
- addiv2soapattr(param, obj, map)
- when ::Regexp
- unless @allow_original_mapping
- return nil
- end
- param = SOAPStruct.new(TYPE_REGEXP)
- mark_marshalled_obj(obj, param)
- if obj.class != Regexp
- param.extraattr[RubyTypeName] = obj.class.name
- end
- param.add('source', SOAPBase64.new(obj.source))
- if obj.respond_to?('options')
- # Regexp#options is from Ruby/1.7
- options = obj.options
- else
- options = 0
- obj.inspect.sub(/^.*\//, '').each_byte do |c|
- options += case c
- when ?i
- 1
- when ?x
- 2
- when ?m
- 4
- when ?n
- 16
- when ?e
- 32
- when ?s
- 48
- when ?u
- 64
- end
- end
- end
- param.add('options', SOAPInt.new(options))
- addiv2soapattr(param, obj, map)
- when ::Range
- unless @allow_original_mapping
- return nil
- end
- param = SOAPStruct.new(TYPE_RANGE)
- mark_marshalled_obj(obj, param)
- if obj.class != Range
- param.extraattr[RubyTypeName] = obj.class.name
- end
- param.add('begin', Mapping._obj2soap(obj.begin, map))
- param.add('end', Mapping._obj2soap(obj.end, map))
- param.add('exclude_end', SOAP::SOAPBoolean.new(obj.exclude_end?))
- addiv2soapattr(param, obj, map)
- when ::Class
- unless @allow_original_mapping
- return nil
- end
- if obj.to_s[0] == ?#
- raise TypeError.new("can't dump anonymous class #{obj}")
- end
- param = SOAPStruct.new(TYPE_CLASS)
- mark_marshalled_obj(obj, param)
- param.add('name', SOAPString.new(obj.name))
- addiv2soapattr(param, obj, map)
- when ::Module
- unless @allow_original_mapping
- return nil
- end
- if obj.to_s[0] == ?#
- raise TypeError.new("can't dump anonymous module #{obj}")
- end
- param = SOAPStruct.new(TYPE_MODULE)
- mark_marshalled_obj(obj, param)
- param.add('name', SOAPString.new(obj.name))
- addiv2soapattr(param, obj, map)
- when ::Struct
- unless @allow_original_mapping
- # treat it as an user defined class. [ruby-talk:104980]
- #param = unknownobj2soap(soap_class, obj, info, map)
- param = SOAPStruct.new(XSD::AnyTypeName)
- mark_marshalled_obj(obj, param)
- obj.members.each do |member|
- param.add(Mapping.name2elename(member),
- Mapping._obj2soap(obj[member], map))
- end
- else
- param = SOAPStruct.new(TYPE_STRUCT)
- mark_marshalled_obj(obj, param)
- param.add('type', ele_type = SOAPString.new(obj.class.to_s))
- ele_member = SOAPStruct.new
- obj.members.each do |member|
- ele_member.add(Mapping.name2elename(member),
- Mapping._obj2soap(obj[member], map))
- end
- param.add('member', ele_member)
- addiv2soapattr(param, obj, map)
- end
- when ::IO, ::Binding, ::Continuation, ::Data, ::Dir, ::File::Stat,
- ::MatchData, Method, ::Proc, ::Thread, ::ThreadGroup
- # from 1.8: Process::Status, UnboundMethod
- return nil
- when ::SOAP::Mapping::Object
- param = SOAPStruct.new(XSD::AnyTypeName)
- mark_marshalled_obj(obj, param)
- obj.__xmlele.each do |key, value|
- param.add(key.name, Mapping._obj2soap(value, map))
- end
- obj.__xmlattr.each do |key, value|
- param.extraattr[key] = value
- end
- when ::Exception
- typestr = Mapping.name2elename(obj.class.to_s)
- param = SOAPStruct.new(XSD::QName.new(RubyTypeNamespace, typestr))
- mark_marshalled_obj(obj, param)
- param.add('message', Mapping._obj2soap(obj.message, map))
- param.add('backtrace', Mapping._obj2soap(obj.backtrace, map))
- addiv2soapattr(param, obj, map)
- else
- param = unknownobj2soap(soap_class, obj, info, map)
- end
- param
- end
-
- def soap2obj(obj_class, node, info, map)
- rubytype = node.extraattr[RubyTypeName]
- if rubytype or node.type.namespace == RubyTypeNamespace
- rubytype2obj(node, info, map, rubytype)
- elsif node.type == XSD::AnyTypeName or node.type == XSD::AnySimpleTypeName
- anytype2obj(node, info, map)
- else
- unknowntype2obj(node, info, map)
- end
- end
-
-private
-
- def addiv2soapattr(node, obj, map)
- return if obj.instance_variables.empty?
- ivars = SOAPStruct.new # Undefined type.
- setiv2soap(ivars, obj, map)
- node.extraattr[RubyIVarName] = ivars
- end
-
- def unknownobj2soap(soap_class, obj, info, map)
- unless obj.class.name
- raise TypeError.new("can't dump anonymous class #{obj}")
- end
- singleton_class = class << obj; self; end
- if !singleton_methods_true(obj).empty? or
- !singleton_class.instance_variables.empty?
- raise TypeError.new("singleton can't be dumped #{obj}")
- end
- if !(singleton_class.ancestors - obj.class.ancestors).empty?
- typestr = Mapping.name2elename(obj.class.to_s)
- type = XSD::QName.new(RubyTypeNamespace, typestr)
- else
- type = Mapping.class2element(obj.class)
- end
- param = SOAPStruct.new(type)
- mark_marshalled_obj(obj, param)
- setiv2soap(param, obj, map)
- param
- end
-
- if RUBY_VERSION >= '1.8.0'
- def singleton_methods_true(obj)
- obj.singleton_methods(true)
- end
- else
- def singleton_methods_true(obj)
- obj.singleton_methods
- end
- end
-
- def rubytype2obj(node, info, map, rubytype)
- klass = rubytype ? Mapping.class_from_name(rubytype) : nil
- obj = nil
- case node
- when SOAPString
- return @string_factory.soap2obj(klass || String, node, info, map)
- when SOAPDateTime
- #return @datetime_factory.soap2obj(klass || Time, node, info, map)
- klass ||= Time
- t = node.to_time
- arg = [t.year, t.month, t.mday, t.hour, t.min, t.sec, t.usec]
- obj = t.gmt? ? klass.gm(*arg) : klass.local(*arg)
- mark_unmarshalled_obj(node, obj)
- return true, obj
- when SOAPArray
- return @array_factory.soap2obj(klass || Array, node, info, map)
- when SOAPNil, SOAPBoolean, SOAPInt, SOAPInteger, SOAPDecimal, SOAPDouble
- return @basetype_factory.soap2obj(nil, node, info, map)
- when SOAPStruct
- return rubytypestruct2obj(node, info, map, rubytype)
- else
- raise
- end
- end
-
- def rubytypestruct2obj(node, info, map, rubytype)
- klass = rubytype ? Mapping.class_from_name(rubytype) : nil
- obj = nil
- case node.type
- when TYPE_HASH
- klass = rubytype ? Mapping.class_from_name(rubytype) : Hash
- obj = Mapping.create_empty_object(klass)
- mark_unmarshalled_obj(node, obj)
- node.each do |key, value|
- next unless key == 'item'
- obj[Mapping._soap2obj(value['key'], map)] =
- Mapping._soap2obj(value['value'], map)
- end
- if node.key?('default')
- obj.default = Mapping._soap2obj(node['default'], map)
- end
- when TYPE_REGEXP
- klass = rubytype ? Mapping.class_from_name(rubytype) : Regexp
- obj = Mapping.create_empty_object(klass)
- mark_unmarshalled_obj(node, obj)
- source = node['source'].string
- options = node['options'].data || 0
- Regexp.instance_method(:initialize).bind(obj).call(source, options)
- when TYPE_RANGE
- klass = rubytype ? Mapping.class_from_name(rubytype) : Range
- obj = Mapping.create_empty_object(klass)
- mark_unmarshalled_obj(node, obj)
- first = Mapping._soap2obj(node['begin'], map)
- last = Mapping._soap2obj(node['end'], map)
- exclude_end = node['exclude_end'].data
- Range.instance_method(:initialize).bind(obj).call(first, last, exclude_end)
- when TYPE_CLASS
- obj = Mapping.class_from_name(node['name'].data)
- when TYPE_MODULE
- obj = Mapping.class_from_name(node['name'].data)
- when TYPE_SYMBOL
- obj = node['id'].data.intern
- when TYPE_STRUCT
- typestr = Mapping.elename2name(node['type'].data)
- klass = Mapping.class_from_name(typestr)
- if klass.nil?
- return false
- end
- unless klass <= ::Struct
- return false
- end
- obj = Mapping.create_empty_object(klass)
- mark_unmarshalled_obj(node, obj)
- node['member'].each do |name, value|
- obj[Mapping.elename2name(name)] = Mapping._soap2obj(value, map)
- end
- else
- return unknowntype2obj(node, info, map)
- end
- return true, obj
- end
-
- def anytype2obj(node, info, map)
- case node
- when SOAPBasetype
- return true, node.data
- when SOAPStruct
- klass = ::SOAP::Mapping::Object
- obj = klass.new
- mark_unmarshalled_obj(node, obj)
- node.each do |name, value|
- obj.__add_xmlele_value(XSD::QName.new(nil, name),
- Mapping._soap2obj(value, map))
- end
- unless node.extraattr.empty?
- obj.instance_variable_set('@__xmlattr', node.extraattr)
- end
- return true, obj
- else
- return false
- end
- end
-
- def unknowntype2obj(node, info, map)
- case node
- when SOAPBasetype
- return true, node.data
- when SOAPArray
- return @array_factory.soap2obj(Array, node, info, map)
- when SOAPStruct
- obj = unknownstruct2obj(node, info, map)
- return true, obj if obj
- if !@allow_untyped_struct
- return false
- end
- return anytype2obj(node, info, map)
- else
- # Basetype which is not defined...
- return false
- end
- end
-
- def unknownstruct2obj(node, info, map)
- unless node.type.name
- return nil
- end
- typestr = Mapping.elename2name(node.type.name)
- klass = Mapping.class_from_name(typestr)
- if klass.nil? and @allow_untyped_struct
- klass = Mapping.class_from_name(typestr, true) # lenient
- end
- if klass.nil?
- return nil
- end
- if klass <= ::Exception
- return exception2obj(klass, node, map)
- end
- klass_type = Mapping.class2qname(klass)
- return nil unless node.type.match(klass_type)
- obj = nil
- begin
- obj = Mapping.create_empty_object(klass)
- rescue
- # type name "data" tries Data.new which raises TypeError
- nil
- end
- mark_unmarshalled_obj(node, obj)
- setiv2obj(obj, node, map)
- obj
- end
-
- def exception2obj(klass, node, map)
- message = Mapping._soap2obj(node['message'], map)
- backtrace = Mapping._soap2obj(node['backtrace'], map)
- obj = Mapping.create_empty_object(klass)
- obj = obj.exception(message)
- mark_unmarshalled_obj(node, obj)
- obj.set_backtrace(backtrace)
- obj
- end
-
- # Only creates empty array. Do String#replace it with real string.
- def array2obj(node, map, rubytype)
- klass = rubytype ? Mapping.class_from_name(rubytype) : Array
- obj = Mapping.create_empty_object(klass)
- mark_unmarshalled_obj(node, obj)
- obj
- end
-
- # Only creates empty string. Do String#replace it with real string.
- def string2obj(node, map, rubytype)
- klass = rubytype ? Mapping.class_from_name(rubytype) : String
- obj = Mapping.create_empty_object(klass)
- mark_unmarshalled_obj(node, obj)
- obj
- end
-end
-
-
-end
-end
diff --git a/lib/soap/mapping/typeMap.rb b/lib/soap/mapping/typeMap.rb
deleted file mode 100644
index 34db19a5b6..0000000000
--- a/lib/soap/mapping/typeMap.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-# SOAP4R - Base type mapping definition
-# Copyright (C) 2000, 2001, 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 SOAP
-
-
-TypeMap = {
- XSD::XSDAnySimpleType::Type => SOAPAnySimpleType,
- XSD::XSDString::Type => SOAPString,
- XSD::XSDBoolean::Type => SOAPBoolean,
- XSD::XSDDecimal::Type => SOAPDecimal,
- XSD::XSDFloat::Type => SOAPFloat,
- XSD::XSDDouble::Type => SOAPDouble,
- XSD::XSDDuration::Type => SOAPDuration,
- XSD::XSDDateTime::Type => SOAPDateTime,
- XSD::XSDTime::Type => SOAPTime,
- XSD::XSDDate::Type => SOAPDate,
- XSD::XSDGYearMonth::Type => SOAPGYearMonth,
- XSD::XSDGYear::Type => SOAPGYear,
- XSD::XSDGMonthDay::Type => SOAPGMonthDay,
- XSD::XSDGDay::Type => SOAPGDay,
- XSD::XSDGMonth::Type => SOAPGMonth,
- XSD::XSDHexBinary::Type => SOAPHexBinary,
- XSD::XSDBase64Binary::Type => SOAPBase64,
- XSD::XSDAnyURI::Type => SOAPAnyURI,
- XSD::XSDQName::Type => SOAPQName,
- XSD::XSDInteger::Type => SOAPInteger,
- XSD::XSDNonPositiveInteger::Type => SOAPNonPositiveInteger,
- XSD::XSDNegativeInteger::Type => SOAPNegativeInteger,
- XSD::XSDLong::Type => SOAPLong,
- XSD::XSDInt::Type => SOAPInt,
- XSD::XSDShort::Type => SOAPShort,
- XSD::XSDByte::Type => SOAPByte,
- XSD::XSDNonNegativeInteger::Type => SOAPNonNegativeInteger,
- XSD::XSDUnsignedLong::Type => SOAPUnsignedLong,
- XSD::XSDUnsignedInt::Type => SOAPUnsignedInt,
- XSD::XSDUnsignedShort::Type => SOAPUnsignedShort,
- XSD::XSDUnsignedByte::Type => SOAPUnsignedByte,
- XSD::XSDPositiveInteger::Type => SOAPPositiveInteger,
-
- SOAP::SOAPBase64::Type => SOAPBase64,
-}
-
-
-end
diff --git a/lib/soap/mapping/wsdlencodedregistry.rb b/lib/soap/mapping/wsdlencodedregistry.rb
deleted file mode 100644
index 4efb60188f..0000000000
--- a/lib/soap/mapping/wsdlencodedregistry.rb
+++ /dev/null
@@ -1,280 +0,0 @@
-# SOAP4R - WSDL encoded mapping registry.
-# Copyright (C) 2000-2003, 2005 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/namedelements'
-require 'soap/baseData'
-require 'soap/mapping/mapping'
-require 'soap/mapping/typeMap'
-
-
-module SOAP
-module Mapping
-
-
-class WSDLEncodedRegistry < Registry
- include TraverseSupport
-
- attr_reader :definedelements
- attr_reader :definedtypes
- attr_accessor :excn_handler_obj2soap
- attr_accessor :excn_handler_soap2obj
-
- def initialize(definedtypes = XSD::NamedElements::Empty)
- @definedtypes = definedtypes
- # @definedelements = definedelements needed?
- @excn_handler_obj2soap = nil
- @excn_handler_soap2obj = nil
- # For mapping AnyType element.
- @rubytype_factory = RubytypeFactory.new(
- :allow_untyped_struct => true,
- :allow_original_mapping => true
- )
- @schema_element_cache = {}
- end
-
- def obj2soap(obj, qname = nil)
- soap_obj = nil
- if type = @definedtypes[qname]
- soap_obj = obj2typesoap(obj, type)
- else
- soap_obj = any2soap(obj, qname)
- end
- return soap_obj if soap_obj
- if @excn_handler_obj2soap
- soap_obj = @excn_handler_obj2soap.call(obj) { |yield_obj|
- Mapping._obj2soap(yield_obj, self)
- }
- return soap_obj if soap_obj
- end
- if qname
- raise MappingError.new("cannot map #{obj.class.name} as #{qname}")
- else
- raise MappingError.new("cannot map #{obj.class.name} to SOAP/OM")
- end
- end
-
- # map anything for now: must refer WSDL while mapping. [ToDo]
- def soap2obj(node, obj_class = nil)
- begin
- return any2obj(node, obj_class)
- rescue MappingError
- end
- if @excn_handler_soap2obj
- begin
- return @excn_handler_soap2obj.call(node) { |yield_node|
- Mapping._soap2obj(yield_node, self)
- }
- rescue Exception
- end
- end
- raise MappingError.new("cannot map #{node.type.name} to Ruby object")
- end
-
-private
-
- def any2soap(obj, qname)
- if obj.nil?
- SOAPNil.new
- elsif qname.nil? or qname == XSD::AnyTypeName
- @rubytype_factory.obj2soap(nil, obj, nil, self)
- elsif obj.is_a?(XSD::NSDBase)
- soap2soap(obj, qname)
- elsif (type = TypeMap[qname])
- base2soap(obj, type)
- else
- nil
- end
- end
-
- def soap2soap(obj, type_qname)
- if obj.is_a?(SOAPBasetype)
- obj
- elsif obj.is_a?(SOAPStruct) && (type = @definedtypes[type_qname])
- soap_obj = obj
- mark_marshalled_obj(obj, soap_obj)
- elements2soap(obj, soap_obj, type.content.elements)
- soap_obj
- elsif obj.is_a?(SOAPArray) && (type = @definedtypes[type_qname])
- soap_obj = obj
- contenttype = type.child_type
- mark_marshalled_obj(obj, soap_obj)
- obj.replace do |ele|
- Mapping._obj2soap(ele, self, contenttype)
- end
- soap_obj
- else
- nil
- end
- end
-
- def obj2typesoap(obj, type)
- if type.is_a?(::WSDL::XMLSchema::SimpleType)
- simpleobj2soap(obj, type)
- else
- complexobj2soap(obj, type)
- end
- end
-
- def simpleobj2soap(obj, type)
- type.check_lexical_format(obj)
- return SOAPNil.new if obj.nil? # ToDo: check nillable.
- o = base2soap(obj, TypeMap[type.base])
- o
- end
-
- def complexobj2soap(obj, type)
- case type.compoundtype
- when :TYPE_STRUCT
- struct2soap(obj, type.name, type)
- when :TYPE_ARRAY
- array2soap(obj, type.name, type)
- when :TYPE_MAP
- map2soap(obj, type.name, type)
- when :TYPE_SIMPLE
- simpleobj2soap(obj, type.simplecontent)
- when :TYPE_EMPTY
- raise MappingError.new("should be empty") unless obj.nil?
- SOAPNil.new
- else
- raise MappingError.new("unknown compound type: #{type.compoundtype}")
- end
- end
-
- def base2soap(obj, type)
- soap_obj = nil
- if type <= XSD::XSDString
- str = XSD::Charset.encoding_conv(obj.to_s,
- Thread.current[:SOAPExternalCES], XSD::Charset.encoding)
- soap_obj = type.new(str)
- mark_marshalled_obj(obj, soap_obj)
- else
- soap_obj = type.new(obj)
- end
- soap_obj
- end
-
- def struct2soap(obj, type_qname, type)
- return SOAPNil.new if obj.nil? # ToDo: check nillable.
- soap_obj = SOAPStruct.new(type_qname)
- unless obj.nil?
- mark_marshalled_obj(obj, soap_obj)
- elements2soap(obj, soap_obj, type.content.elements)
- end
- soap_obj
- end
-
- def array2soap(obj, type_qname, type)
- return SOAPNil.new if obj.nil? # ToDo: check nillable.
- arytype = type.child_type
- soap_obj = SOAPArray.new(ValueArrayName, 1, arytype)
- unless obj.nil?
- mark_marshalled_obj(obj, soap_obj)
- obj.each do |item|
- soap_obj.add(Mapping._obj2soap(item, self, arytype))
- end
- end
- soap_obj
- end
-
- MapKeyName = XSD::QName.new(nil, "key")
- MapValueName = XSD::QName.new(nil, "value")
- def map2soap(obj, type_qname, type)
- return SOAPNil.new if obj.nil? # ToDo: check nillable.
- keytype = type.child_type(MapKeyName) || XSD::AnyTypeName
- valuetype = type.child_type(MapValueName) || XSD::AnyTypeName
- soap_obj = SOAPStruct.new(MapQName)
- unless obj.nil?
- mark_marshalled_obj(obj, soap_obj)
- obj.each do |key, value|
- elem = SOAPStruct.new
- elem.add("key", Mapping._obj2soap(key, self, keytype))
- elem.add("value", Mapping._obj2soap(value, self, valuetype))
- # ApacheAxis allows only 'item' here.
- soap_obj.add("item", elem)
- end
- end
- soap_obj
- end
-
- def elements2soap(obj, soap_obj, elements)
- elements.each do |element|
- name = element.name.name
- child_obj = Mapping.get_attribute(obj, name)
- soap_obj.add(name,
- Mapping._obj2soap(child_obj, self, element.type || element.name))
- end
- end
-
- def any2obj(node, obj_class)
- unless obj_class
- typestr = XSD::CodeGen::GenSupport.safeconstname(node.elename.name)
- obj_class = Mapping.class_from_name(typestr)
- end
- if obj_class and obj_class.class_variables.include?('@@schema_element')
- soap2stubobj(node, obj_class)
- else
- Mapping._soap2obj(node, Mapping::DefaultRegistry, obj_class)
- end
- end
-
- def soap2stubobj(node, obj_class)
- obj = Mapping.create_empty_object(obj_class)
- unless node.is_a?(SOAPNil)
- add_elements2stubobj(node, obj)
- end
- obj
- end
-
- def add_elements2stubobj(node, obj)
- elements, as_array = schema_element_definition(obj.class)
- vars = {}
- node.each do |name, value|
- item = elements.find { |k, v| k.name == name }
- if item
- elename, class_name = item
- if klass = Mapping.class_from_name(class_name)
- # klass must be a SOAPBasetype or a class
- if klass.ancestors.include?(::SOAP::SOAPBasetype)
- if value.respond_to?(:data)
- child = klass.new(value.data).data
- else
- child = klass.new(nil).data
- end
- else
- child = Mapping._soap2obj(value, self, klass)
- end
- elsif klass = Mapping.module_from_name(class_name)
- # simpletype
- if value.respond_to?(:data)
- child = value.data
- else
- raise MappingError.new(
- "cannot map to a module value: #{class_name}")
- end
- else
- raise MappingError.new("unknown class: #{class_name}")
- end
- else # untyped element is treated as anyType.
- child = Mapping._soap2obj(value, self)
- end
- vars[name] = child
- end
- Mapping.set_attributes(obj, vars)
- end
-
- # it caches @@schema_element. this means that @@schema_element must not be
- # changed while a lifetime of a WSDLLiteralRegistry.
- def schema_element_definition(klass)
- @schema_element_cache[klass] ||= Mapping.schema_element_definition(klass)
- end
-end
-
-
-end
-end
diff --git a/lib/soap/mapping/wsdlliteralregistry.rb b/lib/soap/mapping/wsdlliteralregistry.rb
deleted file mode 100644
index 7bb8e12203..0000000000
--- a/lib/soap/mapping/wsdlliteralregistry.rb
+++ /dev/null
@@ -1,418 +0,0 @@
-# SOAP4R - WSDL literal mapping registry.
-# Copyright (C) 2004, 2005 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 'soap/baseData'
-require 'soap/mapping/mapping'
-require 'soap/mapping/typeMap'
-require 'xsd/codegen/gensupport'
-require 'xsd/namedelements'
-
-
-module SOAP
-module Mapping
-
-
-class WSDLLiteralRegistry < Registry
- attr_reader :definedelements
- attr_reader :definedtypes
- attr_accessor :excn_handler_obj2soap
- attr_accessor :excn_handler_soap2obj
-
- def initialize(definedtypes = XSD::NamedElements::Empty,
- definedelements = XSD::NamedElements::Empty)
- @definedtypes = definedtypes
- @definedelements = definedelements
- @excn_handler_obj2soap = nil
- @excn_handler_soap2obj = nil
- @schema_element_cache = {}
- @schema_attribute_cache = {}
- end
-
- def obj2soap(obj, qname)
- soap_obj = nil
- if ele = @definedelements[qname]
- soap_obj = obj2elesoap(obj, ele)
- elsif type = @definedtypes[qname]
- soap_obj = obj2typesoap(obj, type, true)
- else
- soap_obj = any2soap(obj, qname)
- end
- return soap_obj if soap_obj
- if @excn_handler_obj2soap
- soap_obj = @excn_handler_obj2soap.call(obj) { |yield_obj|
- Mapping.obj2soap(yield_obj, nil, nil, MAPPING_OPT)
- }
- return soap_obj if soap_obj
- end
- raise MappingError.new("cannot map #{obj.class.name} as #{qname}")
- end
-
- # node should be a SOAPElement
- def soap2obj(node, obj_class = nil)
- # obj_class is given when rpc/literal service. but ignored for now.
- begin
- return any2obj(node)
- rescue MappingError
- end
- if @excn_handler_soap2obj
- begin
- return @excn_handler_soap2obj.call(node) { |yield_node|
- Mapping.soap2obj(yield_node, nil, nil, MAPPING_OPT)
- }
- rescue Exception
- end
- end
- if node.respond_to?(:type)
- raise MappingError.new("cannot map #{node.type.name} to Ruby object")
- else
- raise MappingError.new("cannot map #{node.elename.name} to Ruby object")
- end
- end
-
-private
-
- MAPPING_OPT = { :no_reference => true }
-
- def obj2elesoap(obj, ele)
- o = nil
- qualified = (ele.elementform == 'qualified')
- if ele.type
- if type = @definedtypes[ele.type]
- o = obj2typesoap(obj, type, qualified)
- elsif type = TypeMap[ele.type]
- o = base2soap(obj, type)
- else
- raise MappingError.new("cannot find type #{ele.type}")
- end
- elsif ele.local_complextype
- o = obj2typesoap(obj, ele.local_complextype, qualified)
- add_attributes2soap(obj, o)
- elsif ele.local_simpletype
- o = obj2typesoap(obj, ele.local_simpletype, qualified)
- else
- raise MappingError.new('illegal schema?')
- end
- o.elename = ele.name
- o
- end
-
- def obj2typesoap(obj, type, qualified)
- if type.is_a?(::WSDL::XMLSchema::SimpleType)
- simpleobj2soap(obj, type)
- else
- complexobj2soap(obj, type, qualified)
- end
- end
-
- def simpleobj2soap(obj, type)
- type.check_lexical_format(obj)
- return SOAPNil.new if obj.nil? # ToDo: check nillable.
- o = base2soap(obj, TypeMap[type.base])
- o
- end
-
- def complexobj2soap(obj, type, qualified)
- o = SOAPElement.new(type.name)
- o.qualified = qualified
- type.each_element do |child_ele|
- child = Mapping.get_attribute(obj, child_ele.name.name)
- if child.nil?
- if child_ele.nillable
- # ToDo: test
- # add empty element
- child_soap = obj2elesoap(nil, child_ele)
- o.add(child_soap)
- elsif Integer(child_ele.minoccurs) == 0
- # nothing to do
- else
- raise MappingError.new("nil not allowed: #{child_ele.name.name}")
- end
- elsif child_ele.map_as_array?
- child.each do |item|
- child_soap = obj2elesoap(item, child_ele)
- o.add(child_soap)
- end
- else
- child_soap = obj2elesoap(child, child_ele)
- o.add(child_soap)
- end
- end
- o
- end
-
- def any2soap(obj, qname)
- if obj.is_a?(SOAPElement)
- obj
- elsif obj.class.class_variables.include?('@@schema_element')
- stubobj2soap(obj, qname)
- elsif obj.is_a?(SOAP::Mapping::Object)
- mappingobj2soap(obj, qname)
- elsif obj.is_a?(Hash)
- ele = SOAPElement.from_obj(obj)
- ele.elename = qname
- ele
- else
- # expected to be a basetype or an anyType.
- # SOAPStruct, etc. is used instead of SOAPElement.
- begin
- ele = Mapping.obj2soap(obj, nil, nil, MAPPING_OPT)
- ele.elename = qname
- ele
- rescue MappingError
- ele = SOAPElement.new(qname, obj.to_s)
- end
- if obj.respond_to?(:__xmlattr)
- obj.__xmlattr.each do |key, value|
- ele.extraattr[key] = value
- end
- end
- ele
- end
- end
-
- def stubobj2soap(obj, qname)
- ele = SOAPElement.new(qname)
- ele.qualified =
- (obj.class.class_variables.include?('@@schema_qualified') and
- obj.class.class_eval('@@schema_qualified'))
- add_elements2soap(obj, ele)
- add_attributes2soap(obj, ele)
- ele
- end
-
- def mappingobj2soap(obj, qname)
- ele = SOAPElement.new(qname)
- obj.__xmlele.each do |key, value|
- if value.is_a?(::Array)
- value.each do |item|
- ele.add(obj2soap(item, key))
- end
- else
- ele.add(obj2soap(value, key))
- end
- end
- obj.__xmlattr.each do |key, value|
- ele.extraattr[key] = value
- end
- ele
- end
-
- def add_elements2soap(obj, ele)
- elements, as_array = schema_element_definition(obj.class)
- if elements
- elements.each do |elename, type|
- if child = Mapping.get_attribute(obj, elename.name)
- if as_array.include?(elename.name)
- child.each do |item|
- ele.add(obj2soap(item, elename))
- end
- else
- ele.add(obj2soap(child, elename))
- end
- elsif obj.is_a?(::Array) and as_array.include?(elename.name)
- obj.each do |item|
- ele.add(obj2soap(item, elename))
- end
- end
- end
- end
- end
-
- def add_attributes2soap(obj, ele)
- attributes = schema_attribute_definition(obj.class)
- if attributes
- attributes.each do |qname, param|
- attr = obj.__send__('xmlattr_' +
- XSD::CodeGen::GenSupport.safevarname(qname.name))
- ele.extraattr[qname] = attr
- end
- end
- end
-
- def base2soap(obj, type)
- soap_obj = nil
- if type <= XSD::XSDString
- str = XSD::Charset.encoding_conv(obj.to_s,
- Thread.current[:SOAPExternalCES], XSD::Charset.encoding)
- soap_obj = type.new(str)
- else
- soap_obj = type.new(obj)
- end
- soap_obj
- end
-
- def anytype2obj(node)
- if node.is_a?(::SOAP::SOAPBasetype)
- return node.data
- end
- klass = ::SOAP::Mapping::Object
- obj = klass.new
- obj
- end
-
- def any2obj(node, obj_class = nil)
- unless obj_class
- typestr = XSD::CodeGen::GenSupport.safeconstname(node.elename.name)
- obj_class = Mapping.class_from_name(typestr)
- end
- if obj_class and obj_class.class_variables.include?('@@schema_element')
- soapele2stubobj(node, obj_class)
- elsif node.is_a?(SOAPElement) or node.is_a?(SOAPStruct)
- # SOAPArray for literal?
- soapele2plainobj(node)
- else
- obj = Mapping.soap2obj(node, nil, obj_class, MAPPING_OPT)
- add_attributes2plainobj(node, obj)
- obj
- end
- end
-
- def soapele2stubobj(node, obj_class)
- obj = Mapping.create_empty_object(obj_class)
- add_elements2stubobj(node, obj)
- add_attributes2stubobj(node, obj)
- obj
- end
-
- def soapele2plainobj(node)
- obj = anytype2obj(node)
- add_elements2plainobj(node, obj)
- add_attributes2plainobj(node, obj)
- obj
- end
-
- def add_elements2stubobj(node, obj)
- elements, as_array = schema_element_definition(obj.class)
- vars = {}
- node.each do |name, value|
- item = elements.find { |k, v| k.name == name }
- if item
- elename, class_name = item
- if klass = Mapping.class_from_name(class_name)
- # klass must be a SOAPBasetype or a class
- if klass.ancestors.include?(::SOAP::SOAPBasetype)
- if value.respond_to?(:data)
- child = klass.new(value.data).data
- else
- child = klass.new(nil).data
- end
- else
- child = any2obj(value, klass)
- end
- elsif klass = Mapping.module_from_name(class_name)
- # simpletype
- if value.respond_to?(:data)
- child = value.data
- else
- raise MappingError.new(
- "cannot map to a module value: #{class_name}")
- end
- else
- raise MappingError.new("unknown class/module: #{class_name}")
- end
- else # untyped element is treated as anyType.
- child = any2obj(value)
- end
- if as_array.include?(elename.name)
- (vars[name] ||= []) << child
- else
- vars[name] = child
- end
- end
- Mapping.set_attributes(obj, vars)
- end
-
- def add_attributes2stubobj(node, obj)
- if attributes = schema_attribute_definition(obj.class)
- define_xmlattr(obj)
- attributes.each do |qname, class_name|
- attr = node.extraattr[qname]
- next if attr.nil? or attr.empty?
- klass = Mapping.class_from_name(class_name)
- if klass.ancestors.include?(::SOAP::SOAPBasetype)
- child = klass.new(attr).data
- else
- child = attr
- end
- obj.__xmlattr[qname] = child
- define_xmlattr_accessor(obj, qname)
- end
- end
- end
-
- def add_elements2plainobj(node, obj)
- node.each do |name, value|
- obj.__add_xmlele_value(value.elename, any2obj(value))
- end
- end
-
- def add_attributes2plainobj(node, obj)
- return if node.extraattr.empty?
- define_xmlattr(obj)
- node.extraattr.each do |qname, value|
- obj.__xmlattr[qname] = value
- define_xmlattr_accessor(obj, qname)
- end
- end
-
- if RUBY_VERSION > "1.7.0"
- def define_xmlattr_accessor(obj, qname)
- name = XSD::CodeGen::GenSupport.safemethodname(qname.name)
- Mapping.define_attr_accessor(obj, 'xmlattr_' + name,
- proc { @__xmlattr[qname] },
- proc { |value| @__xmlattr[qname] = value })
- end
- else
- def define_xmlattr_accessor(obj, qname)
- name = XSD::CodeGen::GenSupport.safemethodname(qname.name)
- obj.instance_eval <<-EOS
- def #{name}
- @__xmlattr[#{qname.dump}]
- end
-
- def #{name}=(value)
- @__xmlattr[#{qname.dump}] = value
- end
- EOS
- end
- end
-
- if RUBY_VERSION > "1.7.0"
- def define_xmlattr(obj)
- obj.instance_variable_set('@__xmlattr', {})
- unless obj.respond_to?(:__xmlattr)
- Mapping.define_attr_accessor(obj, :__xmlattr, proc { @__xmlattr })
- end
- end
- else
- def define_xmlattr(obj)
- obj.instance_variable_set('@__xmlattr', {})
- unless obj.respond_to?(:__xmlattr)
- obj.instance_eval <<-EOS
- def __xmlattr
- @__xmlattr
- end
- EOS
- end
- end
- end
-
- # it caches @@schema_element. this means that @@schema_element must not be
- # changed while a lifetime of a WSDLLiteralRegistry.
- def schema_element_definition(klass)
- @schema_element_cache[klass] ||= Mapping.schema_element_definition(klass)
- end
-
- def schema_attribute_definition(klass)
- @schema_attribute_cache[klass] ||= Mapping.schema_attribute_definition(klass)
- end
-end
-
-
-end
-end
diff --git a/lib/soap/marshal.rb b/lib/soap/marshal.rb
deleted file mode 100644
index 1c3d5b01db..0000000000
--- a/lib/soap/marshal.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-# SOAP4R - Marshalling/Unmarshalling Ruby's object using SOAP Encoding.
-# Copyright (C) 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 "soap/mapping"
-require "soap/processor"
-
-
-module SOAP
-
-
-module Marshal
- # Trying xsd:dateTime data to be recovered as aTime.
- MarshalMappingRegistry = Mapping::Registry.new(
- :allow_original_mapping => true)
- MarshalMappingRegistry.add(
- Time,
- ::SOAP::SOAPDateTime,
- ::SOAP::Mapping::Registry::DateTimeFactory
- )
-
- class << self
- public
- def dump(obj, io = nil)
- marshal(obj, MarshalMappingRegistry, io)
- end
-
- def load(stream)
- unmarshal(stream, MarshalMappingRegistry)
- end
-
- def marshal(obj, mapping_registry = MarshalMappingRegistry, io = nil)
- elename = Mapping.name2elename(obj.class.to_s)
- soap_obj = Mapping.obj2soap(obj, mapping_registry)
- body = SOAPBody.new
- body.add(elename, soap_obj)
- env = SOAPEnvelope.new(nil, body)
- SOAP::Processor.marshal(env, {}, io)
- end
-
- def unmarshal(stream, mapping_registry = MarshalMappingRegistry)
- env = SOAP::Processor.unmarshal(stream)
- if env.nil?
- raise ArgumentError.new("Illegal SOAP marshal format.")
- end
- Mapping.soap2obj(env.body.root_node, mapping_registry)
- end
- end
-end
-
-
-end
-
-
-SOAPMarshal = SOAP::Marshal
diff --git a/lib/soap/mimemessage.rb b/lib/soap/mimemessage.rb
deleted file mode 100644
index 4e151e320a..0000000000
--- a/lib/soap/mimemessage.rb
+++ /dev/null
@@ -1,240 +0,0 @@
-# SOAP4R - MIME Message implementation.
-# Copyright (C) 2002 Jamie Herre.
-
-# 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 'soap/attachment'
-
-
-module SOAP
-
-
-# Classes for MIME message handling. Should be put somewhere else!
-# Tried using the 'tmail' module but found that I needed something
-# lighter in weight.
-
-
-class MIMEMessage
- class MIMEMessageError < StandardError; end
-
- MultipartContentType = 'multipart/\w+'
-
- class Header
- attr_accessor :str, :key, :root
-
- def initialize
- @attrs = {}
- end
-
- def [](key)
- @attrs[key]
- end
-
- def []=(key, value)
- @attrs[key] = value
- end
-
- def to_s
- @key + ": " + @str
- end
- end
-
- class Headers < Hash
- def self.parse(str)
- new.parse(str)
- end
-
- def parse(str)
- header_cache = nil
- str.lines.each do |line|
- case line
- when /^\A[^\: \t]+:\s*.+$/
- parse_line(header_cache) if header_cache
- header_cache = line.sub(/\r?\n\z/, '')
- when /^\A\s+(.*)$/
- # a continuous line at the beginning line crashes here.
- header_cache << line
- else
- raise RuntimeError.new("unexpected header: #{line.inspect}")
- end
- end
- parse_line(header_cache) if header_cache
- self
- end
-
- def parse_line(line)
- if /^\A([^\: \t]+):\s*(.+)\z/ =~ line
- header = parse_rhs($2.strip)
- header.key = $1.strip
- self[header.key.downcase] = header
- else
- raise RuntimeError.new("unexpected header line: #{line.inspect}")
- end
- end
-
- def parse_rhs(str)
- a = str.split(/;+\s+/)
- header = Header.new
- header.str = str
- header.root = a.shift
- a.each do |pair|
- if pair =~ /(\w+)\s*=\s*"?([^"]+)"?/
- header[$1.downcase] = $2
- else
- raise RuntimeError.new("unexpected header component: #{pair.inspect}")
- end
- end
- header
- end
-
- def add(key, value)
- if key != nil and value != nil
- header = parse_rhs(value)
- header.key = key
- self[key.downcase] = header
- end
- end
-
- def to_s
- self.values.collect { |hdr|
- hdr.to_s
- }.join("\r\n")
- end
- end
-
- class Part
- attr_accessor :headers, :body
-
- def initialize
- @headers = Headers.new
- @headers.add("Content-Transfer-Encoding", "8bit")
- @body = nil
- @contentid = nil
- end
-
- def self.parse(str)
- new.parse(str)
- end
-
- def parse(str)
- headers, body = str.split(/\r\n\r\n/s)
- if headers != nil and body != nil
- @headers = Headers.parse(headers)
- @body = body.sub(/\r\n\z/, '')
- else
- raise RuntimeError.new("unexpected part: #{str.inspect}")
- end
- self
- end
-
- def contentid
- if @contentid == nil and @headers.key?('content-id')
- @contentid = @headers['content-id'].str
- @contentid = $1 if @contentid =~ /^<(.+)>$/
- end
- @contentid
- end
-
- alias content body
-
- def to_s
- @headers.to_s + "\r\n\r\n" + @body
- end
- end
-
- def initialize
- @parts = []
- @headers = Headers.new
- @root = nil
- end
-
- def self.parse(head, str)
- new.parse(head, str)
- end
-
- attr_reader :parts, :headers
-
- def close
- @headers.add(
- "Content-Type",
- "multipart/related; type=\"text/xml\"; boundary=\"#{boundary}\"; start=\"#{@parts[0].contentid}\""
- )
- end
-
- def parse(head, str)
- @headers = Headers.parse(head + "\r\n" + "From: jfh\r\n")
- boundary = @headers['content-type']['boundary']
- if boundary != nil
- parts = str.split(/--#{Regexp.quote(boundary)}\s*(?:\r\n|--\r\n)/)
- part = parts.shift # preamble must be ignored.
- @parts = parts.collect { |part| Part.parse(part) }
- else
- @parts = [Part.parse(str)]
- end
- if @parts.length < 1
- raise MIMEMessageError.new("This message contains no valid parts!")
- end
- self
- end
-
- def root
- if @root == nil
- start = @headers['content-type']['start']
- @root = (start && @parts.find { |prt| prt.contentid == start }) ||
- @parts[0]
- end
- @root
- end
-
- def boundary
- if @boundary == nil
- @boundary = "----=Part_" + __id__.to_s + rand.to_s
- end
- @boundary
- end
-
- def add_part(content)
- part = Part.new
- part.headers.add("Content-Type",
- "text/xml; charset=" + XSD::Charset.xml_encoding_label)
- part.headers.add("Content-ID", Attachment.contentid(part))
- part.body = content
- @parts.unshift(part)
- end
-
- def add_attachment(attach)
- part = Part.new
- part.headers.add("Content-Type", attach.contenttype)
- part.headers.add("Content-ID", attach.mime_contentid)
- part.body = attach.content
- @parts.unshift(part)
- end
-
- def has_parts?
- (@parts.length > 0)
- end
-
- def headers_str
- @headers.to_s
- end
-
- def content_str
- str = ''
- @parts.each do |prt|
- str << "--" + boundary + "\r\n"
- str << prt.to_s + "\r\n"
- end
- str << '--' + boundary + "--\r\n"
- str
- end
-
- def to_s
- str = headers_str + "\r\n\r\n" + conent_str
- end
-end
-
-
-end
diff --git a/lib/soap/netHttpClient.rb b/lib/soap/netHttpClient.rb
deleted file mode 100644
index 10d68e2a4c..0000000000
--- a/lib/soap/netHttpClient.rb
+++ /dev/null
@@ -1,190 +0,0 @@
-# SOAP4R - net/http wrapper
-# 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 'net/http'
-
-
-module SOAP
-
-
-class NetHttpClient
-
- SSLEnabled = begin
- require 'net/https'
- true
- rescue LoadError
- false
- end
-
- attr_reader :proxy
- attr_accessor :no_proxy
- attr_accessor :debug_dev
- attr_accessor :ssl_config # ignored for now.
- attr_accessor :protocol_version # ignored for now.
- attr_accessor :connect_timeout
- attr_accessor :send_timeout # ignored for now.
- attr_accessor :receive_timeout
-
- def initialize(proxy = nil, agent = nil)
- @proxy = proxy ? URI.parse(proxy) : nil
- @agent = agent
- @debug_dev = nil
- @session_manager = SessionManager.new
- @no_proxy = @ssl_config = @protocol_version = nil
- @connect_timeout = @send_timeout = @receive_timeout = nil
- end
-
- def test_loopback_response
- raise NotImplementedError.new("not supported for now")
- end
-
- def proxy=(proxy)
- if proxy.nil?
- @proxy = nil
- else
- if proxy.is_a?(URI)
- @proxy = proxy
- else
- @proxy = URI.parse(proxy)
- end
- if @proxy.scheme == nil or @proxy.scheme.downcase != 'http' or
- @proxy.host == nil or @proxy.port == nil
- raise ArgumentError.new("unsupported proxy `#{proxy}'")
- end
- end
- reset_all
- @proxy
- end
-
- def set_basic_auth(uri, user_id, passwd)
- # net/http does not handle url.
- @basic_auth = [user_id, passwd]
- raise NotImplementedError.new("basic_auth is not supported under soap4r + net/http.")
- end
-
- def set_cookie_store(filename)
- raise NotImplementedError.new
- end
-
- def save_cookie_store(filename)
- raise NotImplementedError.new
- end
-
- def reset(url)
- # no persistent connection. ignored.
- end
-
- def reset_all
- # no persistent connection. ignored.
- end
-
- def post(url, req_body, header = {})
- unless url.is_a?(URI)
- url = URI.parse(url)
- end
- extra = header.dup
- extra['User-Agent'] = @agent if @agent
- res = start(url) { |http|
- http.post(url.request_uri, req_body, extra)
- }
- Response.new(res)
- end
-
- def get_content(url, header = {})
- unless url.is_a?(URI)
- url = URI.parse(url)
- end
- extra = header.dup
- extra['User-Agent'] = @agent if @agent
- res = start(url) { |http|
- http.get(url.request_uri, extra)
- }
- res.body
- end
-
-private
-
- def start(url)
- http = create_connection(url)
- response = nil
- http.start { |worker|
- response = yield(worker)
- worker.finish
- }
- @debug_dev << response.body if @debug_dev
- response
- end
-
- def create_connection(url)
- proxy_host = proxy_port = nil
- unless no_proxy?(url)
- proxy_host = @proxy.host
- proxy_port = @proxy.port
- end
- http = Net::HTTP::Proxy(proxy_host, proxy_port).new(url.host, url.port)
- if http.respond_to?(:set_debug_output)
- http.set_debug_output(@debug_dev)
- end
- http.open_timeout = @connect_timeout if @connect_timeout
- http.read_timeout = @receive_timeout if @receive_timeout
- case url
- when URI::HTTPS
- if SSLEnabled
- http.use_ssl = true
- else
- raise RuntimeError.new("Cannot connect to #{url} (OpenSSL is not installed.)")
- end
- when URI::HTTP
- # OK
- else
- raise RuntimeError.new("Cannot connect to #{url} (Not HTTP.)")
- end
- http
- end
-
- NO_PROXY_HOSTS = ['localhost']
-
- def no_proxy?(uri)
- if !@proxy or NO_PROXY_HOSTS.include?(uri.host)
- return true
- end
- if @no_proxy
- @no_proxy.scan(/([^:,]*)(?::(\d+))?/) do |host, port|
- if /(\A|\.)#{Regexp.quote(host)}\z/i =~ uri.host &&
- (!port || uri.port == port.to_i)
- return true
- end
- end
- else
- false
- end
- end
-
- class SessionManager
- attr_accessor :connect_timeout
- attr_accessor :send_timeout
- attr_accessor :receive_timeout
- end
-
- class Response
- attr_reader :content
- attr_reader :status
- attr_reader :reason
- attr_reader :contenttype
-
- def initialize(res)
- @status = res.code.to_i
- @reason = res.message
- @contenttype = res['content-type']
- @content = res.body
- end
- end
-end
-
-
-end
diff --git a/lib/soap/parser.rb b/lib/soap/parser.rb
deleted file mode 100644
index 412fd4855a..0000000000
--- a/lib/soap/parser.rb
+++ /dev/null
@@ -1,251 +0,0 @@
-# SOAP4R - SOAP XML Instance Parser library.
-# Copyright (C) 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/ns'
-require 'xsd/xmlparser'
-require 'soap/soap'
-require 'soap/baseData'
-require 'soap/encodingstyle/handler'
-
-
-module SOAP
-
-
-class Parser
- include SOAP
-
- class ParseError < Error; end
- class FormatDecodeError < ParseError; end
- class UnexpectedElementError < ParseError; end
-
-private
-
- class ParseFrame
- attr_reader :node
- attr_reader :name
- attr_reader :ns, :encodingstyle
-
- class NodeContainer
- def initialize(node)
- @node = node
- end
-
- def node
- @node
- end
-
- def replace_node(node)
- @node = node
- end
- end
-
- public
-
- def initialize(ns, name, node, encodingstyle)
- @ns = ns
- @name = name
- self.node = node
- @encodingstyle = encodingstyle
- end
-
- def node=(node)
- @node = NodeContainer.new(node)
- end
- end
-
-public
-
- attr_accessor :envelopenamespace
- attr_accessor :default_encodingstyle
- attr_accessor :decode_typemap
- attr_accessor :allow_unqualified_element
-
- def initialize(opt = {})
- @opt = opt
- @parser = XSD::XMLParser.create_parser(self, opt)
- @parsestack = nil
- @lastnode = nil
- @handlers = {}
- @envelopenamespace = opt[:envelopenamespace] || EnvelopeNamespace
- @default_encodingstyle = opt[:default_encodingstyle] || EncodingNamespace
- @decode_typemap = opt[:decode_typemap] || nil
- @allow_unqualified_element = opt[:allow_unqualified_element] || false
- end
-
- def charset
- @parser.charset
- end
-
- def parse(string_or_readable)
- @parsestack = []
- @lastnode = nil
-
- @handlers.each do |uri, handler|
- handler.decode_prologue
- end
-
- @parser.do_parse(string_or_readable)
-
- unless @parsestack.empty?
- raise FormatDecodeError.new("Unbalanced tag in XML.")
- end
-
- @handlers.each do |uri, handler|
- handler.decode_epilogue
- end
-
- @lastnode
- end
-
- def start_element(name, attrs)
- lastframe = @parsestack.last
- ns = parent = parent_encodingstyle = nil
- if lastframe
- ns = lastframe.ns.clone_ns
- parent = lastframe.node
- parent_encodingstyle = lastframe.encodingstyle
- else
- ns = XSD::NS.new
- parent = ParseFrame::NodeContainer.new(nil)
- parent_encodingstyle = nil
- end
-
- attrs = XSD::XMLParser.filter_ns(ns, attrs)
- encodingstyle = find_encodingstyle(ns, attrs)
-
- # Children's encodingstyle is derived from its parent.
- if encodingstyle.nil?
- if parent.node.is_a?(SOAPHeader)
- encodingstyle = LiteralNamespace
- else
- encodingstyle = parent_encodingstyle || @default_encodingstyle
- end
- end
-
- node = decode_tag(ns, name, attrs, parent, encodingstyle)
-
- @parsestack << ParseFrame.new(ns, name, node, encodingstyle)
- end
-
- def characters(text)
- lastframe = @parsestack.last
- if lastframe
- # Need not to be cloned because character does not have attr.
- decode_text(lastframe.ns, text, lastframe.encodingstyle)
- else
- # Ignore Text outside of SOAP Envelope.
- 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, lastframe.encodingstyle)
- @lastnode = lastframe.node.node
- end
-
-private
-
- def find_encodingstyle(ns, attrs)
- attrs.each do |key, value|
- if (ns.compare(@envelopenamespace, AttrEncodingStyle, key))
- return value
- end
- end
- nil
- end
-
- def decode_tag(ns, name, attrs, parent, encodingstyle)
- ele = ns.parse(name)
-
- # Envelope based parsing.
- if ((ele.namespace == @envelopenamespace) ||
- (@allow_unqualified_element && ele.namespace.nil?))
- o = decode_soap_envelope(ns, ele, attrs, parent)
- return o if o
- end
-
- # Encoding based parsing.
- handler = find_handler(encodingstyle)
- if handler
- return handler.decode_tag(ns, ele, attrs, parent)
- else
- raise FormatDecodeError.new("Unknown encodingStyle: #{ encodingstyle }.")
- end
- end
-
- def decode_tag_end(ns, node, encodingstyle)
- return unless encodingstyle
-
- handler = find_handler(encodingstyle)
- if handler
- return handler.decode_tag_end(ns, node)
- else
- raise FormatDecodeError.new("Unknown encodingStyle: #{ encodingstyle }.")
- end
- end
-
- def decode_text(ns, text, encodingstyle)
- handler = find_handler(encodingstyle)
-
- if handler
- handler.decode_text(ns, text)
- else
- # How should I do?
- end
- end
-
- def decode_soap_envelope(ns, ele, attrs, parent)
- o = nil
- if ele.name == EleEnvelope
- o = SOAPEnvelope.new
- if ext = @opt[:external_content]
- ext.each do |k, v|
- o.external_content[k] = v
- end
- end
- elsif ele.name == EleHeader
- unless parent.node.is_a?(SOAPEnvelope)
- raise FormatDecodeError.new("Header should be a child of Envelope.")
- end
- o = SOAPHeader.new
- parent.node.header = o
- elsif ele.name == EleBody
- unless parent.node.is_a?(SOAPEnvelope)
- raise FormatDecodeError.new("Body should be a child of Envelope.")
- end
- o = SOAPBody.new
- parent.node.body = o
- elsif ele.name == EleFault
- unless parent.node.is_a?(SOAPBody)
- raise FormatDecodeError.new("Fault should be a child of Body.")
- end
- o = SOAPFault.new
- parent.node.fault = o
- end
- o
- end
-
- def find_handler(encodingstyle)
- unless @handlers.key?(encodingstyle)
- handler_factory = SOAP::EncodingStyle::Handler.handler(encodingstyle) ||
- SOAP::EncodingStyle::Handler.handler(EncodingNamespace)
- handler = handler_factory.new(@parser.charset)
- handler.decode_typemap = @decode_typemap
- handler.decode_prologue
- @handlers[encodingstyle] = handler
- end
- @handlers[encodingstyle]
- end
-end
-
-
-end
diff --git a/lib/soap/processor.rb b/lib/soap/processor.rb
deleted file mode 100644
index 3c6dbedf2f..0000000000
--- a/lib/soap/processor.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-# SOAP4R - marshal/unmarshal interface.
-# 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/datatypes'
-require 'soap/soap'
-require 'soap/element'
-require 'soap/parser'
-require 'soap/generator'
-require 'soap/encodingstyle/soapHandler'
-require 'soap/encodingstyle/literalHandler'
-require 'soap/encodingstyle/aspDotNetHandler'
-
-
-module SOAP
-
-
-module Processor
- @@default_parser_option = {}
-
- class << self
- public
-
- def marshal(env, opt = {}, io = nil)
- generator = create_generator(opt)
- marshalled_str = generator.generate(env, io)
- unless env.external_content.empty?
- opt[:external_content] = env.external_content
- end
- marshalled_str
- end
-
- def unmarshal(stream, opt = {})
- parser = create_parser(opt)
- parser.parse(stream)
- end
-
- def default_parser_option=(rhs)
- @@default_parser_option = rhs
- end
-
- def default_parser_option
- @@default_parser_option
- end
-
- private
-
- def create_generator(opt)
- SOAPGenerator.new(opt)
- end
-
- def create_parser(opt)
- if opt.empty?
- opt = @@default_parser_option
- end
- ::SOAP::Parser.new(opt)
- end
- end
-end
-
-
-end
diff --git a/lib/soap/property.rb b/lib/soap/property.rb
deleted file mode 100644
index 0dc4551052..0000000000
--- a/lib/soap/property.rb
+++ /dev/null
@@ -1,333 +0,0 @@
-# soap/property.rb: SOAP4R - Property implementation.
-# 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.
-
-
-module SOAP
-
-
-# Property stream format:
-#
-# line separator is \r?\n. 1 line per a property.
-# line which begins with '#' is a comment line. empty line is ignored, too.
-# key/value separator is ':' or '='.
-# '\' as escape character. but line separator cannot be escaped.
-# \s at the head/tail of key/value are trimmed.
-#
-# '[' + key + ']' indicates property section. for example,
-#
-# [aaa.bbb]
-# ccc = ddd
-# eee.fff = ggg
-# []
-# aaa.hhh = iii
-#
-# is the same as;
-#
-# aaa.bbb.ccc = ddd
-# aaa.bbb.eee.fff = ggg
-# aaa.hhh = iii
-#
-class Property
- FrozenError = (RUBY_VERSION >= "1.9.0") ? RuntimeError : TypeError
-
- include Enumerable
-
- module Util
- def const_from_name(fqname)
- fqname.split("::").inject(Kernel) { |klass, name| klass.const_get(name) }
- end
- module_function :const_from_name
-
- def require_from_name(fqname)
- require File.join(fqname.split("::").collect { |ele| ele.downcase })
- end
- module_function :require_from_name
- end
-
- def self.load(stream)
- new.load(stream)
- end
-
- def self.loadproperty(propname)
- new.loadproperty(propname)
- end
-
- def initialize
- @store = Hash.new
- @hook = Hash.new
- @self_hook = Array.new
- @locked = false
- end
-
- KEY_REGSRC = '([^=:\\\\]*(?:\\\\.[^=:\\\\]*)*)'
- DEF_REGSRC = '\\s*' + KEY_REGSRC + '\\s*[=:]\\s*(.*)'
- COMMENT_REGEXP = Regexp.new('^(?:#.*|)$')
- CATDEF_REGEXP = Regexp.new("^\\[\\s*#{KEY_REGSRC}\\s*\\]$")
- LINE_REGEXP = Regexp.new("^#{DEF_REGSRC}$")
- def load(stream)
- key_prefix = ""
- stream.lines.each_with_index do |line, lineno|
- line.sub!(/\r?\n\z/, '')
- case line
- when COMMENT_REGEXP
- next
- when CATDEF_REGEXP
- key_prefix = $1.strip
- when LINE_REGEXP
- key, value = $1.strip, $2.strip
- key = "#{key_prefix}.#{key}" unless key_prefix.empty?
- key, value = loadstr(key), loadstr(value)
- self[key] = value
- else
- raise TypeError.new(
- "property format error at line #{lineno + 1}: `#{line}'")
- end
- end
- self
- end
-
- # find property from $:.
- def loadproperty(propname)
- return loadpropertyfile(propname) if File.file?(propname)
- $:.each do |path|
- if File.file?(file = File.join(path, propname))
- return loadpropertyfile(file)
- end
- end
- nil
- end
-
- # name: a Symbol, String or an Array
- def [](name)
- referent(name_to_a(name))
- end
-
- # name: a Symbol, String or an Array
- # value: an Object
- def []=(name, value)
- name_pair = name_to_a(name).freeze
- hooks = assign(name_pair, value)
- hooks.each do |hook|
- hook.call(name_pair, value)
- end
- value
- end
-
- # value: an Object
- # key is generated by property
- def <<(value)
- self[generate_new_key] = value
- end
-
- # name: a Symbol, String or an Array; nil means hook to the root
- # cascade: true/false; for cascading hook of sub key
- # hook: block which will be called with 2 args, name and value
- def add_hook(name = nil, cascade = false, &hook)
- if name == nil or name == true or name == false
- cascade = name
- assign_self_hook(cascade, &hook)
- else
- assign_hook(name_to_a(name), cascade, &hook)
- end
- end
-
- def each
- @store.each do |key, value|
- yield(key, value)
- end
- end
-
- def empty?
- @store.empty?
- end
-
- def keys
- @store.keys
- end
-
- def values
- @store.values
- end
-
- def lock(cascade = false)
- if cascade
- each_key do |key|
- key.lock(cascade)
- end
- end
- @locked = true
- self
- end
-
- def unlock(cascade = false)
- @locked = false
- if cascade
- each_key do |key|
- key.unlock(cascade)
- end
- end
- self
- end
-
- def locked?
- @locked
- end
-
-protected
-
- def deref_key(key)
- check_lock(key)
- ref = @store[key] ||= self.class.new
- unless propkey?(ref)
- raise ArgumentError.new("key `#{key}' already defined as a value")
- end
- ref
- end
-
- def local_referent(key)
- check_lock(key)
- if propkey?(@store[key]) and @store[key].locked?
- raise FrozenError.new("cannot split any key from locked property")
- end
- @store[key]
- end
-
- def local_assign(key, value)
- check_lock(key)
- if @locked
- if propkey?(value)
- raise FrozenError.new("cannot add any key to locked property")
- elsif propkey?(@store[key])
- raise FrozenError.new("cannot override any key in locked property")
- end
- end
- @store[key] = value
- end
-
- def local_hook(key, direct)
- hooks = []
- (@self_hook + (@hook[key] || NO_HOOK)).each do |hook, cascade|
- hooks << hook if direct or cascade
- end
- hooks
- end
-
- def local_assign_hook(key, cascade, &hook)
- check_lock(key)
- @store[key] ||= nil
- (@hook[key] ||= []) << [hook, cascade]
- end
-
-private
-
- NO_HOOK = [].freeze
-
- def referent(ary)
- ary[0..-2].inject(self) { |ref, name|
- ref.deref_key(to_key(name))
- }.local_referent(to_key(ary.last))
- end
-
- def assign(ary, value)
- ref = self
- hook = NO_HOOK
- ary[0..-2].each do |name|
- key = to_key(name)
- hook += ref.local_hook(key, false)
- ref = ref.deref_key(key)
- end
- last_key = to_key(ary.last)
- ref.local_assign(last_key, value)
- hook + ref.local_hook(last_key, true)
- end
-
- def assign_hook(ary, cascade, &hook)
- ary[0..-2].inject(self) { |ref, name|
- ref.deref_key(to_key(name))
- }.local_assign_hook(to_key(ary.last), cascade, &hook)
- end
-
- def assign_self_hook(cascade, &hook)
- check_lock(nil)
- @self_hook << [hook, cascade]
- end
-
- def each_key
- self.each do |key, value|
- if propkey?(value)
- yield(value)
- end
- end
- end
-
- def check_lock(key)
- if @locked and (key.nil? or !@store.key?(key))
- raise FrozenError.new("cannot add any key to locked property")
- end
- end
-
- def propkey?(value)
- value.is_a?(::SOAP::Property)
- end
-
- def name_to_a(name)
- case name
- when Symbol
- [name]
- when String
- name.scan(/[^.\\]+(?:\\.[^.\\])*/) # split with unescaped '.'
- when Array
- name
- else
- raise ArgumentError.new("Unknown name #{name}(#{name.class})")
- end
- end
-
- def to_key(name)
- name.to_s.downcase
- end
-
- def generate_new_key
- if @store.empty?
- "0"
- else
- (key_max + 1).to_s
- end
- end
-
- def key_max
- (@store.keys.max { |l, r| l.to_s.to_i <=> r.to_s.to_i }).to_s.to_i
- end
-
- def loadpropertyfile(file)
- puts "find property at #{file}" if $DEBUG
- File.open(file) do |f|
- load(f)
- end
- end
-
- def loadstr(str)
- str.gsub(/\\./) { |c| eval("\"#{c}\"") }
- end
-end
-
-
-end
-
-
-# for ruby/1.6.
-if RUBY_VERSION < "1.8" then
- module Enumerable
- def inject(init)
- result = init
- each do |item|
- result = yield(result, item)
- end
- result
- end
- end
-end
diff --git a/lib/soap/rpc/cgistub.rb b/lib/soap/rpc/cgistub.rb
deleted file mode 100644
index 487f05a9bf..0000000000
--- a/lib/soap/rpc/cgistub.rb
+++ /dev/null
@@ -1,206 +0,0 @@
-# SOAP4R - CGI/mod_ruby stub library
-# Copyright (C) 2001, 2003-2005 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 'soap/streamHandler'
-require 'webrick/httpresponse'
-require 'webrick/httpstatus'
-require 'logger'
-require 'soap/rpc/soaplet'
-
-
-module SOAP
-module RPC
-
-
-###
-# SYNOPSIS
-# CGIStub.new
-#
-# DESCRIPTION
-# To be written...
-#
-class CGIStub < Logger::Application
- include SOAP
- include WEBrick
-
- class SOAPRequest
- attr_reader :body
-
- def [](var); end
-
- def meta_vars; end
- end
-
- class SOAPStdinRequest < SOAPRequest
- attr_reader :body
-
- def initialize(stream)
- size = ENV['CONTENT_LENGTH'].to_i || 0
- @body = stream.read(size)
- end
-
- def [](var)
- ENV[var.gsub(/-/, '_').upcase]
- end
-
- def meta_vars
- {
- 'HTTP_SOAPACTION' => ENV['HTTP_SOAPAction']
- }
- end
- end
-
- class SOAPFCGIRequest < SOAPRequest
- attr_reader :body
-
- def initialize(request)
- @request = request
- @body = @request.in.read
- end
-
- def [](var)
- @request.env[var.gsub(/-/, '_').upcase]
- end
-
- def meta_vars
- {
- 'HTTP_SOAPACTION' => @request.env['HTTP_SOAPAction']
- }
- end
- end
-
- def initialize(appname, default_namespace)
- super(appname)
- set_log(STDERR)
- self.level = ERROR
- @default_namespace = default_namespace
- @remote_host = ENV['REMOTE_HOST'] || ENV['REMOTE_ADDR'] || 'unknown'
- @router = ::SOAP::RPC::Router.new(self.class.name)
- @soaplet = ::SOAP::RPC::SOAPlet.new(@router)
- on_init
- end
-
- def on_init
- # do extra initialization in a derived class if needed.
- end
-
- def mapping_registry
- @router.mapping_registry
- end
-
- def mapping_registry=(value)
- @router.mapping_registry = value
- end
-
- def generate_explicit_type
- @router.generate_explicit_type
- end
-
- def generate_explicit_type=(generate_explicit_type)
- @router.generate_explicit_type = generate_explicit_type
- end
-
- # servant entry interface
-
- def add_rpc_servant(obj, namespace = @default_namespace)
- @router.add_rpc_servant(obj, namespace)
- end
- alias add_servant add_rpc_servant
-
- def add_headerhandler(obj)
- @router.add_headerhandler(obj)
- end
- alias add_rpc_headerhandler add_headerhandler
-
- # method entry interface
-
- def add_rpc_method(obj, name, *param)
- add_rpc_method_with_namespace_as(@default_namespace, obj, name, name, *param)
- end
- alias add_method add_rpc_method
-
- def add_rpc_method_as(obj, name, name_as, *param)
- add_rpc_method_with_namespace_as(@default_namespace, obj, name, name_as, *param)
- end
- alias add_method_as add_rpc_method_as
-
- def add_rpc_method_with_namespace(namespace, obj, name, *param)
- add_rpc_method_with_namespace_as(namespace, obj, name, name, *param)
- end
- alias add_method_with_namespace add_rpc_method_with_namespace
-
- def add_rpc_method_with_namespace_as(namespace, obj, name, name_as, *param)
- qname = XSD::QName.new(namespace, name_as)
- soapaction = nil
- param_def = SOAPMethod.derive_rpc_param_def(obj, name, *param)
- @router.add_rpc_operation(obj, qname, soapaction, name, param_def)
- end
- alias add_method_with_namespace_as add_rpc_method_with_namespace_as
-
- def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
- @router.add_rpc_operation(receiver, qname, soapaction, name, param_def, opt)
- end
-
- def add_document_operation(receiver, soapaction, name, param_def, opt = {})
- @router.add_document_operation(receiver, soapaction, name, param_def, opt)
- end
-
- def set_fcgi_request(request)
- @fcgi = request
- end
-
-private
-
- HTTPVersion = WEBrick::HTTPVersion.new('1.0') # dummy; ignored
-
- def run
- res = WEBrick::HTTPResponse.new({:HTTPVersion => HTTPVersion})
- begin
- @log.info { "received a request from '#{ @remote_host }'" }
- if @fcgi
- req = SOAPFCGIRequest.new(@fcgi)
- else
- req = SOAPStdinRequest.new($stdin)
- end
- @soaplet.do_POST(req, res)
- rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex
- res.set_error(ex)
- rescue HTTPStatus::Error => ex
- res.set_error(ex)
- rescue HTTPStatus::Status => ex
- res.status = ex.code
- rescue StandardError, NameError => ex # for Ruby 1.6
- res.set_error(ex, true)
- ensure
- if defined?(MOD_RUBY)
- r = Apache.request
- r.status = res.status
- r.content_type = res.content_type
- r.send_http_header
- buf = res.body
- else
- buf = ''
- res.send_response(buf)
- buf.sub!(/^[^\r]+\r\n/, '') # Trim status line.
- end
- @log.debug { "SOAP CGI Response:\n#{ buf }" }
- if @fcgi
- @fcgi.out.print buf
- @fcgi.finish
- @fcgi = nil
- else
- print buf
- end
- end
- 0
- end
-end
-
-
-end
-end
diff --git a/lib/soap/rpc/driver.rb b/lib/soap/rpc/driver.rb
deleted file mode 100644
index 0fb4e82488..0000000000
--- a/lib/soap/rpc/driver.rb
+++ /dev/null
@@ -1,254 +0,0 @@
-# SOAP4R - SOAP RPC driver
-# Copyright (C) 2000, 2001, 2003-2005 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 'soap/soap'
-require 'soap/mapping'
-require 'soap/mapping/wsdlliteralregistry'
-require 'soap/rpc/rpc'
-require 'soap/rpc/proxy'
-require 'soap/rpc/element'
-require 'soap/streamHandler'
-require 'soap/property'
-require 'soap/header/handlerset'
-
-
-module SOAP
-module RPC
-
-
-class Driver
- class << self
- if RUBY_VERSION >= "1.7.0"
- def __attr_proxy(symbol, assignable = false)
- name = symbol.to_s
- define_method(name) {
- @proxy.__send__(name)
- }
- if assignable
- aname = name + '='
- define_method(aname) { |rhs|
- @proxy.__send__(aname, rhs)
- }
- end
- end
- else
- def __attr_proxy(symbol, assignable = false)
- name = symbol.to_s
- module_eval <<-EOS
- def #{name}
- @proxy.#{name}
- end
- EOS
- if assignable
- module_eval <<-EOS
- def #{name}=(value)
- @proxy.#{name} = value
- end
- EOS
- end
- end
- end
- end
-
- __attr_proxy :endpoint_url, true
- __attr_proxy :mapping_registry, true
- __attr_proxy :default_encodingstyle, true
- __attr_proxy :generate_explicit_type, true
- __attr_proxy :allow_unqualified_element, true
- __attr_proxy :headerhandler
- __attr_proxy :streamhandler
- __attr_proxy :test_loopback_response
- __attr_proxy :reset_stream
-
- attr_reader :proxy
- attr_reader :options
- attr_accessor :soapaction
-
- def inspect
- "#<#{self.class}:#{@proxy.inspect}>"
- end
-
- def httpproxy
- options["protocol.http.proxy"]
- end
-
- def httpproxy=(httpproxy)
- options["protocol.http.proxy"] = httpproxy
- end
-
- def wiredump_dev
- options["protocol.http.wiredump_dev"]
- end
-
- def wiredump_dev=(wiredump_dev)
- options["protocol.http.wiredump_dev"] = wiredump_dev
- end
-
- def mandatorycharset
- options["protocol.mandatorycharset"]
- end
-
- def mandatorycharset=(mandatorycharset)
- options["protocol.mandatorycharset"] = mandatorycharset
- end
-
- def wiredump_file_base
- options["protocol.wiredump_file_base"]
- end
-
- def wiredump_file_base=(wiredump_file_base)
- options["protocol.wiredump_file_base"] = wiredump_file_base
- end
-
- def initialize(endpoint_url, namespace = nil, soapaction = nil)
- @namespace = namespace
- @soapaction = soapaction
- @options = setup_options
- @wiredump_file_base = nil
- @proxy = Proxy.new(endpoint_url, @soapaction, @options)
- end
-
- def loadproperty(propertyname)
- unless options.loadproperty(propertyname)
- raise LoadError.new("No such property to load -- #{propertyname}")
- end
- end
-
- def add_rpc_method(name, *params)
- add_rpc_method_with_soapaction_as(name, name, @soapaction, *params)
- end
-
- def add_rpc_method_as(name, name_as, *params)
- add_rpc_method_with_soapaction_as(name, name_as, @soapaction, *params)
- end
-
- def add_rpc_method_with_soapaction(name, soapaction, *params)
- add_rpc_method_with_soapaction_as(name, name, soapaction, *params)
- end
-
- def add_rpc_method_with_soapaction_as(name, name_as, soapaction, *params)
- param_def = SOAPMethod.create_rpc_param_def(params)
- qname = XSD::QName.new(@namespace, name_as)
- @proxy.add_rpc_method(qname, soapaction, name, param_def)
- add_rpc_method_interface(name, param_def)
- end
-
- # add_method is for shortcut of typical rpc/encoded method definition.
- alias add_method add_rpc_method
- alias add_method_as add_rpc_method_as
- alias add_method_with_soapaction add_rpc_method_with_soapaction
- alias add_method_with_soapaction_as add_rpc_method_with_soapaction_as
-
- def add_document_method(name, soapaction, req_qname, res_qname)
- param_def = SOAPMethod.create_doc_param_def(req_qname, res_qname)
- @proxy.add_document_method(soapaction, name, param_def)
- add_document_method_interface(name, param_def)
- end
-
- def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
- @proxy.add_rpc_operation(qname, soapaction, name, param_def, opt)
- add_rpc_method_interface(name, param_def)
- end
-
- def add_document_operation(soapaction, name, param_def, opt = {})
- @proxy.add_document_operation(soapaction, name, param_def, opt)
- add_document_method_interface(name, param_def)
- end
-
- def invoke(headers, body)
- if headers and !headers.is_a?(SOAPHeader)
- headers = create_header(headers)
- end
- set_wiredump_file_base(body.elename.name)
- env = @proxy.invoke(headers, body)
- if env.nil?
- return nil, nil
- else
- return env.header, env.body
- end
- end
-
- def call(name, *params)
- set_wiredump_file_base(name)
- @proxy.call(name, *params)
- end
-
-private
-
- def set_wiredump_file_base(name)
- if @wiredump_file_base
- @proxy.set_wiredump_file_base("#{@wiredump_file_base}_#{name}")
- end
- end
-
- def create_header(headers)
- header = SOAPHeader.new()
- headers.each do |content, mustunderstand, encodingstyle|
- header.add(SOAPHeaderItem.new(content, mustunderstand, encodingstyle))
- end
- header
- end
-
- def setup_options
- if opt = Property.loadproperty(::SOAP::PropertyName)
- opt = opt["client"]
- end
- opt ||= Property.new
- opt.add_hook("protocol.mandatorycharset") do |key, value|
- @proxy.mandatorycharset = value
- end
- opt.add_hook("protocol.wiredump_file_base") do |key, value|
- @wiredump_file_base = value
- end
- opt["protocol.http.charset"] ||= XSD::Charset.xml_encoding_label
- opt["protocol.http.proxy"] ||= Env::HTTP_PROXY
- opt["protocol.http.no_proxy"] ||= Env::NO_PROXY
- opt
- end
-
- def add_rpc_method_interface(name, param_def)
- param_count = RPC::SOAPMethod.param_count(param_def,
- RPC::SOAPMethod::IN, RPC::SOAPMethod::INOUT)
- add_method_interface(name, param_count)
- end
-
- def add_document_method_interface(name, param_def)
- param_count = RPC::SOAPMethod.param_count(param_def, RPC::SOAPMethod::IN)
- add_method_interface(name, param_count)
- end
-
- if RUBY_VERSION > "1.7.0"
- def add_method_interface(name, param_count)
- ::SOAP::Mapping.define_singleton_method(self, name) do |*arg|
- unless arg.size == param_count
- raise ArgumentError.new(
- "wrong number of arguments (#{arg.size} for #{param_count})")
- end
- call(name, *arg)
- end
- self.method(name)
- end
- else
- def add_method_interface(name, param_count)
- instance_eval <<-EOS
- def #{name}(*arg)
- unless arg.size == #{param_count}
- raise ArgumentError.new(
- "wrong number of arguments (\#{arg.size} for #{param_count})")
- end
- call(#{name.dump}, *arg)
- end
- EOS
- self.method(name)
- end
- end
-end
-
-
-end
-end
diff --git a/lib/soap/rpc/element.rb b/lib/soap/rpc/element.rb
deleted file mode 100644
index c224b03d0d..0000000000
--- a/lib/soap/rpc/element.rb
+++ /dev/null
@@ -1,325 +0,0 @@
-# SOAP4R - RPC element definition.
-# Copyright (C) 2000, 2001, 2003, 2005 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 'soap/baseData'
-
-
-module SOAP
-
-# Add method definitions for RPC to common definition in element.rb
-class SOAPBody < SOAPStruct
- public
-
- def request
- root_node
- end
-
- def response
- root = root_node
- if !@is_fault
- if root.nil?
- nil
- elsif root.is_a?(SOAPBasetype)
- root
- else
- # Initial element is [retval].
- root[0]
- end
- else
- root
- end
- end
-
- def outparams
- root = root_node
- if !@is_fault and !root.nil? and !root.is_a?(SOAPBasetype)
- op = root[1..-1]
- op = nil if op && op.empty?
- op
- else
- nil
- end
- end
-
- def fault
- if @is_fault
- self['fault']
- else
- nil
- end
- end
-
- def fault=(fault)
- @is_fault = true
- add_member('fault', fault)
- end
-end
-
-
-module RPC
-
-
-class RPCError < Error; end
-class MethodDefinitionError < RPCError; end
-class ParameterError < RPCError; end
-
-class SOAPMethod < SOAPStruct
- RETVAL = 'retval'
- IN = 'in'
- OUT = 'out'
- INOUT = 'inout'
-
- attr_reader :param_def
- attr_reader :inparam
- attr_reader :outparam
- attr_reader :retval_name
- attr_reader :retval_class_name
-
- def initialize(qname, param_def = nil)
- super(nil)
- @elename = qname
- @encodingstyle = nil
-
- @param_def = param_def
-
- @signature = []
- @inparam_names = []
- @inoutparam_names = []
- @outparam_names = []
-
- @inparam = {}
- @outparam = {}
- @retval_name = nil
- @retval_class_name = nil
-
- init_param(@param_def) if @param_def
- end
-
- def have_outparam?
- @outparam_names.size > 0
- end
-
- def input_params
- collect_params(IN, INOUT)
- end
-
- def output_params
- collect_params(OUT, INOUT)
- end
-
- def set_param(params)
- params.each do |param, data|
- @inparam[param] = data
- data.elename.name = param
- data.parent = self
- end
- end
-
- def set_outparam(params)
- params.each do |param, data|
- @outparam[param] = data
- data.elename.name = param
- end
- end
-
- def SOAPMethod.param_count(param_def, *type)
- count = 0
- param_def.each do |io_type, name, param_type|
- if type.include?(io_type)
- count += 1
- end
- end
- count
- end
-
- def SOAPMethod.derive_rpc_param_def(obj, name, *param)
- if param.size == 1 and param[0].is_a?(Array)
- return param[0]
- end
- if param.empty?
- method = obj.method(name)
- param_names = (1..method.arity.abs).collect { |i| "p#{i}" }
- else
- param_names = param
- end
- create_rpc_param_def(param_names)
- end
-
- def SOAPMethod.create_rpc_param_def(param_names)
- param_def = []
- param_names.each do |param_name|
- param_def.push([IN, param_name, nil])
- end
- param_def.push([RETVAL, 'return', nil])
- param_def
- end
-
- def SOAPMethod.create_doc_param_def(req_qnames, res_qnames)
- req_qnames = [req_qnames] if req_qnames.is_a?(XSD::QName)
- res_qnames = [res_qnames] if res_qnames.is_a?(XSD::QName)
- param_def = []
- req_qnames.each do |qname|
- param_def << [IN, qname.name, [nil, qname.namespace, qname.name]]
- end
- res_qnames.each do |qname|
- param_def << [OUT, qname.name, [nil, qname.namespace, qname.name]]
- end
- param_def
- end
-
-private
-
- def collect_params(*type)
- names = []
- @signature.each do |io_type, name, param_type|
- names << name if type.include?(io_type)
- end
- names
- end
-
- def init_param(param_def)
- param_def.each do |io_type, name, param_type|
- case io_type
- when IN
- @signature.push([IN, name, param_type])
- @inparam_names.push(name)
- when OUT
- @signature.push([OUT, name, param_type])
- @outparam_names.push(name)
- when INOUT
- @signature.push([INOUT, name, param_type])
- @inoutparam_names.push(name)
- when RETVAL
- if @retval_name
- raise MethodDefinitionError.new('duplicated retval')
- end
- @retval_name = name
- @retval_class_name = nil
- if param_type
- if param_type[0].is_a?(String)
- @retval_class_name = Mapping.class_from_name(param_type[0])
- else
- @retval_class_name = param_type[0]
- end
- end
- else
- raise MethodDefinitionError.new("unknown type: #{io_type}")
- end
- end
- end
-end
-
-
-class SOAPMethodRequest < SOAPMethod
- attr_accessor :soapaction
-
- def SOAPMethodRequest.create_request(qname, *params)
- param_def = []
- param_value = []
- i = 0
- params.each do |param|
- param_name = "p#{i}"
- i += 1
- param_def << [IN, param_name, nil]
- param_value << [param_name, param]
- end
- param_def << [RETVAL, 'return', nil]
- o = new(qname, param_def)
- o.set_param(param_value)
- o
- end
-
- def initialize(qname, param_def = nil, soapaction = nil)
- check_elename(qname)
- super(qname, param_def)
- @soapaction = soapaction
- end
-
- def each
- input_params.each do |name|
- unless @inparam[name]
- raise ParameterError.new("parameter: #{name} was not given")
- end
- yield(name, @inparam[name])
- end
- end
-
- def dup
- req = self.class.new(@elename.dup, @param_def, @soapaction)
- req.encodingstyle = @encodingstyle
- req
- end
-
- def create_method_response(response_name = nil)
- response_name ||=
- XSD::QName.new(@elename.namespace, @elename.name + 'Response')
- SOAPMethodResponse.new(response_name, @param_def)
- end
-
-private
-
- def check_elename(qname)
- # NCName & ruby's method name
- unless /\A[\w_][\w\d_\-]*\z/ =~ qname.name
- raise MethodDefinitionError.new("element name '#{qname.name}' not allowed")
- end
- end
-end
-
-
-class SOAPMethodResponse < SOAPMethod
-
- def initialize(qname, param_def = nil)
- super(qname, param_def)
- @retval = nil
- end
-
- def retval=(retval)
- @retval = retval
- @retval.elename = @retval.elename.dup_name(@retval_name || 'return')
- retval.parent = self
- retval
- end
-
- def each
- if @retval_name and !@retval.is_a?(SOAPVoid)
- yield(@retval_name, @retval)
- end
-
- output_params.each do |name|
- unless @outparam[name]
- raise ParameterError.new("parameter: #{name} was not given")
- end
- yield(name, @outparam[name])
- end
- end
-end
-
-
-# To return(?) void explicitly.
-# def foo(input_var)
-# ...
-# return SOAP::RPC::SOAPVoid.new
-# end
-class SOAPVoid < XSD::XSDAnySimpleType
- include SOAPBasetype
- extend SOAPModuleUtils
- Name = XSD::QName.new(Mapping::RubyCustomTypeNamespace, nil)
-
-public
- def initialize()
- @elename = Name
- @id = nil
- @precedents = []
- @parent = nil
- end
-end
-
-
-end
-end
diff --git a/lib/soap/rpc/httpserver.rb b/lib/soap/rpc/httpserver.rb
deleted file mode 100644
index 6d2a72ebe3..0000000000
--- a/lib/soap/rpc/httpserver.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-# SOAP4R - WEBrick HTTP Server
-# Copyright (C) 2003, 2004 by 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 'logger'
-require 'soap/rpc/soaplet'
-require 'soap/streamHandler'
-require 'webrick'
-
-
-module SOAP
-module RPC
-
-
-class HTTPServer < Logger::Application
- attr_reader :server
- attr_accessor :default_namespace
-
- def initialize(config)
- super(config[:SOAPHTTPServerApplicationName] || self.class.name)
- @default_namespace = config[:SOAPDefaultNamespace]
- @webrick_config = config.dup
- self.level = Logger::Severity::ERROR # keep silent by default
- @webrick_config[:Logger] ||= @log
- @log = @webrick_config[:Logger] # sync logger of App and HTTPServer
- @router = ::SOAP::RPC::Router.new(self.class.name)
- @soaplet = ::SOAP::RPC::SOAPlet.new(@router)
- on_init
- @server = WEBrick::HTTPServer.new(@webrick_config)
- @server.mount('/', @soaplet)
- end
-
- def on_init
- # do extra initialization in a derived class if needed.
- end
-
- def status
- @server.status if @server
- end
-
- def shutdown
- @server.shutdown if @server
- end
-
- def mapping_registry
- @router.mapping_registry
- end
-
- def mapping_registry=(mapping_registry)
- @router.mapping_registry = mapping_registry
- end
-
- def generate_explicit_type
- @router.generate_explicit_type
- end
-
- def generate_explicit_type=(generate_explicit_type)
- @router.generate_explicit_type = generate_explicit_type
- end
-
- # servant entry interface
-
- def add_rpc_request_servant(factory, namespace = @default_namespace)
- @router.add_rpc_request_servant(factory, namespace)
- end
-
- def add_rpc_servant(obj, namespace = @default_namespace)
- @router.add_rpc_servant(obj, namespace)
- end
-
- def add_request_headerhandler(factory)
- @router.add_request_headerhandler(factory)
- end
-
- def add_headerhandler(obj)
- @router.add_headerhandler(obj)
- end
- alias add_rpc_headerhandler add_headerhandler
-
- # method entry interface
-
- def add_rpc_method(obj, name, *param)
- add_rpc_method_as(obj, name, name, *param)
- end
- alias add_method add_rpc_method
-
- def add_rpc_method_as(obj, name, name_as, *param)
- qname = XSD::QName.new(@default_namespace, name_as)
- soapaction = nil
- param_def = SOAPMethod.derive_rpc_param_def(obj, name, *param)
- @router.add_rpc_operation(obj, qname, soapaction, name, param_def)
- end
- alias add_method_as add_rpc_method_as
-
- def add_document_method(obj, soapaction, name, req_qnames, res_qnames)
- param_def = SOAPMethod.create_doc_param_def(req_qnames, res_qnames)
- @router.add_document_operation(obj, soapaction, name, param_def)
- end
-
- def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
- @router.add_rpc_operation(receiver, qname, soapaction, name, param_def, opt)
- end
-
- def add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {})
- @router.add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt)
- end
-
- def add_document_operation(receiver, soapaction, name, param_def, opt = {})
- @router.add_document_operation(receiver, soapaction, name, param_def, opt)
- end
-
- def add_document_request_operation(factory, soapaction, name, param_def, opt = {})
- @router.add_document_request_operation(factory, soapaction, name, param_def, opt)
- end
-
-private
-
- def run
- @server.start
- end
-end
-
-
-end
-end
diff --git a/lib/soap/rpc/proxy.rb b/lib/soap/rpc/proxy.rb
deleted file mode 100644
index 0797c70884..0000000000
--- a/lib/soap/rpc/proxy.rb
+++ /dev/null
@@ -1,502 +0,0 @@
-# SOAP4R - RPC Proxy library.
-# Copyright (C) 2000, 2003-2005 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 'soap/soap'
-require 'soap/processor'
-require 'soap/mapping'
-require 'soap/rpc/rpc'
-require 'soap/rpc/element'
-require 'soap/streamHandler'
-require 'soap/mimemessage'
-
-
-module SOAP
-module RPC
-
-
-class Proxy
- include SOAP
-
-public
-
- attr_accessor :soapaction
- attr_accessor :mandatorycharset
- attr_accessor :allow_unqualified_element
- attr_accessor :default_encodingstyle
- attr_accessor :generate_explicit_type
- attr_reader :headerhandler
- attr_reader :streamhandler
-
- attr_accessor :mapping_registry
- attr_accessor :literal_mapping_registry
-
- attr_reader :operation
-
- def initialize(endpoint_url, soapaction, options)
- @endpoint_url = endpoint_url
- @soapaction = soapaction
- @options = options
- @streamhandler = HTTPStreamHandler.new(
- @options["protocol.http"] ||= ::SOAP::Property.new)
- @operation = {}
- @mandatorycharset = nil
- @allow_unqualified_element = true
- @default_encodingstyle = nil
- @generate_explicit_type = true
- @headerhandler = Header::HandlerSet.new
- @mapping_registry = nil
- @literal_mapping_registry = ::SOAP::Mapping::WSDLLiteralRegistry.new
- end
-
- def inspect
- "#<#{self.class}:#{@endpoint_url}>"
- end
-
- def endpoint_url
- @endpoint_url
- end
-
- def endpoint_url=(endpoint_url)
- @endpoint_url = endpoint_url
- reset_stream
- end
-
- def reset_stream
- @streamhandler.reset(@endpoint_url)
- end
-
- def set_wiredump_file_base(wiredump_file_base)
- @streamhandler.wiredump_file_base = wiredump_file_base
- end
-
- def test_loopback_response
- @streamhandler.test_loopback_response
- end
-
- def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
- opt[:request_qname] = qname
- opt[:request_style] ||= :rpc
- opt[:response_style] ||= :rpc
- opt[:request_use] ||= :encoded
- opt[:response_use] ||= :encoded
- @operation[name] = Operation.new(soapaction, param_def, opt)
- end
-
- def add_document_operation(soapaction, name, param_def, opt = {})
- opt[:request_style] ||= :document
- opt[:response_style] ||= :document
- opt[:request_use] ||= :literal
- opt[:response_use] ||= :literal
- # default values of these values are unqualified in XML Schema.
- # set true for backward compatibility.
- unless opt.key?(:elementformdefault)
- opt[:elementformdefault] = true
- end
- unless opt.key?(:attributeformdefault)
- opt[:attributeformdefault] = true
- end
- @operation[name] = Operation.new(soapaction, param_def, opt)
- end
-
- # add_method is for shortcut of typical rpc/encoded method definition.
- alias add_method add_rpc_operation
- alias add_rpc_method add_rpc_operation
- alias add_document_method add_document_operation
-
- def invoke(req_header, req_body, opt = nil)
- opt ||= create_encoding_opt
- route(req_header, req_body, opt, opt)
- end
-
- def call(name, *params)
- unless op_info = @operation[name]
- raise MethodDefinitionError, "method: #{name} not defined"
- end
- mapping_opt = create_mapping_opt
- req_header = create_request_header
- req_body = SOAPBody.new(
- op_info.request_body(params, @mapping_registry,
- @literal_mapping_registry, mapping_opt)
- )
- reqopt = create_encoding_opt(
- :soapaction => op_info.soapaction || @soapaction,
- :envelopenamespace => @options["soap.envelope.requestnamespace"],
- :default_encodingstyle =>
- @default_encodingstyle || op_info.request_default_encodingstyle,
- :elementformdefault => op_info.elementformdefault,
- :attributeformdefault => op_info.attributeformdefault
- )
- resopt = create_encoding_opt(
- :envelopenamespace => @options["soap.envelope.responsenamespace"],
- :default_encodingstyle =>
- @default_encodingstyle || op_info.response_default_encodingstyle,
- :elementformdefault => op_info.elementformdefault,
- :attributeformdefault => op_info.attributeformdefault
- )
- env = route(req_header, req_body, reqopt, resopt)
- raise EmptyResponseError unless env
- receive_headers(env.header)
- begin
- check_fault(env.body)
- rescue ::SOAP::FaultError => e
- op_info.raise_fault(e, @mapping_registry, @literal_mapping_registry)
- end
- op_info.response_obj(env.body, @mapping_registry,
- @literal_mapping_registry, mapping_opt)
- end
-
- def route(req_header, req_body, reqopt, resopt)
- req_env = ::SOAP::SOAPEnvelope.new(req_header, req_body)
- unless reqopt[:envelopenamespace].nil?
- set_envelopenamespace(req_env, reqopt[:envelopenamespace])
- end
- reqopt[:external_content] = nil
- conn_data = marshal(req_env, reqopt)
- if ext = reqopt[:external_content]
- mime = MIMEMessage.new
- ext.each do |k, v|
- mime.add_attachment(v.data)
- end
- mime.add_part(conn_data.send_string + "\r\n")
- mime.close
- conn_data.send_string = mime.content_str
- conn_data.send_contenttype = mime.headers['content-type'].str
- end
- conn_data = @streamhandler.send(@endpoint_url, conn_data,
- reqopt[:soapaction])
- if conn_data.receive_string.empty?
- return nil
- end
- unmarshal(conn_data, resopt)
- end
-
- def check_fault(body)
- if body.fault
- raise SOAP::FaultError.new(body.fault)
- end
- end
-
-private
-
- def set_envelopenamespace(env, namespace)
- env.elename = XSD::QName.new(namespace, env.elename.name)
- if env.header
- env.header.elename = XSD::QName.new(namespace, env.header.elename.name)
- end
- if env.body
- env.body.elename = XSD::QName.new(namespace, env.body.elename.name)
- end
- end
-
- def create_request_header
- headers = @headerhandler.on_outbound
- if headers.empty?
- nil
- else
- h = ::SOAP::SOAPHeader.new
- headers.each do |header|
- h.add(header.elename.name, header)
- end
- h
- end
- end
-
- def receive_headers(headers)
- @headerhandler.on_inbound(headers) if headers
- end
-
- def marshal(env, opt)
- send_string = Processor.marshal(env, opt)
- StreamHandler::ConnectionData.new(send_string)
- end
-
- def unmarshal(conn_data, opt)
- contenttype = conn_data.receive_contenttype
- if /#{MIMEMessage::MultipartContentType}/i =~ contenttype
- opt[:external_content] = {}
- mime = MIMEMessage.parse("Content-Type: " + contenttype,
- conn_data.receive_string)
- mime.parts.each do |part|
- value = Attachment.new(part.content)
- value.contentid = part.contentid
- obj = SOAPAttachment.new(value)
- opt[:external_content][value.contentid] = obj if value.contentid
- end
- opt[:charset] = @mandatorycharset ||
- StreamHandler.parse_media_type(mime.root.headers['content-type'].str)
- env = Processor.unmarshal(mime.root.content, opt)
- else
- opt[:charset] = @mandatorycharset ||
- ::SOAP::StreamHandler.parse_media_type(contenttype)
- env = Processor.unmarshal(conn_data.receive_string, opt)
- end
- unless env.is_a?(::SOAP::SOAPEnvelope)
- raise ResponseFormatError.new(
- "response is not a SOAP envelope: #{conn_data.receive_string}")
- end
- env
- end
-
- def create_header(headers)
- header = SOAPHeader.new()
- headers.each do |content, mustunderstand, encodingstyle|
- header.add(SOAPHeaderItem.new(content, mustunderstand, encodingstyle))
- end
- header
- end
-
- def create_encoding_opt(hash = nil)
- opt = {}
- opt[:default_encodingstyle] = @default_encodingstyle
- opt[:allow_unqualified_element] = @allow_unqualified_element
- opt[:generate_explicit_type] = @generate_explicit_type
- opt[:no_indent] = @options["soap.envelope.no_indent"]
- opt[:use_numeric_character_reference] =
- @options["soap.envelope.use_numeric_character_reference"]
- opt.update(hash) if hash
- opt
- end
-
- def create_mapping_opt(hash = nil)
- opt = {
- :external_ces => @options["soap.mapping.external_ces"]
- }
- opt.update(hash) if hash
- opt
- end
-
- class Operation
- attr_reader :soapaction
- attr_reader :request_style
- attr_reader :response_style
- attr_reader :request_use
- attr_reader :response_use
- attr_reader :elementformdefault
- attr_reader :attributeformdefault
-
- def initialize(soapaction, param_def, opt)
- @soapaction = soapaction
- @request_style = opt[:request_style]
- @response_style = opt[:response_style]
- @request_use = opt[:request_use]
- @response_use = opt[:response_use]
- # set nil(unqualified) by default
- @elementformdefault = opt[:elementformdefault]
- @attributeformdefault = opt[:attributeformdefault]
- check_style(@request_style)
- check_style(@response_style)
- check_use(@request_use)
- check_use(@response_use)
- if @request_style == :rpc
- @rpc_request_qname = opt[:request_qname]
- if @rpc_request_qname.nil?
- raise MethodDefinitionError.new("rpc_request_qname must be given")
- end
- @rpc_method_factory =
- RPC::SOAPMethodRequest.new(@rpc_request_qname, param_def, @soapaction)
- else
- @doc_request_qnames = []
- @doc_request_qualified = []
- @doc_response_qnames = []
- @doc_response_qualified = []
- param_def.each do |inout, paramname, typeinfo, eleinfo|
- klass_not_used, nsdef, namedef = typeinfo
- qualified = eleinfo
- if namedef.nil?
- raise MethodDefinitionError.new("qname must be given")
- end
- case inout
- when SOAPMethod::IN
- @doc_request_qnames << XSD::QName.new(nsdef, namedef)
- @doc_request_qualified << qualified
- when SOAPMethod::OUT
- @doc_response_qnames << XSD::QName.new(nsdef, namedef)
- @doc_response_qualified << qualified
- else
- raise MethodDefinitionError.new(
- "illegal inout definition for document style: #{inout}")
- end
- end
- end
- end
-
- def request_default_encodingstyle
- (@request_use == :encoded) ? EncodingNamespace : LiteralNamespace
- end
-
- def response_default_encodingstyle
- (@response_use == :encoded) ? EncodingNamespace : LiteralNamespace
- end
-
- def request_body(values, mapping_registry, literal_mapping_registry, opt)
- if @request_style == :rpc
- request_rpc(values, mapping_registry, literal_mapping_registry, opt)
- else
- request_doc(values, mapping_registry, literal_mapping_registry, opt)
- end
- end
-
- def response_obj(body, mapping_registry, literal_mapping_registry, opt)
- if @response_style == :rpc
- response_rpc(body, mapping_registry, literal_mapping_registry, opt)
- else
- ret = response_doc(body, mapping_registry, literal_mapping_registry, opt)
- if ret.size == 1
- ret[0]
- else
- ret
- end
- end
- end
-
- def raise_fault(e, mapping_registry, literal_mapping_registry)
- if @response_style == :rpc
- Mapping.fault2exception(e, mapping_registry)
- else
- Mapping.fault2exception(e, literal_mapping_registry)
- end
- end
-
- private
-
- def check_style(style)
- unless [:rpc, :document].include?(style)
- raise MethodDefinitionError.new("unknown style: #{style}")
- end
- end
-
- def check_use(use)
- unless [:encoded, :literal].include?(use)
- raise MethodDefinitionError.new("unknown use: #{use}")
- end
- end
-
- def request_rpc(values, mapping_registry, literal_mapping_registry, opt)
- if @request_use == :encoded
- request_rpc_enc(values, mapping_registry, opt)
- else
- request_rpc_lit(values, literal_mapping_registry, opt)
- end
- end
-
- def request_doc(values, mapping_registry, literal_mapping_registry, opt)
- if @request_use == :encoded
- request_doc_enc(values, mapping_registry, opt)
- else
- request_doc_lit(values, literal_mapping_registry, opt)
- end
- end
-
- def request_rpc_enc(values, mapping_registry, opt)
- method = @rpc_method_factory.dup
- names = method.input_params
- obj = create_request_obj(names, values)
- soap = Mapping.obj2soap(obj, mapping_registry, @rpc_request_qname, opt)
- method.set_param(soap)
- method
- end
-
- def request_rpc_lit(values, mapping_registry, opt)
- method = @rpc_method_factory.dup
- params = {}
- idx = 0
- method.input_params.each do |name|
- params[name] = Mapping.obj2soap(values[idx], mapping_registry,
- XSD::QName.new(nil, name), opt)
- idx += 1
- end
- method.set_param(params)
- method
- end
-
- def request_doc_enc(values, mapping_registry, opt)
- (0...values.size).collect { |idx|
- ele = Mapping.obj2soap(values[idx], mapping_registry, nil, opt)
- ele.elename = @doc_request_qnames[idx]
- ele
- }
- end
-
- def request_doc_lit(values, mapping_registry, opt)
- (0...values.size).collect { |idx|
- ele = Mapping.obj2soap(values[idx], mapping_registry,
- @doc_request_qnames[idx], opt)
- ele.encodingstyle = LiteralNamespace
- if ele.respond_to?(:qualified)
- ele.qualified = @doc_request_qualified[idx]
- end
- ele
- }
- end
-
- def response_rpc(body, mapping_registry, literal_mapping_registry, opt)
- if @response_use == :encoded
- response_rpc_enc(body, mapping_registry, opt)
- else
- response_rpc_lit(body, literal_mapping_registry, opt)
- end
- end
-
- def response_doc(body, mapping_registry, literal_mapping_registry, opt)
- if @response_use == :encoded
- return response_doc_enc(body, mapping_registry, opt)
- else
- return response_doc_lit(body, literal_mapping_registry, opt)
- end
- end
-
- def response_rpc_enc(body, mapping_registry, opt)
- ret = nil
- if body.response
- ret = Mapping.soap2obj(body.response, mapping_registry,
- @rpc_method_factory.retval_class_name, opt)
- end
- if body.outparams
- outparams = body.outparams.collect { |outparam|
- Mapping.soap2obj(outparam, mapping_registry, nil, opt)
- }
- [ret].concat(outparams)
- else
- ret
- end
- end
-
- def response_rpc_lit(body, mapping_registry, opt)
- body.root_node.collect { |key, value|
- Mapping.soap2obj(value, mapping_registry,
- @rpc_method_factory.retval_class_name, opt)
- }
- end
-
- def response_doc_enc(body, mapping_registry, opt)
- body.collect { |key, value|
- Mapping.soap2obj(value, mapping_registry, nil, opt)
- }
- end
-
- def response_doc_lit(body, mapping_registry, opt)
- body.collect { |key, value|
- Mapping.soap2obj(value, mapping_registry)
- }
- end
-
- def create_request_obj(names, params)
- o = Object.new
- idx = 0
- while idx < params.length
- o.instance_variable_set('@' + names[idx], params[idx])
- idx += 1
- end
- o
- end
- end
-end
-
-
-end
-end
diff --git a/lib/soap/rpc/router.rb b/lib/soap/rpc/router.rb
deleted file mode 100644
index 71c6eb625b..0000000000
--- a/lib/soap/rpc/router.rb
+++ /dev/null
@@ -1,594 +0,0 @@
-# SOAP4R - RPC Routing library
-# Copyright (C) 2001, 2002, 2004, 2005 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 'soap/soap'
-require 'soap/processor'
-require 'soap/mapping'
-require 'soap/mapping/wsdlliteralregistry'
-require 'soap/rpc/rpc'
-require 'soap/rpc/element'
-require 'soap/streamHandler'
-require 'soap/mimemessage'
-require 'soap/header/handlerset'
-
-
-module SOAP
-module RPC
-
-
-class Router
- include SOAP
-
- attr_reader :actor
- attr_accessor :mapping_registry
- attr_accessor :literal_mapping_registry
- attr_accessor :generate_explicit_type
- attr_accessor :external_ces
-
- def initialize(actor)
- @actor = actor
- @mapping_registry = nil
- @headerhandler = Header::HandlerSet.new
- @literal_mapping_registry = ::SOAP::Mapping::WSDLLiteralRegistry.new
- @generate_explicit_type = true
- @external_ces = nil
- @operation_by_soapaction = {}
- @operation_by_qname = {}
- @headerhandlerfactory = []
- end
-
- ###
- ## header handler interface
- #
- def add_request_headerhandler(factory)
- unless factory.respond_to?(:create)
- raise TypeError.new("factory must respond to 'create'")
- end
- @headerhandlerfactory << factory
- end
-
- def add_headerhandler(handler)
- @headerhandler.add(handler)
- end
-
- ###
- ## servant definition interface
- #
- def add_rpc_request_servant(factory, namespace)
- unless factory.respond_to?(:create)
- raise TypeError.new("factory must respond to 'create'")
- end
- obj = factory.create # a dummy instance for introspection
- ::SOAP::RPC.defined_methods(obj).each do |name|
- begin
- qname = XSD::QName.new(namespace, name)
- param_def = ::SOAP::RPC::SOAPMethod.derive_rpc_param_def(obj, name)
- opt = create_styleuse_option(:rpc, :encoded)
- add_rpc_request_operation(factory, qname, nil, name, param_def, opt)
- rescue SOAP::RPC::MethodDefinitionError => e
- p e if $DEBUG
- end
- end
- end
-
- def add_rpc_servant(obj, namespace)
- ::SOAP::RPC.defined_methods(obj).each do |name|
- begin
- qname = XSD::QName.new(namespace, name)
- param_def = ::SOAP::RPC::SOAPMethod.derive_rpc_param_def(obj, name)
- opt = create_styleuse_option(:rpc, :encoded)
- add_rpc_operation(obj, qname, nil, name, param_def, opt)
- rescue SOAP::RPC::MethodDefinitionError => e
- p e if $DEBUG
- end
- end
- end
- alias add_servant add_rpc_servant
-
- ###
- ## operation definition interface
- #
- def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
- ensure_styleuse_option(opt, :rpc, :encoded)
- opt[:request_qname] = qname
- op = ApplicationScopeOperation.new(soapaction, receiver, name, param_def,
- opt)
- if opt[:request_style] != :rpc
- raise RPCRoutingError.new("illegal request_style given")
- end
- assign_operation(soapaction, qname, op)
- end
- alias add_method add_rpc_operation
- alias add_rpc_method add_rpc_operation
-
- def add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {})
- ensure_styleuse_option(opt, :rpc, :encoded)
- opt[:request_qname] = qname
- op = RequestScopeOperation.new(soapaction, factory, name, param_def, opt)
- if opt[:request_style] != :rpc
- raise RPCRoutingError.new("illegal request_style given")
- end
- assign_operation(soapaction, qname, op)
- end
-
- def add_document_operation(receiver, soapaction, name, param_def, opt = {})
- #
- # adopt workaround for doc/lit wrapper method
- # (you should consider to simply use rpc/lit service)
- #
- #unless soapaction
- # raise RPCRoutingError.new("soapaction is a must for document method")
- #end
- ensure_styleuse_option(opt, :document, :literal)
- op = ApplicationScopeOperation.new(soapaction, receiver, name, param_def,
- opt)
- if opt[:request_style] != :document
- raise RPCRoutingError.new("illegal request_style given")
- end
- assign_operation(soapaction, first_input_part_qname(param_def), op)
- end
- alias add_document_method add_document_operation
-
- def add_document_request_operation(factory, soapaction, name, param_def, opt = {})
- #
- # adopt workaround for doc/lit wrapper method
- # (you should consider to simply use rpc/lit service)
- #
- #unless soapaction
- # raise RPCRoutingError.new("soapaction is a must for document method")
- #end
- ensure_styleuse_option(opt, :document, :literal)
- op = RequestScopeOperation.new(soapaction, receiver, name, param_def, opt)
- if opt[:request_style] != :document
- raise RPCRoutingError.new("illegal request_style given")
- end
- assign_operation(soapaction, first_input_part_qname(param_def), op)
- end
-
- def route(conn_data)
- # we cannot set request_default_encodingsyle before parsing the content.
- env = unmarshal(conn_data)
- if env.nil?
- raise ArgumentError.new("illegal SOAP marshal format")
- end
- op = lookup_operation(conn_data.soapaction, env.body)
- headerhandler = @headerhandler.dup
- @headerhandlerfactory.each do |f|
- headerhandler.add(f.create)
- end
- receive_headers(headerhandler, env.header)
- soap_response = default_encodingstyle = nil
- begin
- soap_response =
- op.call(env.body, @mapping_registry, @literal_mapping_registry,
- create_mapping_opt)
- default_encodingstyle = op.response_default_encodingstyle
- rescue Exception
- soap_response = fault($!)
- default_encodingstyle = nil
- end
- conn_data.is_fault = true if soap_response.is_a?(SOAPFault)
- header = call_headers(headerhandler)
- body = SOAPBody.new(soap_response)
- env = SOAPEnvelope.new(header, body)
- marshal(conn_data, env, default_encodingstyle)
- end
-
- # Create fault response string.
- def create_fault_response(e)
- env = SOAPEnvelope.new(SOAPHeader.new, SOAPBody.new(fault(e)))
- opt = {}
- opt[:external_content] = nil
- response_string = Processor.marshal(env, opt)
- conn_data = StreamHandler::ConnectionData.new(response_string)
- conn_data.is_fault = true
- if ext = opt[:external_content]
- mimeize(conn_data, ext)
- end
- conn_data
- end
-
-private
-
- def first_input_part_qname(param_def)
- param_def.each do |inout, paramname, typeinfo|
- if inout == SOAPMethod::IN
- klass, nsdef, namedef = typeinfo
- return XSD::QName.new(nsdef, namedef)
- end
- end
- nil
- end
-
- def create_styleuse_option(style, use)
- opt = {}
- opt[:request_style] = opt[:response_style] = style
- opt[:request_use] = opt[:response_use] = use
- opt
- end
-
- def ensure_styleuse_option(opt, style, use)
- opt[:request_style] ||= style
- opt[:response_style] ||= style
- opt[:request_use] ||= use
- opt[:response_use] ||= use
- end
-
- def assign_operation(soapaction, qname, op)
- assigned = false
- if soapaction and !soapaction.empty?
- @operation_by_soapaction[soapaction] = op
- assigned = true
- end
- if qname
- @operation_by_qname[qname] = op
- assigned = true
- end
- unless assigned
- raise RPCRoutingError.new("cannot assign operation")
- end
- end
-
- def lookup_operation(soapaction, body)
- if op = @operation_by_soapaction[soapaction]
- return op
- end
- qname = body.root_node.elename
- if op = @operation_by_qname[qname]
- return op
- end
- if soapaction
- raise RPCRoutingError.new(
- "operation: #{soapaction} #{qname} not supported")
- else
- raise RPCRoutingError.new("operation: #{qname} not supported")
- end
- end
-
- def call_headers(headerhandler)
- headers = headerhandler.on_outbound
- if headers.empty?
- nil
- else
- h = ::SOAP::SOAPHeader.new
- headers.each do |header|
- h.add(header.elename.name, header)
- end
- h
- end
- end
-
- def receive_headers(headerhandler, headers)
- headerhandler.on_inbound(headers) if headers
- end
-
- def unmarshal(conn_data)
- opt = {}
- contenttype = conn_data.receive_contenttype
- if /#{MIMEMessage::MultipartContentType}/i =~ contenttype
- opt[:external_content] = {}
- mime = MIMEMessage.parse("Content-Type: " + contenttype,
- conn_data.receive_string)
- mime.parts.each do |part|
- value = Attachment.new(part.content)
- value.contentid = part.contentid
- obj = SOAPAttachment.new(value)
- opt[:external_content][value.contentid] = obj if value.contentid
- end
- opt[:charset] =
- StreamHandler.parse_media_type(mime.root.headers['content-type'].str)
- env = Processor.unmarshal(mime.root.content, opt)
- else
- opt[:charset] = ::SOAP::StreamHandler.parse_media_type(contenttype)
- env = Processor.unmarshal(conn_data.receive_string, opt)
- end
- charset = opt[:charset]
- conn_data.send_contenttype = "text/xml; charset=\"#{charset}\""
- env
- end
-
- def marshal(conn_data, env, default_encodingstyle = nil)
- opt = {}
- opt[:external_content] = nil
- opt[:default_encodingstyle] = default_encodingstyle
- opt[:generate_explicit_type] = @generate_explicit_type
- response_string = Processor.marshal(env, opt)
- conn_data.send_string = response_string
- if ext = opt[:external_content]
- mimeize(conn_data, ext)
- end
- conn_data
- end
-
- def mimeize(conn_data, ext)
- mime = MIMEMessage.new
- ext.each do |k, v|
- mime.add_attachment(v.data)
- end
- mime.add_part(conn_data.send_string + "\r\n")
- mime.close
- conn_data.send_string = mime.content_str
- conn_data.send_contenttype = mime.headers['content-type'].str
- conn_data
- end
-
- # Create fault response.
- def fault(e)
- detail = Mapping::SOAPException.new(e)
- SOAPFault.new(
- SOAPString.new('Server'),
- SOAPString.new(e.to_s),
- SOAPString.new(@actor),
- Mapping.obj2soap(detail, @mapping_registry))
- end
-
- def create_mapping_opt
- { :external_ces => @external_ces }
- end
-
- class Operation
- attr_reader :name
- attr_reader :soapaction
- attr_reader :request_style
- attr_reader :response_style
- attr_reader :request_use
- attr_reader :response_use
-
- def initialize(soapaction, name, param_def, opt)
- @soapaction = soapaction
- @name = name
- @request_style = opt[:request_style]
- @response_style = opt[:response_style]
- @request_use = opt[:request_use]
- @response_use = opt[:response_use]
- check_style(@request_style)
- check_style(@response_style)
- check_use(@request_use)
- check_use(@response_use)
- if @response_style == :rpc
- request_qname = opt[:request_qname] or raise
- @rpc_method_factory =
- RPC::SOAPMethodRequest.new(request_qname, param_def, @soapaction)
- @rpc_response_qname = opt[:response_qname]
- else
- @doc_request_qnames = []
- @doc_request_qualified = []
- @doc_response_qnames = []
- @doc_response_qualified = []
- param_def.each do |inout, paramname, typeinfo, eleinfo|
- klass, nsdef, namedef = typeinfo
- qualified = eleinfo
- case inout
- when SOAPMethod::IN
- @doc_request_qnames << XSD::QName.new(nsdef, namedef)
- @doc_request_qualified << qualified
- when SOAPMethod::OUT
- @doc_response_qnames << XSD::QName.new(nsdef, namedef)
- @doc_response_qualified << qualified
- else
- raise ArgumentError.new(
- "illegal inout definition for document style: #{inout}")
- end
- end
- end
- end
-
- def request_default_encodingstyle
- (@request_use == :encoded) ? EncodingNamespace : LiteralNamespace
- end
-
- def response_default_encodingstyle
- (@response_use == :encoded) ? EncodingNamespace : LiteralNamespace
- end
-
- def call(body, mapping_registry, literal_mapping_registry, opt)
- if @request_style == :rpc
- values = request_rpc(body, mapping_registry, literal_mapping_registry,
- opt)
- else
- values = request_document(body, mapping_registry,
- literal_mapping_registry, opt)
- end
- result = receiver.method(@name.intern).call(*values)
- return result if result.is_a?(SOAPFault)
- if @response_style == :rpc
- response_rpc(result, mapping_registry, literal_mapping_registry, opt)
- else
- response_doc(result, mapping_registry, literal_mapping_registry, opt)
- end
- end
-
- private
-
- def receiver
- raise NotImplementedError.new('must be defined in derived class')
- end
-
- def request_rpc(body, mapping_registry, literal_mapping_registry, opt)
- request = body.request
- unless request.is_a?(SOAPStruct)
- raise RPCRoutingError.new("not an RPC style")
- end
- if @request_use == :encoded
- request_rpc_enc(request, mapping_registry, opt)
- else
- request_rpc_lit(request, literal_mapping_registry, opt)
- end
- end
-
- def request_document(body, mapping_registry, literal_mapping_registry, opt)
- # ToDo: compare names with @doc_request_qnames
- if @request_use == :encoded
- request_doc_enc(body, mapping_registry, opt)
- else
- request_doc_lit(body, literal_mapping_registry, opt)
- end
- end
-
- def request_rpc_enc(request, mapping_registry, opt)
- param = Mapping.soap2obj(request, mapping_registry, nil, opt)
- request.collect { |key, value|
- param[key]
- }
- end
-
- def request_rpc_lit(request, mapping_registry, opt)
- request.collect { |key, value|
- Mapping.soap2obj(value, mapping_registry, nil, opt)
- }
- end
-
- def request_doc_enc(body, mapping_registry, opt)
- body.collect { |key, value|
- Mapping.soap2obj(value, mapping_registry, nil, opt)
- }
- end
-
- def request_doc_lit(body, mapping_registry, opt)
- body.collect { |key, value|
- Mapping.soap2obj(value, mapping_registry, nil, opt)
- }
- end
-
- def response_rpc(result, mapping_registry, literal_mapping_registry, opt)
- if @response_use == :encoded
- response_rpc_enc(result, mapping_registry, opt)
- else
- response_rpc_lit(result, literal_mapping_registry, opt)
- end
- end
-
- def response_doc(result, mapping_registry, literal_mapping_registry, opt)
- if @doc_response_qnames.size == 1 and !result.is_a?(Array)
- result = [result]
- end
- if result.size != @doc_response_qnames.size
- raise "required #{@doc_response_qnames.size} responses " +
- "but #{result.size} given"
- end
- if @response_use == :encoded
- response_doc_enc(result, mapping_registry, opt)
- else
- response_doc_lit(result, literal_mapping_registry, opt)
- end
- end
-
- def response_rpc_enc(result, mapping_registry, opt)
- soap_response =
- @rpc_method_factory.create_method_response(@rpc_response_qname)
- if soap_response.have_outparam?
- unless result.is_a?(Array)
- raise RPCRoutingError.new("out parameter was not returned")
- end
- outparams = {}
- i = 1
- soap_response.output_params.each do |outparam|
- outparams[outparam] = Mapping.obj2soap(result[i], mapping_registry,
- nil, opt)
- i += 1
- end
- soap_response.set_outparam(outparams)
- soap_response.retval = Mapping.obj2soap(result[0], mapping_registry,
- nil, opt)
- else
- soap_response.retval = Mapping.obj2soap(result, mapping_registry, nil,
- opt)
- end
- soap_response
- end
-
- def response_rpc_lit(result, mapping_registry, opt)
- soap_response =
- @rpc_method_factory.create_method_response(@rpc_response_qname)
- if soap_response.have_outparam?
- unless result.is_a?(Array)
- raise RPCRoutingError.new("out parameter was not returned")
- end
- outparams = {}
- i = 1
- soap_response.output_params.each do |outparam|
- outparams[outparam] = Mapping.obj2soap(result[i], mapping_registry,
- XSD::QName.new(nil, outparam), opt)
- i += 1
- end
- soap_response.set_outparam(outparams)
- soap_response.retval = Mapping.obj2soap(result[0], mapping_registry,
- XSD::QName.new(nil, soap_response.elename), opt)
- else
- soap_response.retval = Mapping.obj2soap(result, mapping_registry,
- XSD::QName.new(nil, soap_response.elename), opt)
- end
- soap_response
- end
-
- def response_doc_enc(result, mapping_registry, opt)
- (0...result.size).collect { |idx|
- ele = Mapping.obj2soap(result[idx], mapping_registry, nil, opt)
- ele.elename = @doc_response_qnames[idx]
- ele
- }
- end
-
- def response_doc_lit(result, mapping_registry, opt)
- (0...result.size).collect { |idx|
- ele = Mapping.obj2soap(result[idx], mapping_registry,
- @doc_response_qnames[idx])
- ele.encodingstyle = LiteralNamespace
- if ele.respond_to?(:qualified)
- ele.qualified = @doc_response_qualified[idx]
- end
- ele
- }
- end
-
- def check_style(style)
- unless [:rpc, :document].include?(style)
- raise ArgumentError.new("unknown style: #{style}")
- end
- end
-
- def check_use(use)
- unless [:encoded, :literal].include?(use)
- raise ArgumentError.new("unknown use: #{use}")
- end
- end
- end
-
- class ApplicationScopeOperation < Operation
- def initialize(soapaction, receiver, name, param_def, opt)
- super(soapaction, name, param_def, opt)
- @receiver = receiver
- end
-
- private
-
- def receiver
- @receiver
- end
- end
-
- class RequestScopeOperation < Operation
- def initialize(soapaction, receiver_factory, name, param_def, opt)
- super(soapaction, name, param_def, opt)
- unless receiver_factory.respond_to?(:create)
- raise TypeError.new("factory must respond to 'create'")
- end
- @receiver_factory = receiver_factory
- end
-
- private
-
- def receiver
- @receiver_factory.create
- end
- end
-end
-
-
-end
-end
diff --git a/lib/soap/rpc/rpc.rb b/lib/soap/rpc/rpc.rb
deleted file mode 100644
index a48b525dbb..0000000000
--- a/lib/soap/rpc/rpc.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# SOAP4R - RPC utility.
-# 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.
-
-
-module SOAP
-
-
-module RPC
- ServerException = Mapping::MappedException
-
- def self.defined_methods(obj)
- if obj.is_a?(Module)
- obj.methods - Module.methods
- else
- obj.methods - Object.instance_methods(true)
- end
- end
-end
-
-
-end
diff --git a/lib/soap/rpc/soaplet.rb b/lib/soap/rpc/soaplet.rb
deleted file mode 100644
index 7cccdd3e31..0000000000
--- a/lib/soap/rpc/soaplet.rb
+++ /dev/null
@@ -1,162 +0,0 @@
-# SOAP4R - SOAP handler servlet for WEBrick
-# Copyright (C) 2001-2005 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 'webrick/httpservlet/abstract'
-require 'webrick/httpstatus'
-require 'soap/rpc/router'
-require 'soap/streamHandler'
-begin
- require 'stringio'
- require 'zlib'
-rescue LoadError
- warn("Loading stringio or zlib failed. No gzipped response supported.") if $DEBUG
-end
-
-
-warn("Overriding WEBrick::Log#debug") if $DEBUG
-require 'webrick/log'
-module WEBrick
- class Log < BasicLog
- alias __debug debug
- def debug(msg = nil)
- if block_given? and msg.nil?
- __debug(yield)
- else
- __debug(msg)
- end
- end
- end
-end
-
-
-module SOAP
-module RPC
-
-
-class SOAPlet < WEBrick::HTTPServlet::AbstractServlet
-public
- attr_reader :options
-
- def initialize(router = nil)
- @router = router || ::SOAP::RPC::Router.new(self.class.name)
- @options = {}
- @config = {}
- end
-
- # for backward compatibility
- def app_scope_router
- @router
- end
-
- # for backward compatibility
- def add_servant(obj, namespace)
- @router.add_rpc_servant(obj, namespace)
- end
-
- def allow_content_encoding_gzip=(allow)
- @options[:allow_content_encoding_gzip] = allow
- end
-
- ###
- ## Servlet interfaces for WEBrick.
- #
- def get_instance(config, *options)
- @config = config
- self
- end
-
- def require_path_info?
- false
- end
-
- def do_GET(req, res)
- res.header['Allow'] = 'POST'
- raise WEBrick::HTTPStatus::MethodNotAllowed, "GET request not allowed"
- end
-
- def do_POST(req, res)
- logger.debug { "SOAP request: " + req.body } if logger
- begin
- conn_data = ::SOAP::StreamHandler::ConnectionData.new
- setup_req(conn_data, req)
- @router.external_ces = @options[:external_ces]
- conn_data = @router.route(conn_data)
- setup_res(conn_data, req, res)
- rescue Exception => e
- conn_data = @router.create_fault_response(e)
- res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR
- res.body = conn_data.send_string
- res['content-type'] = conn_data.send_contenttype || "text/xml"
- end
- if res.body.is_a?(IO)
- res.chunked = true
- logger.debug { "SOAP response: (chunked response not logged)" } if logger
- else
- logger.debug { "SOAP response: " + res.body } if logger
- end
- end
-
-private
-
- def logger
- @config[:Logger]
- end
-
- def setup_req(conn_data, req)
- conn_data.receive_string = req.body
- conn_data.receive_contenttype = req['content-type']
- conn_data.soapaction = parse_soapaction(req.meta_vars['HTTP_SOAPACTION'])
- end
-
- def setup_res(conn_data, req, res)
- res['content-type'] = conn_data.send_contenttype
- if conn_data.is_fault
- res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR
- end
- if outstring = encode_gzip(req, conn_data.send_string)
- res['content-encoding'] = 'gzip'
- res['content-length'] = outstring.size
- res.body = outstring
- else
- res.body = conn_data.send_string
- end
- end
-
- def parse_soapaction(soapaction)
- if !soapaction.nil? and !soapaction.empty?
- if /^"(.+)"$/ =~ soapaction
- return $1
- end
- end
- nil
- end
-
- def encode_gzip(req, outstring)
- unless encode_gzip?(req)
- return nil
- end
- begin
- ostream = StringIO.new
- gz = Zlib::GzipWriter.new(ostream)
- gz.write(outstring)
- ostream.string
- ensure
- gz.close
- end
- end
-
- def encode_gzip?(req)
- @options[:allow_content_encoding_gzip] and defined?(::Zlib) and
- req['accept-encoding'] and
- req['accept-encoding'].split(/,\s*/).include?('gzip')
- end
-end
-
-
-end
-end
diff --git a/lib/soap/rpc/standaloneServer.rb b/lib/soap/rpc/standaloneServer.rb
deleted file mode 100644
index 080343ba33..0000000000
--- a/lib/soap/rpc/standaloneServer.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# SOAP4R - WEBrick Server
-# Copyright (C) 2003 by 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 'soap/rpc/httpserver'
-
-
-module SOAP
-module RPC
-
-
-class StandaloneServer < HTTPServer
- def initialize(appname, default_namespace, host = "0.0.0.0", port = 8080)
- @appname = appname
- @default_namespace = default_namespace
- @host = host
- @port = port
- super(create_config)
- end
-
- alias add_servant add_rpc_servant
- alias add_headerhandler add_rpc_headerhandler
-
-private
-
- def create_config
- {
- :BindAddress => @host,
- :Port => @port,
- :AccessLog => [],
- :SOAPDefaultNamespace => @default_namespace,
- :SOAPHTTPServerApplicationName => @appname,
- }
- end
-end
-
-
-end
-end
diff --git a/lib/soap/soap.rb b/lib/soap/soap.rb
deleted file mode 100644
index 12e09eccfe..0000000000
--- a/lib/soap/soap.rb
+++ /dev/null
@@ -1,140 +0,0 @@
-# soap/soap.rb: SOAP4R - Base definitions.
-# Copyright (C) 2000-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 'xsd/qname'
-require 'xsd/charset'
-
-
-module SOAP
-
-
-VERSION = Version = '1.5.5'
-PropertyName = 'soap/property'
-
-EnvelopeNamespace = 'http://schemas.xmlsoap.org/soap/envelope/'
-EncodingNamespace = 'http://schemas.xmlsoap.org/soap/encoding/'
-LiteralNamespace = 'http://xml.apache.org/xml-soap/literalxml'
-
-NextActor = 'http://schemas.xmlsoap.org/soap/actor/next'
-
-EleEnvelope = 'Envelope'
-EleHeader = 'Header'
-EleBody = 'Body'
-EleFault = 'Fault'
-EleFaultString = 'faultstring'
-EleFaultActor = 'faultactor'
-EleFaultCode = 'faultcode'
-EleFaultDetail = 'detail'
-
-AttrMustUnderstand = 'mustUnderstand'
-AttrEncodingStyle = 'encodingStyle'
-AttrActor = 'actor'
-AttrRoot = 'root'
-AttrArrayType = 'arrayType'
-AttrOffset = 'offset'
-AttrPosition = 'position'
-ValueArray = 'Array'
-
-EleEnvelopeName = XSD::QName.new(EnvelopeNamespace, EleEnvelope).freeze
-EleHeaderName = XSD::QName.new(EnvelopeNamespace, EleHeader).freeze
-EleBodyName = XSD::QName.new(EnvelopeNamespace, EleBody).freeze
-EleFaultName = XSD::QName.new(EnvelopeNamespace, EleFault).freeze
-EleFaultStringName = XSD::QName.new(nil, EleFaultString).freeze
-EleFaultActorName = XSD::QName.new(nil, EleFaultActor).freeze
-EleFaultCodeName = XSD::QName.new(nil, EleFaultCode).freeze
-EleFaultDetailName = XSD::QName.new(nil, EleFaultDetail).freeze
-AttrMustUnderstandName = XSD::QName.new(EnvelopeNamespace, AttrMustUnderstand).freeze
-AttrEncodingStyleName = XSD::QName.new(EnvelopeNamespace, AttrEncodingStyle).freeze
-AttrRootName = XSD::QName.new(EncodingNamespace, AttrRoot).freeze
-AttrArrayTypeName = XSD::QName.new(EncodingNamespace, AttrArrayType).freeze
-AttrOffsetName = XSD::QName.new(EncodingNamespace, AttrOffset).freeze
-AttrPositionName = XSD::QName.new(EncodingNamespace, AttrPosition).freeze
-ValueArrayName = XSD::QName.new(EncodingNamespace, ValueArray).freeze
-
-Base64Literal = 'base64'
-
-SOAPNamespaceTag = 'env'
-XSDNamespaceTag = 'xsd'
-XSINamespaceTag = 'xsi'
-
-MediaType = 'text/xml'
-
-class Error < StandardError; end
-
-class StreamError < Error; end
-class HTTPStreamError < StreamError; end
-class PostUnavailableError < HTTPStreamError; end
-class MPostUnavailableError < HTTPStreamError; end
-
-class ArrayIndexOutOfBoundsError < Error; end
-class ArrayStoreError < Error; end
-
-class RPCRoutingError < Error; end
-class EmptyResponseError < Error; end
-class ResponseFormatError < Error; end
-
-class UnhandledMustUnderstandHeaderError < Error; end
-
-class FaultError < Error
- attr_reader :faultcode
- attr_reader :faultstring
- attr_reader :faultactor
- attr_accessor :detail
-
- def initialize(fault)
- @faultcode = fault.faultcode
- @faultstring = fault.faultstring
- @faultactor = fault.faultactor
- @detail = fault.detail
- super(self.to_s)
- end
-
- def to_s
- str = nil
- if @faultstring and @faultstring.respond_to?('data')
- str = @faultstring.data
- end
- str || '(No faultstring)'
- end
-end
-
-
-module Env
- def self.getenv(name)
- ENV[name.downcase] || ENV[name.upcase]
- end
-
- use_proxy = getenv('soap_use_proxy') == 'on'
- HTTP_PROXY = use_proxy ? getenv('http_proxy') : nil
- NO_PROXY = use_proxy ? getenv('no_proxy') : nil
-end
-
-
-end
-
-
-unless Object.respond_to?(:instance_variable_get)
- class Object
- def instance_variable_get(ivarname)
- instance_eval(ivarname)
- end
-
- def instance_variable_set(ivarname, value)
- instance_eval("#{ivarname} = value")
- end
- end
-end
-
-
-unless Kernel.respond_to?(:warn)
- module Kernel
- def warn(msg)
- STDERR.puts(msg + "\n") unless $VERBOSE.nil?
- end
- end
-end
diff --git a/lib/soap/streamHandler.rb b/lib/soap/streamHandler.rb
deleted file mode 100644
index 672396ecce..0000000000
--- a/lib/soap/streamHandler.rb
+++ /dev/null
@@ -1,229 +0,0 @@
-# SOAP4R - Stream handler.
-# 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 'soap/soap'
-require 'soap/httpconfigloader'
-begin
- require 'stringio'
- require 'zlib'
-rescue LoadError
- warn("Loading stringio or zlib failed. No gzipped response support.") if $DEBUG
-end
-
-
-module SOAP
-
-
-class StreamHandler
- RUBY_VERSION_STRING = "ruby #{ RUBY_VERSION } (#{ RUBY_RELEASE_DATE }) [#{ RUBY_PLATFORM }]"
-
- class ConnectionData
- attr_accessor :send_string
- attr_accessor :send_contenttype
- attr_accessor :receive_string
- attr_accessor :receive_contenttype
- attr_accessor :is_fault
- attr_accessor :soapaction
-
- def initialize(send_string = nil)
- @send_string = send_string
- @send_contenttype = nil
- @receive_string = nil
- @receive_contenttype = nil
- @is_fault = false
- @soapaction = nil
- end
- end
-
- def self.parse_media_type(str)
- if /^#{ MediaType }(?:\s*;\s*charset=([^"]+|"[^"]+"))?$/i !~ str
- return nil
- end
- charset = $1
- charset.gsub!(/"/, '') if charset
- charset || 'us-ascii'
- end
-
- def self.create_media_type(charset)
- "#{ MediaType }; charset=#{ charset }"
- end
-end
-
-
-class HTTPStreamHandler < StreamHandler
- include SOAP
-
- begin
- require 'http-access2'
- if HTTPAccess2::VERSION < "2.0"
- raise LoadError.new("http-access/2.0 or later is required.")
- end
- Client = HTTPAccess2::Client
- RETRYABLE = true
- rescue LoadError
- warn("Loading http-access2 failed. Net/http is used.") if $DEBUG
- require 'soap/netHttpClient'
- Client = SOAP::NetHttpClient
- RETRYABLE = false
- end
-
-
-public
-
- attr_reader :client
- attr_accessor :wiredump_file_base
-
- MAX_RETRY_COUNT = 10 # [times]
-
- def initialize(options)
- super()
- @client = Client.new(nil, "SOAP4R/#{ Version }")
- @wiredump_file_base = nil
- @charset = @wiredump_dev = nil
- @options = options
- set_options
- @client.debug_dev = @wiredump_dev
- @cookie_store = nil
- @accept_encoding_gzip = false
- end
-
- def test_loopback_response
- @client.test_loopback_response
- end
-
- def accept_encoding_gzip=(allow)
- @accept_encoding_gzip = allow
- end
-
- def inspect
- "#<#{self.class}>"
- end
-
- def send(endpoint_url, conn_data, soapaction = nil, charset = @charset)
- conn_data.soapaction ||= soapaction # for backward conpatibility
- send_post(endpoint_url, conn_data, charset)
- end
-
- def reset(endpoint_url = nil)
- if endpoint_url.nil?
- @client.reset_all
- else
- @client.reset(endpoint_url)
- end
- @client.save_cookie_store if @cookie_store
- end
-
-private
-
- def set_options
- HTTPConfigLoader.set_options(@client, @options)
- @charset = @options["charset"] || XSD::Charset.xml_encoding_label
- @options.add_hook("charset") do |key, value|
- @charset = value
- end
- @wiredump_dev = @options["wiredump_dev"]
- @options.add_hook("wiredump_dev") do |key, value|
- @wiredump_dev = value
- @client.debug_dev = @wiredump_dev
- end
- set_cookie_store_file(@options["cookie_store_file"])
- @options.add_hook("cookie_store_file") do |key, value|
- set_cookie_store_file(value)
- end
- ssl_config = @options["ssl_config"]
- basic_auth = @options["basic_auth"]
- @options.lock(true)
- ssl_config.unlock
- basic_auth.unlock
- end
-
- def set_cookie_store_file(value)
- value = nil if value and value.empty?
- @cookie_store = value
- @client.set_cookie_store(@cookie_store) if @cookie_store
- end
-
- def send_post(endpoint_url, conn_data, charset)
- conn_data.send_contenttype ||= StreamHandler.create_media_type(charset)
-
- if @wiredump_file_base
- filename = @wiredump_file_base + '_request.xml'
- f = File.open(filename, "w")
- f << conn_data.send_string
- f.close
- end
-
- extra = {}
- extra['Content-Type'] = conn_data.send_contenttype
- extra['SOAPAction'] = "\"#{ conn_data.soapaction }\""
- extra['Accept-Encoding'] = 'gzip' if send_accept_encoding_gzip?
- send_string = conn_data.send_string
- @wiredump_dev << "Wire dump:\n\n" if @wiredump_dev
- begin
- retry_count = 0
- while true
- res = @client.post(endpoint_url, send_string, extra)
- if RETRYABLE and HTTP::Status.redirect?(res.status)
- retry_count += 1
- if retry_count >= MAX_RETRY_COUNT
- raise HTTPStreamError.new("redirect count exceeded")
- end
- endpoint_url = res.header["location"][0]
- puts "redirected to #{endpoint_url}" if $DEBUG
- else
- break
- end
- end
- rescue
- @client.reset(endpoint_url)
- raise
- end
- @wiredump_dev << "\n\n" if @wiredump_dev
- receive_string = res.content
- if @wiredump_file_base
- filename = @wiredump_file_base + '_response.xml'
- f = File.open(filename, "w")
- f << receive_string
- f.close
- end
- case res.status
- when 405
- raise PostUnavailableError.new("#{ res.status }: #{ res.reason }")
- when 200, 500
- # Nothing to do.
- else
- raise HTTPStreamError.new("#{ res.status }: #{ res.reason }")
- end
- if res.respond_to?(:header) and !res.header['content-encoding'].empty? and
- res.header['content-encoding'][0].downcase == 'gzip'
- receive_string = decode_gzip(receive_string)
- end
- conn_data.receive_string = receive_string
- conn_data.receive_contenttype = res.contenttype
- conn_data
- end
-
- def send_accept_encoding_gzip?
- @accept_encoding_gzip and defined?(::Zlib)
- end
-
- def decode_gzip(instring)
- unless send_accept_encoding_gzip?
- raise HTTPStreamError.new("Gzipped response content.")
- end
- begin
- gz = Zlib::GzipReader.new(StringIO.new(instring))
- gz.read
- ensure
- gz.close
- end
- end
-end
-
-
-end
diff --git a/lib/soap/wsdlDriver.rb b/lib/soap/wsdlDriver.rb
deleted file mode 100644
index eba9608df5..0000000000
--- a/lib/soap/wsdlDriver.rb
+++ /dev/null
@@ -1,575 +0,0 @@
-# SOAP4R - SOAP WSDL driver
-# Copyright (C) 2002, 2003, 2005 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/parser'
-require 'wsdl/importer'
-require 'xsd/qname'
-require 'xsd/codegen/gensupport'
-require 'soap/mapping/wsdlencodedregistry'
-require 'soap/mapping/wsdlliteralregistry'
-require 'soap/rpc/driver'
-require 'wsdl/soap/methodDefCreator'
-
-
-module SOAP
-
-
-class WSDLDriverFactory
- class FactoryError < StandardError; end
-
- attr_reader :wsdl
-
- def initialize(wsdl)
- @wsdl = import(wsdl)
- @methoddefcreator = WSDL::SOAP::MethodDefCreator.new(@wsdl)
- end
-
- def inspect
- "#<#{self.class}:#{@wsdl.name}>"
- end
-
- def create_rpc_driver(servicename = nil, portname = nil)
- port = find_port(servicename, portname)
- drv = SOAP::RPC::Driver.new(port.soap_address.location)
- init_driver(drv, port)
- add_operation(drv, port)
- drv
- end
-
- # depricated old interface
- def create_driver(servicename = nil, portname = nil)
- warn("WSDLDriverFactory#create_driver is depricated. Use create_rpc_driver instead.")
- port = find_port(servicename, portname)
- WSDLDriver.new(@wsdl, port, nil)
- end
-
- # Backward compatibility.
- alias createDriver create_driver
-
-private
-
- def find_port(servicename = nil, portname = nil)
- service = port = nil
- if servicename
- service = @wsdl.service(
- XSD::QName.new(@wsdl.targetnamespace, servicename))
- else
- service = @wsdl.services[0]
- end
- if service.nil?
- raise FactoryError.new("service #{servicename} not found in WSDL")
- end
- if portname
- port = service.ports[XSD::QName.new(@wsdl.targetnamespace, portname)]
- if port.nil?
- raise FactoryError.new("port #{portname} not found in WSDL")
- end
- else
- port = service.ports.find { |port| !port.soap_address.nil? }
- if port.nil?
- raise FactoryError.new("no ports have soap:address")
- end
- end
- if port.soap_address.nil?
- raise FactoryError.new("soap:address element not found in WSDL")
- end
- port
- end
-
- def init_driver(drv, port)
- wsdl_elements = @wsdl.collect_elements
- wsdl_types = @wsdl.collect_complextypes + @wsdl.collect_simpletypes
- rpc_decode_typemap = wsdl_types +
- @wsdl.soap_rpc_complextypes(port.find_binding)
- drv.proxy.mapping_registry =
- Mapping::WSDLEncodedRegistry.new(rpc_decode_typemap)
- drv.proxy.literal_mapping_registry =
- Mapping::WSDLLiteralRegistry.new(wsdl_types, wsdl_elements)
- end
-
- def add_operation(drv, port)
- port.find_binding.operations.each do |op_bind|
- op_name = op_bind.soapoperation_name
- soapaction = op_bind.soapaction || ''
- orgname = op_name.name
- name = XSD::CodeGen::GenSupport.safemethodname(orgname)
- param_def = create_param_def(op_bind)
- opt = {
- :request_style => op_bind.soapoperation_style,
- :response_style => op_bind.soapoperation_style,
- :request_use => op_bind.input.soapbody_use,
- :response_use => op_bind.output.soapbody_use,
- :elementformdefault => false,
- :attributeformdefault => false
- }
- if op_bind.soapoperation_style == :rpc
- drv.add_rpc_operation(op_name, soapaction, name, param_def, opt)
- else
- drv.add_document_operation(soapaction, name, param_def, opt)
- end
- if orgname != name and orgname.capitalize == name.capitalize
- ::SOAP::Mapping.define_singleton_method(drv, orgname) do |*arg|
- __send__(name, *arg)
- end
- end
- end
- end
-
- def import(location)
- WSDL::Importer.import(location)
- end
-
- def create_param_def(op_bind)
- op = op_bind.find_operation
- if op_bind.soapoperation_style == :rpc
- param_def = @methoddefcreator.collect_rpcparameter(op)
- else
- param_def = @methoddefcreator.collect_documentparameter(op)
- end
- # the first element of typedef in param_def is a String like
- # "::SOAP::SOAPStruct". turn this String to a class.
- param_def.collect { |io, name, typedef|
- typedef[0] = Mapping.class_from_name(typedef[0])
- [io, name, typedef]
- }
- end
-
- def partqname(part)
- if part.type
- part.type
- else
- part.element
- end
- end
-
- def param_def(type, name, klass, partqname)
- [type, name, [klass, partqname.namespace, partqname.name]]
- end
-
- def filter_parts(partsdef, partssource)
- parts = partsdef.split(/\s+/)
- partssource.find_all { |part| parts.include?(part.name) }
- end
-end
-
-
-class WSDLDriver
- class << self
- if RUBY_VERSION >= "1.7.0"
- def __attr_proxy(symbol, assignable = false)
- name = symbol.to_s
- define_method(name) {
- @servant.__send__(name)
- }
- if assignable
- aname = name + '='
- define_method(aname) { |rhs|
- @servant.__send__(aname, rhs)
- }
- end
- end
- else
- def __attr_proxy(symbol, assignable = false)
- name = symbol.to_s
- module_eval <<-EOS
- def #{name}
- @servant.#{name}
- end
- EOS
- if assignable
- module_eval <<-EOS
- def #{name}=(value)
- @servant.#{name} = value
- end
- EOS
- end
- end
- end
- end
-
- __attr_proxy :options
- __attr_proxy :headerhandler
- __attr_proxy :streamhandler
- __attr_proxy :test_loopback_response
- __attr_proxy :endpoint_url, true
- __attr_proxy :mapping_registry, true # for RPC unmarshal
- __attr_proxy :wsdl_mapping_registry, true # for RPC marshal
- __attr_proxy :default_encodingstyle, true
- __attr_proxy :generate_explicit_type, true
- __attr_proxy :allow_unqualified_element, true
-
- def httpproxy
- @servant.options["protocol.http.proxy"]
- end
-
- def httpproxy=(httpproxy)
- @servant.options["protocol.http.proxy"] = httpproxy
- end
-
- def wiredump_dev
- @servant.options["protocol.http.wiredump_dev"]
- end
-
- def wiredump_dev=(wiredump_dev)
- @servant.options["protocol.http.wiredump_dev"] = wiredump_dev
- end
-
- def mandatorycharset
- @servant.options["protocol.mandatorycharset"]
- end
-
- def mandatorycharset=(mandatorycharset)
- @servant.options["protocol.mandatorycharset"] = mandatorycharset
- end
-
- def wiredump_file_base
- @servant.options["protocol.wiredump_file_base"]
- end
-
- def wiredump_file_base=(wiredump_file_base)
- @servant.options["protocol.wiredump_file_base"] = wiredump_file_base
- end
-
- def initialize(wsdl, port, logdev)
- @servant = Servant__.new(self, wsdl, port, logdev)
- end
-
- def inspect
- "#<#{self.class}:#{@servant.port.name}>"
- end
-
- def reset_stream
- @servant.reset_stream
- end
-
- # Backward compatibility.
- alias generateEncodeType= generate_explicit_type=
-
- class Servant__
- include SOAP
-
- attr_reader :options
- attr_reader :port
-
- attr_accessor :soapaction
- attr_accessor :default_encodingstyle
- attr_accessor :allow_unqualified_element
- attr_accessor :generate_explicit_type
- attr_accessor :mapping_registry
- attr_accessor :wsdl_mapping_registry
-
- def initialize(host, wsdl, port, logdev)
- @host = host
- @wsdl = wsdl
- @port = port
- @logdev = logdev
- @soapaction = nil
- @options = setup_options
- @default_encodingstyle = nil
- @allow_unqualified_element = nil
- @generate_explicit_type = false
- @mapping_registry = nil # for rpc unmarshal
- @wsdl_mapping_registry = nil # for rpc marshal
- @wiredump_file_base = nil
- @mandatorycharset = nil
- @wsdl_elements = @wsdl.collect_elements
- @wsdl_types = @wsdl.collect_complextypes + @wsdl.collect_simpletypes
- @rpc_decode_typemap = @wsdl_types +
- @wsdl.soap_rpc_complextypes(port.find_binding)
- @wsdl_mapping_registry = Mapping::WSDLEncodedRegistry.new(
- @rpc_decode_typemap)
- @doc_mapper = Mapping::WSDLLiteralRegistry.new(
- @wsdl_types, @wsdl_elements)
- endpoint_url = @port.soap_address.location
- # Convert a map which key is QName, to a Hash which key is String.
- @operation = {}
- @port.inputoperation_map.each do |op_name, op_info|
- orgname = op_name.name
- name = XSD::CodeGen::GenSupport.safemethodname(orgname)
- @operation[name] = @operation[orgname] = op_info
- add_method_interface(op_info)
- end
- @proxy = ::SOAP::RPC::Proxy.new(endpoint_url, @soapaction, @options)
- end
-
- def inspect
- "#<#{self.class}:#{@proxy.inspect}>"
- end
-
- def endpoint_url
- @proxy.endpoint_url
- end
-
- def endpoint_url=(endpoint_url)
- @proxy.endpoint_url = endpoint_url
- end
-
- def headerhandler
- @proxy.headerhandler
- end
-
- def streamhandler
- @proxy.streamhandler
- end
-
- def test_loopback_response
- @proxy.test_loopback_response
- end
-
- def reset_stream
- @proxy.reset_stream
- end
-
- def rpc_call(name, *values)
- set_wiredump_file_base(name)
- unless op_info = @operation[name]
- raise RuntimeError, "method: #{name} not defined"
- end
- req_header = create_request_header
- req_body = create_request_body(op_info, *values)
- reqopt = create_options({
- :soapaction => op_info.soapaction || @soapaction})
- resopt = create_options({
- :decode_typemap => @rpc_decode_typemap})
- env = @proxy.route(req_header, req_body, reqopt, resopt)
- raise EmptyResponseError unless env
- receive_headers(env.header)
- begin
- @proxy.check_fault(env.body)
- rescue ::SOAP::FaultError => e
- Mapping.fault2exception(e)
- end
- ret = env.body.response ?
- Mapping.soap2obj(env.body.response, @mapping_registry) : nil
- if env.body.outparams
- outparams = env.body.outparams.collect { |outparam|
- Mapping.soap2obj(outparam)
- }
- return [ret].concat(outparams)
- else
- return ret
- end
- end
-
- # req_header: [[element, mustunderstand, encodingstyle(QName/String)], ...]
- # req_body: SOAPBasetype/SOAPCompoundtype
- def document_send(name, header_obj, body_obj)
- set_wiredump_file_base(name)
- unless op_info = @operation[name]
- raise RuntimeError, "method: #{name} not defined"
- end
- req_header = header_obj ? header_from_obj(header_obj, op_info) : nil
- req_body = body_from_obj(body_obj, op_info)
- opt = create_options({
- :soapaction => op_info.soapaction || @soapaction,
- :decode_typemap => @wsdl_types})
- env = @proxy.invoke(req_header, req_body, opt)
- raise EmptyResponseError unless env
- if env.body.fault
- raise ::SOAP::FaultError.new(env.body.fault)
- end
- res_body_obj = env.body.response ?
- Mapping.soap2obj(env.body.response, @mapping_registry) : nil
- return env.header, res_body_obj
- end
-
- private
-
- def create_options(hash = nil)
- opt = {}
- opt[:default_encodingstyle] = @default_encodingstyle
- opt[:allow_unqualified_element] = @allow_unqualified_element
- opt[:generate_explicit_type] = @generate_explicit_type
- opt.update(hash) if hash
- opt
- end
-
- def set_wiredump_file_base(name)
- if @wiredump_file_base
- @proxy.set_wiredump_file_base(@wiredump_file_base + "_#{name}")
- end
- end
-
- def create_request_header
- headers = @proxy.headerhandler.on_outbound
- if headers.empty?
- nil
- else
- h = SOAPHeader.new
- headers.each do |header|
- h.add(header.elename.name, header)
- end
- h
- end
- end
-
- def receive_headers(headers)
- @proxy.headerhandler.on_inbound(headers) if headers
- end
-
- def create_request_body(op_info, *values)
- method = create_method_struct(op_info, *values)
- SOAPBody.new(method)
- end
-
- def create_method_struct(op_info, *params)
- parts_names = op_info.bodyparts.collect { |part| part.name }
- obj = create_method_obj(parts_names, params)
- method = Mapping.obj2soap(obj, @wsdl_mapping_registry, op_info.op_name)
- if method.members.size != parts_names.size
- new_method = SOAPStruct.new
- method.each do |key, value|
- if parts_names.include?(key)
- new_method.add(key, value)
- end
- end
- method = new_method
- end
- method.elename = op_info.op_name
- method.type = XSD::QName.new # Request should not be typed.
- method
- end
-
- def create_method_obj(names, params)
- o = Object.new
- idx = 0
- while idx < params.length
- o.instance_variable_set('@' + names[idx], params[idx])
- idx += 1
- end
- o
- end
-
- def header_from_obj(obj, op_info)
- if obj.is_a?(SOAPHeader)
- obj
- elsif op_info.headerparts.empty?
- if obj.nil?
- nil
- else
- raise RuntimeError.new("no header definition in schema: #{obj}")
- end
- elsif op_info.headerparts.size == 1
- part = op_info.headerparts[0]
- header = SOAPHeader.new()
- header.add(headeritem_from_obj(obj, part.element || part.eletype))
- header
- else
- header = SOAPHeader.new()
- op_info.headerparts.each do |part|
- child = Mapping.get_attribute(obj, part.name)
- ele = headeritem_from_obj(child, part.element || part.eletype)
- header.add(part.name, ele)
- end
- header
- end
- end
-
- def headeritem_from_obj(obj, name)
- if obj.nil?
- SOAPElement.new(name)
- elsif obj.is_a?(SOAPHeaderItem)
- obj
- else
- Mapping.obj2soap(obj, @doc_mapper, name)
- end
- end
-
- def body_from_obj(obj, op_info)
- if obj.is_a?(SOAPBody)
- obj
- elsif op_info.bodyparts.empty?
- if obj.nil?
- nil
- else
- raise RuntimeError.new("no body found in schema")
- end
- elsif op_info.bodyparts.size == 1
- part = op_info.bodyparts[0]
- ele = bodyitem_from_obj(obj, part.element || part.type)
- SOAPBody.new(ele)
- else
- body = SOAPBody.new
- op_info.bodyparts.each do |part|
- child = Mapping.get_attribute(obj, part.name)
- ele = bodyitem_from_obj(child, part.element || part.type)
- body.add(ele.elename.name, ele)
- end
- body
- end
- end
-
- def bodyitem_from_obj(obj, name)
- if obj.nil?
- SOAPElement.new(name)
- elsif obj.is_a?(SOAPElement)
- obj
- else
- Mapping.obj2soap(obj, @doc_mapper, name)
- end
- end
-
- def add_method_interface(op_info)
- name = XSD::CodeGen::GenSupport.safemethodname(op_info.op_name.name)
- orgname = op_info.op_name.name
- parts_names = op_info.bodyparts.collect { |part| part.name }
- case op_info.style
- when :document
- if orgname != name and orgname.capitalize == name.capitalize
- add_document_method_interface(orgname, parts_names)
- end
- add_document_method_interface(name, parts_names)
- when :rpc
- if orgname != name and orgname.capitalize == name.capitalize
- add_rpc_method_interface(orgname, parts_names)
- end
- add_rpc_method_interface(name, parts_names)
- else
- raise RuntimeError.new("unknown style: #{op_info.style}")
- end
- end
-
- def add_rpc_method_interface(name, parts_names)
- ::SOAP::Mapping.define_singleton_method(@host, name) do |*arg|
- unless arg.size == parts_names.size
- raise ArgumentError.new(
- "wrong number of arguments (#{arg.size} for #{parts_names.size})")
- end
- @servant.rpc_call(name, *arg)
- end
- @host.method(name)
- end
-
- def add_document_method_interface(name, parts_names)
- ::SOAP::Mapping.define_singleton_method(@host, name) do |h, b|
- @servant.document_send(name, h, b)
- end
- @host.method(name)
- end
-
- def setup_options
- if opt = Property.loadproperty(::SOAP::PropertyName)
- opt = opt["client"]
- end
- opt ||= Property.new
- opt.add_hook("protocol.mandatorycharset") do |key, value|
- @mandatorycharset = value
- end
- opt.add_hook("protocol.wiredump_file_base") do |key, value|
- @wiredump_file_base = value
- end
- opt["protocol.http.charset"] ||= XSD::Charset.xml_encoding_label
- opt["protocol.http.proxy"] ||= Env::HTTP_PROXY
- opt["protocol.http.no_proxy"] ||= Env::NO_PROXY
- opt
- end
- end
-end
-
-
-end
diff --git a/lib/wsdl/binding.rb b/lib/wsdl/binding.rb
deleted file mode 100644
index 58a21d820d..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.source)
- 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 5235037cfe..0000000000
--- a/lib/wsdl/definitions.rb
+++ /dev/null
@@ -1,250 +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
-
- attr_accessor :location
- attr_reader :importedschema
-
- def initialize
- super
- @name = nil
- @targetnamespace = nil
- @location = nil
- @importedschema = {}
-
- @types = nil
- @imports = []
- @messages = XSD::NamedElements.new
- @porttypes = XSD::NamedElements.new
- @bindings = XSD::NamedElements.new
- @services = XSD::NamedElements.new
-
- @anontypes = XSD::NamedElements.new
- @root = self
- end
-
- 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_attributes
- result = XSD::NamedElements.new
- if @types
- @types.schemas.each do |schema|
- result.concat(schema.collect_attributes)
- end
- end
- @imports.each do |import|
- result.concat(import.content.collect_attributes)
- end
- result
- end
-
- 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.source)
- when TargetNamespaceAttrName
- self.targetnamespace = value.source
- 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 faf60871a5..0000000000
--- a/lib/wsdl/import.rb
+++ /dev/null
@@ -1,80 +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.source
- if @content
- @content.targetnamespace = @namespace
- end
- @namespace
- when LocationAttrName
- @location = URI.parse(value.source)
- if @location.relative? and !parent.location.nil? and
- !parent.location.relative?
- @location = parent.location + @location
- end
- if root.importedschema.key?(@location)
- @content = root.importedschema[@location]
- else
- root.importedschema[@location] = nil # placeholder
- @content = import(@location)
- if @content.is_a?(Definitions)
- @content.root = root
- if @namespace
- @content.targetnamespace = @namespace
- end
- end
- root.importedschema[@location] = @content
- end
- @location
- else
- nil
- end
- end
-
-private
-
- def import(location)
- Importer.import(location, root)
- end
-end
-
-
-end
diff --git a/lib/wsdl/importer.rb b/lib/wsdl/importer.rb
deleted file mode 100644
index 481bd81b25..0000000000
--- a/lib/wsdl/importer.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# WSDL4R - WSDL importer library.
-# Copyright (C) 2003, 2005 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/importer'
-require 'wsdl/parser'
-
-
-module WSDL
-
-
-class Importer < WSDL::XMLSchema::Importer
- def self.import(location, originalroot = nil)
- new.import(location, originalroot)
- end
-
-private
-
- def parse(content, location, originalroot)
- opt = {
- :location => location,
- :originalroot => originalroot
- }
- begin
- WSDL::Parser.new(opt).parse(content)
- rescue WSDL::Parser::ParseError
- super(content, location, originalroot)
- end
- end
-
-end
-
-
-end
diff --git a/lib/wsdl/info.rb b/lib/wsdl/info.rb
deleted file mode 100644
index ffd90390a4..0000000000
--- a/lib/wsdl/info.rb
+++ /dev/null
@@ -1,39 +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 :root
- attr_accessor :parent
- attr_accessor :id
-
- def initialize
- @root = nil
- @parent = nil
- @id = nil
- end
-
- def inspect
- if self.respond_to?(:name)
- sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.name)
- else
- sprintf("#<%s:0x%x>", self.class.name, __id__)
- end
- 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 cecc602da3..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.source)
- else
- nil
- end
- end
-end
-
-
-end
diff --git a/lib/wsdl/operation.rb b/lib/wsdl/operation.rb
deleted file mode 100644
index fb7f4a80f4..0000000000
--- a/lib/wsdl/operation.rb
+++ /dev/null
@@ -1,130 +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
- typename = input.find_message.name
- NameInfo.new(@name, typename, inputparts)
- end
-
- def output_info
- typename = output.find_message.name
- NameInfo.new(@name, typename, outputparts)
- end
-
- def inputparts
- sort_parts(input.find_message.parts)
- end
-
- def inputname
- XSD::QName.new(targetnamespace, input.name ? input.name.name : @name.name)
- 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.source)
- when TypeAttrName
- @type = value
- when ParameterOrderAttrName
- @parameter_order = value.source.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
- # result length can be shorter than parts's.
- # return part must not be a part of the parameterOrder.
- result
- end
-end
-
-
-end
diff --git a/lib/wsdl/operationBinding.rb b/lib/wsdl/operationBinding.rb
deleted file mode 100644
index c2b8cd6591..0000000000
--- a/lib/wsdl/operationBinding.rb
+++ /dev/null
@@ -1,108 +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] or raise RuntimeError.new("#{@name} not found")
- end
-
- def soapoperation_name
- if @soapoperation
- @soapoperation.input_info.op_name
- else
- find_operation.name
- end
- end
-
- def soapoperation_style
- style = nil
- if @soapoperation
- style = @soapoperation.operation_style
- elsif parent.soapbinding
- style = parent.soapbinding.style
- else
- raise TypeError.new("operation style definition not found")
- end
- style || :document
- end
-
- def soapaction
- if @soapoperation
- @soapoperation.soapaction
- else
- nil
- end
- 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.source)
- else
- nil
- end
- end
-end
-
-
-end
diff --git a/lib/wsdl/param.rb b/lib/wsdl/param.rb
deleted file mode 100644
index b6836b7def..0000000000
--- a/lib/wsdl/param.rb
+++ /dev/null
@@ -1,85 +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) or raise RuntimeError.new("#{@message} not found")
- end
-
- def soapbody_use
- if @soapbody
- @soapbody.use || :literal
- else
- raise RuntimeError.new("soap:body not found")
- end
- 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
- if value.namespace.nil?
- value = XSD::QName.new(targetnamespace, value.source)
- end
- @message = value
- when NameAttrName
- @name = XSD::QName.new(targetnamespace, value.source)
- else
- nil
- end
- end
-end
-
-
-end
diff --git a/lib/wsdl/parser.rb b/lib/wsdl/parser.rb
deleted file mode 100644
index f96e96ee2a..0000000000
--- a/lib/wsdl/parser.rb
+++ /dev/null
@@ -1,163 +0,0 @@
-# WSDL4R - WSDL XML Instance parser library.
-# Copyright (C) 2002, 2003, 2005 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
- @ignored = {}
- @location = opt[:location]
- @originalroot = opt[:originalroot]
- 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
- elename = ns.parse(name)
- if !parent
- if elename == DefinitionsName
- o = Definitions.parse_element(elename)
- o.location = @location
- else
- raise UnknownElementError.new("unknown element: #{elename}")
- end
- o.root = @originalroot if @originalroot # o.root = o otherwise
- else
- if elename == XMLSchema::AnnotationName
- # only the first annotation element is allowed for each xsd element.
- o = XMLSchema::Annotation.new
- else
- o = parent.parse_element(elename)
- end
- unless o
- unless @ignored.key?(elename)
- warn("ignored element: #{elename}")
- @ignored[elename] = elename
- end
- o = Documentation.new # which accepts any element.
- end
- # node could be a pseudo element. pseudo element has its own parent.
- o.root = parent.root
- o.parent = parent if o.parent.nil?
- end
- attrs.each do |key, value|
- attr_ele = ns.parse(key, true)
- value_ele = ns.parse(value, true)
- value_ele.source = value # for recovery; value may not be a QName
- unless o.parse_attr(attr_ele, value_ele)
- unless @ignored.key?(attr_ele)
- warn("ignored attr: #{attr_ele}")
- @ignored[attr_ele] = attr_ele
- 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
diff --git a/lib/wsdl/part.rb b/lib/wsdl/part.rb
deleted file mode 100644
index 5dafd4ee73..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.source
- 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 883cc3232d..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) or raise RuntimeError.new("#{@binding} not found")
- 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.source)
- 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 03e37690a8..0000000000
--- a/lib/wsdl/portType.rb
+++ /dev/null
@@ -1,73 +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 } or
- raise RuntimeError.new("#{@name} not found")
- 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.source)
- else
- nil
- end
- end
-end
-
-
-end
diff --git a/lib/wsdl/service.rb b/lib/wsdl/service.rb
deleted file mode 100644
index 652b127331..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.source)
- 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 0b2b59caf0..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.source
- 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 7e15a99701..0000000000
--- a/lib/wsdl/soap/binding.rb
+++ /dev/null
@@ -1,49 +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.source)
- @style = value.source.intern
- else
- raise Parser::AttributeConstraintError.new(
- "Unexpected value #{ value }.")
- end
- when TransportAttrName
- @transport = value.source
- 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 824f8121a2..0000000000
--- a/lib/wsdl/soap/body.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 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.source
- when UseAttrName
- if ['literal', 'encoded'].include?(value.source)
- @use = value.source.intern
- else
- raise RuntimeError.new("unknown use of soap:body: #{value.source}")
- end
- when EncodingStyleAttrName
- @encodingstyle = value.source
- when NamespaceAttrName
- @namespace = value.source
- 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 2c4dff2f62..0000000000
--- a/lib/wsdl/soap/cgiStubCreator.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-# WSDL4R - Creating CGI stub code from WSDL.
-# Copyright (C) 2002, 2003, 2005 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)
- warn("CGI stub can have only 1 port. Creating stub for the first port... Rests are ignored.")
- 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 |definitions|
- opt = definitions.last
- if opt[:request_style] == :document
- @router.add_document_operation(servant, *definitions)
- else
- @router.add_rpc_operation(servant, *definitions)
- end
- 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 aeb67c0613..0000000000
--- a/lib/wsdl/soap/classDefCreator.rb
+++ /dev/null
@@ -1,314 +0,0 @@
-# WSDL4R - Creating class definition from WSDL
-# Copyright (C) 2002, 2003, 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/data'
-require 'wsdl/soap/classDefCreatorSupport'
-require 'xsd/codegen'
-
-
-module WSDL
-module SOAP
-
-
-class ClassDefCreator
- include ClassDefCreatorSupport
-
- def initialize(definitions)
- @elements = definitions.collect_elements
- @simpletypes = definitions.collect_simpletypes
- @complextypes = definitions.collect_complextypes
- @faulttypes = nil
- if definitions.respond_to?(:collect_faulttypes)
- @faulttypes = definitions.collect_faulttypes
- end
- end
-
- def dump(type = nil)
- result = "require 'xsd/qname'\n"
- if type
- result = dump_classdef(type.name, type)
- else
- str = dump_element
- unless str.empty?
- result << "\n" unless result.empty?
- result << str
- end
- str = dump_complextype
- unless str.empty?
- result << "\n" unless result.empty?
- result << str
- end
- str = dump_simpletype
- unless str.empty?
- result << "\n" unless result.empty?
- result << str
- end
- end
- result
- end
-
-private
-
- def dump_element
- @elements.collect { |ele|
- if ele.local_complextype
- dump_classdef(ele.name, ele.local_complextype,
- ele.elementform == 'qualified')
- elsif ele.local_simpletype
- dump_simpletypedef(ele.name, ele.local_simpletype)
- else
- nil
- end
- }.compact.join("\n")
- end
-
- def dump_simpletype
- @simpletypes.collect { |type|
- dump_simpletypedef(type.name, type)
- }.compact.join("\n")
- end
-
- def dump_complextype
- @complextypes.collect { |type|
- case type.compoundtype
- when :TYPE_STRUCT, :TYPE_EMPTY
- dump_classdef(type.name, type)
- when :TYPE_ARRAY
- dump_arraydef(type)
- when :TYPE_SIMPLE
- dump_simpleclassdef(type)
- when :TYPE_MAP
- # mapped as a general Hash
- nil
- else
- raise RuntimeError.new(
- "unknown kind of complexContent: #{type.compoundtype}")
- end
- }.compact.join("\n")
- end
-
- def dump_simpletypedef(qname, simpletype)
- if !simpletype.restriction or simpletype.restriction.enumeration.empty?
- return nil
- end
- c = XSD::CodeGen::ModuleDef.new(create_class_name(qname))
- c.comment = "#{qname}"
- const = {}
- simpletype.restriction.enumeration.each do |value|
- constname = safeconstname(value)
- const[constname] ||= 0
- if (const[constname] += 1) > 1
- constname += "_#{const[constname]}"
- end
- c.def_const(constname, ndq(value))
- end
- c.dump
- end
-
- def dump_simpleclassdef(type_or_element)
- qname = type_or_element.name
- base = create_class_name(type_or_element.simplecontent.base)
- c = XSD::CodeGen::ClassDef.new(create_class_name(qname), base)
- c.comment = "#{qname}"
- c.dump
- end
-
- def dump_classdef(qname, typedef, qualified = false)
- if @faulttypes and @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}"
- c.def_classvar('schema_type', ndq(qname.name))
- c.def_classvar('schema_ns', ndq(qname.namespace))
- c.def_classvar('schema_qualified', dq('true')) if qualified
- schema_element = []
- init_lines = ''
- params = []
- typedef.each_element do |element|
- if element.type == XSD::AnyTypeName
- type = nil
- elsif klass = element_basetype(element)
- type = klass.name
- elsif element.type
- type = create_class_name(element.type)
- else
- type = nil # means anyType.
- # do we define a class for local complexType from it's name?
- # type = create_class_name(element.name)
- # <element>
- # <complexType>
- # <seq...>
- # </complexType>
- # </element>
- end
- name = name_element(element).name
- attrname = safemethodname?(name) ? name : safemethodname(name)
- varname = safevarname(name)
- c.def_attr(attrname, true, varname)
- init_lines << "@#{varname} = #{varname}\n"
- if element.map_as_array?
- params << "#{varname} = []"
- type << '[]' if type
- else
- params << "#{varname} = nil"
- end
- # nil means @@schema_ns + varname
- eleqname =
- (varname == name && element.name.namespace == qname.namespace) ?
- nil : element.name
- schema_element << [varname, eleqname, type]
- end
- unless typedef.attributes.empty?
- define_attribute(c, typedef.attributes)
- init_lines << "@__xmlattr = {}\n"
- end
- c.def_classvar('schema_element',
- '[' +
- schema_element.collect { |varname, name, type|
- '[' +
- (
- if name
- varname.dump + ', [' + ndq(type) + ', ' + dqname(name) + ']'
- else
- varname.dump + ', ' + ndq(type)
- end
- ) +
- ']'
- }.join(', ') +
- ']'
- )
- c.def_method('initialize', *params) do
- init_lines
- end
- c.dump
- end
-
- def element_basetype(ele)
- if klass = basetype_class(ele.type)
- klass
- elsif ele.local_simpletype
- basetype_class(ele.local_simpletype.base)
- else
- nil
- end
- end
-
- def attribute_basetype(attr)
- if klass = basetype_class(attr.type)
- klass
- elsif attr.local_simpletype
- basetype_class(attr.local_simpletype.base)
- else
- nil
- end
- end
-
- def basetype_class(type)
- return nil if type.nil?
- if simpletype = @simpletypes[type]
- basetype_mapped_class(simpletype.base)
- else
- basetype_mapped_class(type)
- end
- end
-
- def define_attribute(c, attributes)
- schema_attribute = []
- attributes.each do |attribute|
- name = name_attribute(attribute)
- if klass = attribute_basetype(attribute)
- type = klass.name
- else
- type = nil
- end
- methodname = safemethodname('xmlattr_' + name.name)
- c.def_method(methodname) do <<-__EOD__
- (@__xmlattr ||= {})[#{dqname(name)}]
- __EOD__
- end
- c.def_method(methodname + '=', 'value') do <<-__EOD__
- (@__xmlattr ||= {})[#{dqname(name)}] = value
- __EOD__
- end
- schema_attribute << [name, type]
- end
- c.def_classvar('schema_attribute',
- '{' +
- schema_attribute.collect { |name, type|
- dqname(name) + ' => ' + ndq(type)
- }.join(', ') +
- '}'
- )
- end
-
- def name_element(element)
- return element.name if element.name
- return element.ref if element.ref
- raise RuntimeError.new("cannot define name of #{element}")
- end
-
- def name_attribute(attribute)
- return attribute.name if attribute.name
- return attribute.ref if attribute.ref
- raise RuntimeError.new("cannot define name of #{attribute}")
- end
-
- DEFAULT_ITEM_NAME = XSD::QName.new(nil, 'item')
-
- def dump_arraydef(complextype)
- qname = complextype.name
- c = XSD::CodeGen::ClassDef.new(create_class_name(qname), '::Array')
- c.comment = "#{qname}"
- child_type = complextype.child_type
- c.def_classvar('schema_type', ndq(child_type.name))
- c.def_classvar('schema_ns', ndq(child_type.namespace))
- child_element = complextype.find_aryelement
- schema_element = []
- if child_type == XSD::AnyTypeName
- type = nil
- elsif child_element and (klass = element_basetype(child_element))
- type = klass.name
- elsif child_type
- type = create_class_name(child_type)
- else
- type = nil
- end
- if child_element
- if child_element.map_as_array?
- type << '[]' if type
- end
- child_element_name = child_element.name
- else
- child_element_name = DEFAULT_ITEM_NAME
- end
- schema_element << [child_element_name.name, child_element_name, type]
- c.def_classvar('schema_element',
- '[' +
- schema_element.collect { |varname, name, type|
- '[' +
- (
- if name
- varname.dump + ', [' + ndq(type) + ', ' + dqname(name) + ']'
- else
- varname.dump + ', ' + ndq(type)
- end
- ) +
- ']'
- }.join(', ') +
- ']'
- )
- 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 8f335653c8..0000000000
--- a/lib/wsdl/soap/classDefCreatorSupport.rb
+++ /dev/null
@@ -1,126 +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
-
- def dq(ele)
- ele.dump
- end
-
- def ndq(ele)
- ele.nil? ? 'nil' : dq(ele)
- end
-
- def sym(ele)
- ':' + ele
- end
-
- def dqname(qname)
- qname.dump
- end
-
-private
-
- def dump_inout_type(param)
- if param
- message = param.find_message
- params = ""
- message.parts.each do |part|
- name = safevarname(part.name)
- if part.type
- typename = safeconstname(part.type.name)
- params << add_at("# #{name}", "#{typename} - #{part.type}\n", 20)
- elsif part.element
- typename = safeconstname(part.element.name)
- params << add_at("# #{name}", "#{typename} - #{part.element}\n", 20)
- end
- 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 916f0d4dc0..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)
-
-# run ruby with -d to see SOAP wiredumps.
-obj.wiredump_dev = STDERR if $DEBUG
-
-__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|
- safevarname(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 b2e13d0564..0000000000
--- a/lib/wsdl/soap/complexType.rb
+++ /dev/null
@@ -1,161 +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'
-require 'soap/mapping'
-
-
-module WSDL
-module XMLSchema
-
-
-class ComplexType < Info
- def compoundtype
- @compoundtype ||= check_type
- end
-
- def check_type
- if content
- if attributes.empty? and
- content.elements.size == 1 and content.elements[0].maxoccurs != '1'
- if name == ::SOAP::Mapping::MapQName
- :TYPE_MAP
- else
- :TYPE_ARRAY
- end
- else
- :TYPE_STRUCT
- end
- elsif complexcontent
- if complexcontent.base == ::SOAP::ValueArrayName
- :TYPE_ARRAY
- else
- complexcontent.basetype.check_type
- end
- elsif simplecontent
- :TYPE_SIMPLE
- elsif !attributes.empty?
- :TYPE_STRUCT
- else # empty complexType definition (seen in partner.wsdl of salesforce)
- :TYPE_EMPTY
- 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
- end
- when :TYPE_ARRAY
- @contenttype ||= content_arytype
- when :TYPE_MAP
- item_ele = find_element_by_name("item") or
- raise RuntimeError.new("'item' element not found in Map definition.")
- content = item_ele.local_complextype or
- raise RuntimeError.new("No complexType definition for 'item'.")
- if ele = content.find_element(name)
- ele.type
- elsif ele = content.find_element_by_name(name.name)
- ele.type
- end
- else
- raise NotImplementedError.new("Unknown kind of complexType.")
- end
- end
-
- def child_defined_complextype(name)
- ele = nil
- case compoundtype
- when :TYPE_STRUCT, :TYPE_MAP
- 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
- if check_array_content(complexcontent.content)
- return element_simpletype(complexcontent.content.elements[0])
- end
- elsif check_array_content(content)
- return element_simpletype(content.elements[0])
- end
- raise RuntimeError.new("Assert: Unknown array definition.")
- end
-
- def find_aryelement
- unless compoundtype == :TYPE_ARRAY
- raise RuntimeError.new("Assert: not for array")
- end
- if complexcontent
- if check_array_content(complexcontent.content)
- return complexcontent.content.elements[0]
- end
- elsif check_array_content(content)
- return content.elements[0]
- end
- nil # use default item name
- end
-
-private
-
- def element_simpletype(element)
- if element.type
- element.type
- elsif element.local_simpletype
- element.local_simpletype.base
- else
- nil
- end
- end
-
- def check_array_content(content)
- content and content.elements.size == 1 and
- content.elements[0].maxoccurs != '1'
- end
-
- 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 48512d3751..0000000000
--- a/lib/wsdl/soap/data.rb
+++ /dev/null
@@ -1,42 +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/element'
-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 b014d5af6b..0000000000
--- a/lib/wsdl/soap/definitions.rb
+++ /dev/null
@@ -1,149 +0,0 @@
-# WSDL4R - WSDL additional definitions for SOAP.
-# Copyright (C) 2002-2005 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 |name|
- faultparts = message(name).parts
- if faultparts.size != 1
- raise RuntimeError.new("expecting fault message to have only 1 part")
- end
- if result.index(faultparts[0].type).nil?
- result << faultparts[0].type
- end
- end
- result
- end
-
-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(op_bind.soapoperation_name)
- message = messages[operation.input.message]
- type.sequence_elements = elements_from_message(message)
- types << type
- end
- if op_bind.output
- type = XMLSchema::ComplexType.new(operation.outputname)
- message = messages[operation.output.message]
- type.sequence_elements = elements_from_message(message)
- types << type
- end
- end
- end
- types
- end
-
- def op_bind_rpc?(op_bind)
- op_bind.soapoperation_style == :rpc
- end
-
- def elements_from_message(message)
- message.parts.collect { |part|
- if part.element
- collect_elements[part.element]
- elsif part.name.nil? or part.type.nil?
- raise RuntimeError.new("part of a message must be an element or typed")
- else
- qname = XSD::QName.new(nil, part.name)
- XMLSchema::Element.new(qname, part.type)
- end
- }
- end
-end
-
-
-end
diff --git a/lib/wsdl/soap/driverCreator.rb b/lib/wsdl/soap/driverCreator.rb
deleted file mode 100644
index eba7c158a2..0000000000
--- a/lib/wsdl/soap/driverCreator.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-# WSDL4R - Creating driver code from WSDL.
-# Copyright (C) 2002, 2003, 2005 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 }
- return '' unless binding.soapbinding # not a SOAP binding
- address = @definitions.porttype(name).locations[0]
-
- 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", ndq(address))
- 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 |definitions|
- opt = definitions.last
- if opt[:request_style] == :document
- add_document_operation(*definitions)
- else
- add_rpc_operation(*definitions)
- qname = definitions[0]
- name = definitions[2]
- if qname.name != name and qname.name.capitalize == name.capitalize
- ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
- __send__(name, *arg)
- end
- end
- end
- end
- EOD
- end
- c.dump
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/soap/element.rb b/lib/wsdl/soap/element.rb
deleted file mode 100644
index 0fa6017c5b..0000000000
--- a/lib/wsdl/soap/element.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# WSDL4R - XMLSchema element 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/xmlSchema/element'
-
-
-module WSDL
-module XMLSchema
-
-
-class Element < Info
- def map_as_array?
- maxoccurs != '1'
- end
-
- def attributes
- @local_complextype.attributes
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/soap/fault.rb b/lib/wsdl/soap/fault.rb
deleted file mode 100644
index 2862b659ab..0000000000
--- a/lib/wsdl/soap/fault.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 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 targetnamespace
- parent.targetnamespace
- end
-
- def parse_element(element)
- nil
- end
-
- def parse_attr(attr, value)
- case attr
- when NameAttrName
- @name = XSD::QName.new(targetnamespace, value.source)
- when UseAttrName
- @use = value.source
- when EncodingStyleAttrName
- @encodingstyle = value.source
- when NamespaceAttrName
- @namespace = value.source
- 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 8d7c4e9d70..0000000000
--- a/lib/wsdl/soap/header.rb
+++ /dev/null
@@ -1,86 +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 targetnamespace
- parent.targetnamespace
- end
-
- def find_message
- root.message(@message) or raise RuntimeError.new("#{@message} not found")
- end
-
- def find_part
- find_message.parts.each do |part|
- if part.name == @part
- return part
- end
- end
- raise RuntimeError.new("#{@part} not found")
- 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
- if value.namespace.nil?
- value = XSD::QName.new(targetnamespace, value.source)
- end
- @message = value
- when PartAttrName
- @part = value.source
- when UseAttrName
- @use = value.source
- when EncodingStyleAttrName
- @encodingstyle = value.source
- when NamespaceAttrName
- @namespace = value.source
- 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 d6b14f2646..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.source
- when UseAttrName
- @use = value.source
- when EncodingStyleAttrName
- @encodingstyle = value.source
- when NamespaceAttrName
- @namespace = value.source
- 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 8669339ce4..0000000000
--- a/lib/wsdl/soap/mappingRegistryCreator.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-# WSDL4R - Creating MappingRegistry code from WSDL.
-# Copyright (C) 2002, 2003, 2005 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)
- when :TYPE_MAP, :TYPE_EMPTY
- nil
- 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 => #{dqname(ele)} }
-)
-__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 => #{dqname(type)} }
-)
-__EOD__
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/soap/methodDefCreator.rb b/lib/wsdl/soap/methodDefCreator.rb
deleted file mode 100644
index f3ffadbe69..0000000000
--- a/lib/wsdl/soap/methodDefCreator.rb
+++ /dev/null
@@ -1,228 +0,0 @@
-# WSDL4R - Creating driver code from WSDL.
-# Copyright (C) 2002, 2003, 2005 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 'soap/rpc/element'
-
-
-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 = []
- end
-
- def dump(porttype)
- @types.clear
- result = ""
- operations = @definitions.porttype(porttype).operations
- binding = @definitions.porttype_binding(porttype)
- operations.each do |operation|
- op_bind = binding.operations[operation.name]
- next unless op_bind # no binding is defined
- next unless op_bind.soapoperation # not a SOAP operation binding
- result << ",\n" unless result.empty?
- result << dump_method(operation, op_bind).chomp
- end
- return result, @types
- end
-
- def collect_rpcparameter(operation)
- result = operation.inputparts.collect { |part|
- collect_type(part.type)
- param_set(::SOAP::RPC::SOAPMethod::IN, part.name, rpcdefinedtype(part))
- }
- outparts = operation.outputparts
- if outparts.size > 0
- retval = outparts[0]
- collect_type(retval.type)
- result << param_set(::SOAP::RPC::SOAPMethod::RETVAL, retval.name,
- rpcdefinedtype(retval))
- cdr(outparts).each { |part|
- collect_type(part.type)
- result << param_set(::SOAP::RPC::SOAPMethod::OUT, part.name,
- rpcdefinedtype(part))
- }
- end
- result
- end
-
- def collect_documentparameter(operation)
- param = []
- operation.inputparts.each do |input|
- param << param_set(::SOAP::RPC::SOAPMethod::IN, input.name,
- documentdefinedtype(input), elementqualified(input))
- end
- operation.outputparts.each do |output|
- param << param_set(::SOAP::RPC::SOAPMethod::OUT, output.name,
- documentdefinedtype(output), elementqualified(output))
- end
- param
- end
-
-private
-
- def dump_method(operation, binding)
- name = safemethodname(operation.name.name)
- name_as = operation.name.name
- style = binding.soapoperation_style
- inputuse = binding.input.soapbody_use
- outputuse = binding.output.soapbody_use
- namespace = binding.input.soapbody.namespace
- if style == :rpc
- qname = XSD::QName.new(namespace, name_as)
- paramstr = param2str(collect_rpcparameter(operation))
- else
- qname = nil
- paramstr = param2str(collect_documentparameter(operation))
- end
- if paramstr.empty?
- paramstr = '[]'
- else
- paramstr = "[ " << paramstr.split(/\r?\n/).join("\n ") << " ]"
- end
- definitions = <<__EOD__
-#{ndq(binding.soapaction)},
- #{dq(name)},
- #{paramstr},
- { :request_style => #{sym(style.id2name)}, :request_use => #{sym(inputuse.id2name)},
- :response_style => #{sym(style.id2name)}, :response_use => #{sym(outputuse.id2name)} }
-__EOD__
- if style == :rpc
- return <<__EOD__
-[ #{qname.dump},
- #{definitions}]
-__EOD__
- else
- return <<__EOD__
-[ #{definitions}]
-__EOD__
- end
- end
-
- def rpcdefinedtype(part)
- if mapped = basetype_mapped_class(part.type)
- ['::' + mapped.name]
- elsif definedtype = @simpletypes[part.type]
- ['::' + basetype_mapped_class(definedtype.base).name]
- elsif definedtype = @elements[part.element]
- #['::SOAP::SOAPStruct', part.element.namespace, part.element.name]
- ['nil', part.element.namespace, part.element.name]
- elsif definedtype = @complextypes[part.type]
- case definedtype.compoundtype
- when :TYPE_STRUCT, :TYPE_EMPTY # ToDo: empty should be treated as void.
- type = create_class_name(part.type)
- [type, part.type.namespace, part.type.name]
- when :TYPE_MAP
- [Hash.name, part.type.namespace, part.type.name]
- when :TYPE_ARRAY
- arytype = definedtype.find_arytype || XSD::AnyTypeName
- ns = arytype.namespace
- name = arytype.name.sub(/\[(?:,)*\]$/, '')
- type = create_class_name(XSD::QName.new(ns, name))
- [type + '[]', ns, name]
- else
- raise NotImplementedError.new("must not reach here")
- end
- else
- raise RuntimeError.new("part: #{part.name} cannot be resolved")
- end
- end
-
- def documentdefinedtype(part)
- if mapped = basetype_mapped_class(part.type)
- ['::' + mapped.name, nil, part.name]
- elsif definedtype = @simpletypes[part.type]
- ['::' + basetype_mapped_class(definedtype.base).name, nil, part.name]
- elsif definedtype = @elements[part.element]
- ['::SOAP::SOAPElement', part.element.namespace, part.element.name]
- elsif definedtype = @complextypes[part.type]
- ['::SOAP::SOAPElement', part.type.namespace, part.type.name]
- else
- raise RuntimeError.new("part: #{part.name} cannot be resolved")
- end
- end
-
- def elementqualified(part)
- if mapped = basetype_mapped_class(part.type)
- false
- elsif definedtype = @simpletypes[part.type]
- false
- elsif definedtype = @elements[part.element]
- definedtype.elementform == 'qualified'
- elsif definedtype = @complextypes[part.type]
- false
- else
- raise RuntimeError.new("part: #{part.name} cannot be resolved")
- end
- end
-
- def param_set(io_type, name, type, ele = nil)
- [io_type, name, type, ele]
- end
-
- def collect_type(type)
- # ignore inline type definition.
- return if type.nil?
- return if @types.include?(type)
- @types << type
- return unless @complextypes[type]
- @complextypes[type].each_element do |element|
- collect_type(element.type)
- end
- end
-
- def param2str(params)
- params.collect { |param|
- io, name, type, ele = param
- unless ele.nil?
- "[#{dq(io)}, #{dq(name)}, #{type2str(type)}, #{ele2str(ele)}]"
- else
- "[#{dq(io)}, #{dq(name)}, #{type2str(type)}]"
- end
- }.join(",\n")
- end
-
- def type2str(type)
- if type.size == 1
- "[#{dq(type[0])}]"
- else
- "[#{dq(type[0])}, #{ndq(type[1])}, #{dq(type[2])}]"
- end
- end
-
- def ele2str(ele)
- qualified = ele
- if qualified
- "true"
- else
- "false"
- end
- 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 502d34a07d..0000000000
--- a/lib/wsdl/soap/operation.rb
+++ /dev/null
@@ -1,122 +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.source)
- @style = value.source.intern
- else
- raise Parser::AttributeConstraintError.new(
- "Unexpected value #{ value }.")
- end
- when SOAPActionAttrName
- @soapaction = value.source
- 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 = XSD::QName.new(soapbody.namespace, op_name.name)
- 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
- OperationInfo.new(operation_style, op_name, optype_name, headerparts, bodyparts, faultpart, parent.soapaction)
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/soap/servantSkeltonCreator.rb b/lib/wsdl/soap/servantSkeltonCreator.rb
deleted file mode 100644
index 88294ffed8..0000000000
--- a/lib/wsdl/soap/servantSkeltonCreator.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-# WSDL4R - Creating servant skelton code from WSDL.
-# Copyright (C) 2002, 2003, 2005 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 = safemethodname(operation.name.name)
- input = operation.input
- params = input.find_message.parts.collect { |part|
- safevarname(part.name)
- }
- m = XSD::CodeGen::MethodDef.new(name, params) do <<-EOD
- p [#{params.join(", ")}]
- 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 0b751b5153..0000000000
--- a/lib/wsdl/soap/standaloneServerStubCreator.rb
+++ /dev/null
@@ -1,85 +0,0 @@
-# WSDL4R - Creating standalone server stub code from WSDL.
-# Copyright (C) 2002, 2003, 2005 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)
- warn("- Standalone stub can have only 1 port for now. So creating stub for the first port and rests are ignored.")
- warn("- 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 manually.")
- 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 |definitions|
- opt = definitions.last
- if opt[:request_style] == :document
- @router.add_document_operation(servant, *definitions)
- else
- @router.add_rpc_operation(servant, *definitions)
- end
- end
- self.mapping_registry = #{class_name}::MappingRegistry
- EOD
- end
- c1.dump + "\n" + c2.dump + format(<<-EOD)
-
- if $0 == __FILE__
- # Change listen port.
- server = #{class_name}App.new('app', nil, '0.0.0.0', 10080)
- trap(:INT) do
- server.shutdown
- end
- server.start
- end
- EOD
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/soap/wsdl2ruby.rb b/lib/wsdl/soap/wsdl2ruby.rb
deleted file mode 100644
index 16b05fb032..0000000000
--- a/lib/wsdl/soap/wsdl2ruby.rb
+++ /dev/null
@@ -1,176 +0,0 @@
-# WSDL4R - WSDL to ruby mapping library.
-# Copyright (C) 2002-2005 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 'logger'
-require 'xsd/qname'
-require 'wsdl/importer'
-require 'wsdl/soap/classDefCreator'
-require 'wsdl/soap/servantSkeltonCreator'
-require 'wsdl/soap/driverCreator'
-require 'wsdl/soap/clientSkeltonCreator'
-require 'wsdl/soap/standaloneServerStubCreator'
-require 'wsdl/soap/cgiStubCreator'
-
-
-module WSDL
-module SOAP
-
-
-class WSDL2Ruby
- attr_accessor :location
- attr_reader :opt
- attr_accessor :logger
- attr_accessor :basedir
-
- def run
- unless @location
- raise RuntimeError, "WSDL location not given"
- end
- @wsdl = import(@location)
- @name = @wsdl.name ? @wsdl.name.name : 'default'
- create_file
- end
-
-private
-
- def initialize
- @location = nil
- @opt = {}
- @logger = Logger.new(STDERR)
- @basedir = nil
- @wsdl = nil
- @name = nil
- end
-
- def create_file
- create_classdef if @opt.key?('classdef')
- create_servant_skelton(@opt['servant_skelton']) if @opt.key?('servant_skelton')
- create_cgi_stub(@opt['cgi_stub']) if @opt.key?('cgi_stub')
- create_standalone_server_stub(@opt['standalone_server_stub']) if @opt.key?('standalone_server_stub')
- create_driver(@opt['driver']) if @opt.key?('driver')
- create_client_skelton(@opt['client_skelton']) if @opt.key?('client_skelton')
- end
-
- def create_classdef
- @logger.info { "Creating class definition." }
- @classdef_filename = @name + '.rb'
- check_file(@classdef_filename) or return
- write_file(@classdef_filename) do |f|
- f << WSDL::SOAP::ClassDefCreator.new(@wsdl).dump
- end
- end
-
- def create_client_skelton(servicename)
- @logger.info { "Creating client skelton." }
- servicename ||= @wsdl.services[0].name.name
- @client_skelton_filename = servicename + 'Client.rb'
- check_file(@client_skelton_filename) or return
- write_file(@client_skelton_filename) do |f|
- f << shbang << "\n"
- f << "require '#{@driver_filename}'\n\n" if @driver_filename
- f << WSDL::SOAP::ClientSkeltonCreator.new(@wsdl).dump(
- create_name(servicename))
- end
- end
-
- def create_servant_skelton(porttypename)
- @logger.info { "Creating servant skelton." }
- @servant_skelton_filename = (porttypename || @name + 'Servant') + '.rb'
- check_file(@servant_skelton_filename) or return
- write_file(@servant_skelton_filename) do |f|
- f << "require '#{@classdef_filename}'\n\n" if @classdef_filename
- f << WSDL::SOAP::ServantSkeltonCreator.new(@wsdl).dump(
- create_name(porttypename))
- end
- end
-
- def create_cgi_stub(servicename)
- @logger.info { "Creating CGI stub." }
- servicename ||= @wsdl.services[0].name.name
- @cgi_stubFilename = servicename + '.cgi'
- check_file(@cgi_stubFilename) or return
- write_file(@cgi_stubFilename) do |f|
- f << shbang << "\n"
- if @servant_skelton_filename
- f << "require '#{@servant_skelton_filename}'\n\n"
- end
- f << WSDL::SOAP::CGIStubCreator.new(@wsdl).dump(create_name(servicename))
- end
- end
-
- def create_standalone_server_stub(servicename)
- @logger.info { "Creating standalone stub." }
- servicename ||= @wsdl.services[0].name.name
- @standalone_server_stub_filename = servicename + '.rb'
- check_file(@standalone_server_stub_filename) or return
- write_file(@standalone_server_stub_filename) do |f|
- f << shbang << "\n"
- f << "require '#{@servant_skelton_filename}'\n\n" if @servant_skelton_filename
- f << WSDL::SOAP::StandaloneServerStubCreator.new(@wsdl).dump(
- create_name(servicename))
- end
- end
-
- def create_driver(porttypename)
- @logger.info { "Creating driver." }
- @driver_filename = (porttypename || @name) + 'Driver.rb'
- check_file(@driver_filename) or return
- write_file(@driver_filename) do |f|
- f << "require '#{@classdef_filename}'\n\n" if @classdef_filename
- f << WSDL::SOAP::DriverCreator.new(@wsdl).dump(
- create_name(porttypename))
- end
- end
-
- def write_file(filename)
- if @basedir
- filename = File.join(basedir, filename)
- end
- File.open(filename, "w") do |f|
- yield f
- end
- end
-
- def check_file(filename)
- if @basedir
- filename = File.join(basedir, filename)
- end
- if FileTest.exist?(filename)
- if @opt.key?('force')
- @logger.warn {
- "File '#{filename}' exists but overrides it."
- }
- true
- else
- @logger.warn {
- "File '#{filename}' exists. #{$0} did not override it."
- }
- false
- end
- else
- @logger.info { "Creates file '#{filename}'." }
- true
- end
- end
-
- def shbang
- "#!/usr/bin/env ruby"
- end
-
- def create_name(name)
- name ? XSD::QName.new(@wsdl.targetnamespace, name) : nil
- end
-
- def import(location)
- WSDL::Importer.import(location)
- 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 bb9566feac..0000000000
--- a/lib/wsdl/xmlSchema/all.rb
+++ /dev/null
@@ -1,69 +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 elementformdefault
- parent.elementformdefault
- 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.source
- when MinOccursAttrName
- @minoccurs = value.source
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/annotation.rb b/lib/wsdl/xmlSchema/annotation.rb
deleted file mode 100644
index 633bd196f1..0000000000
--- a/lib/wsdl/xmlSchema/annotation.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# WSDL4R - WSDL SOAP documentation element.
-# Copyright (C) 2003, 2005 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 Annotation < 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
diff --git a/lib/wsdl/xmlSchema/any.rb b/lib/wsdl/xmlSchema/any.rb
deleted file mode 100644
index 72d25e8dde..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.source
- when MinOccursAttrName
- @minoccurs = value.source
- when NamespaceAttrName
- @namespace = value.source
- when ProcessContentsAttrName
- @process_contents = value.source
- 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 f9048661a2..0000000000
--- a/lib/wsdl/xmlSchema/attribute.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-# WSDL4R - XMLSchema attribute definition for WSDL.
-# Copyright (C) 2002, 2003, 2005 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
- class << self
- if RUBY_VERSION > "1.7.0"
- def attr_reader_ref(symbol)
- name = symbol.to_s
- define_method(name) {
- instance_variable_get("@#{name}") ||
- (refelement ? refelement.__send__(name) : nil)
- }
- end
- else
- def attr_reader_ref(symbol)
- name = symbol.to_s
- module_eval <<-EOS
- def #{name}
- @#{name} || (refelement ? refelement.#{name} : nil)
- end
- EOS
- end
- end
- end
-
- attr_writer :use
- attr_writer :form
- attr_writer :name
- attr_writer :type
- attr_writer :local_simpletype
- attr_writer :default
- attr_writer :fixed
-
- attr_reader_ref :use
- attr_reader_ref :form
- attr_reader_ref :name
- attr_reader_ref :type
- attr_reader_ref :local_simpletype
- attr_reader_ref :default
- attr_reader_ref :fixed
-
- attr_accessor :ref
- attr_accessor :arytype
-
- def initialize
- super
- @use = nil
- @form = nil
- @name = nil
- @type = nil
- @local_simpletype = nil
- @default = nil
- @fixed = nil
- @ref = nil
- @refelement = nil
- @arytype = nil
- end
-
- def refelement
- @refelement ||= root.collect_attributes[@ref]
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def parse_element(element)
- case element
- when SimpleTypeName
- @local_simpletype = SimpleType.new
- @local_simpletype
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when RefAttrName
- @ref = value
- when UseAttrName
- @use = value.source
- when FormAttrName
- @form = value.source
- when NameAttrName
- if directelement?
- @name = XSD::QName.new(targetnamespace, value.source)
- else
- @name = XSD::QName.new(nil, value.source)
- end
- when TypeAttrName
- @type = value
- when DefaultAttrName
- @default = value.source
- when FixedAttrName
- @fixed = value.source
- when ArrayTypeAttrName
- @arytype = if value.namespace.nil?
- XSD::QName.new(XSD::Namespace, value.source)
- else
- value
- end
- else
- nil
- end
- end
-
-private
-
- def directelement?
- parent.is_a?(Schema)
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/choice.rb b/lib/wsdl/xmlSchema/choice.rb
deleted file mode 100644
index f6d27fa38c..0000000000
--- a/lib/wsdl/xmlSchema/choice.rb
+++ /dev/null
@@ -1,69 +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 elementformdefault
- parent.elementformdefault
- 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.source
- when MinOccursAttrName
- @minoccurs = value.source
- 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 f7fb6c16b4..0000000000
--- a/lib/wsdl/xmlSchema/complexContent.rb
+++ /dev/null
@@ -1,92 +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
- @basetype = nil
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def elementformdefault
- parent.elementformdefault
- end
-
- def basetype
- @basetype ||= root.collect_complextypes[@base]
- 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 dc9ec954fc..0000000000
--- a/lib/wsdl/xmlSchema/complexType.rb
+++ /dev/null
@@ -1,139 +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 :simplecontent
- attr_reader :content
- attr_accessor :final
- attr_accessor :mixed
- attr_reader :attributes
-
- def initialize(name = nil)
- super()
- @name = name
- @complexcontent = nil
- @simplecontent = nil
- @content = nil
- @final = nil
- @mixed = false
- @attributes = XSD::NamedElements.new
- end
-
- def targetnamespace
- # inner elements can be qualified
- # parent.is_a?(WSDL::XMLSchema::Element) ? nil : parent.targetnamespace
- parent.targetnamespace
- end
-
- def elementformdefault
- parent.elementformdefault
- 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
- when SequenceName
- @content = Sequence.new
- when ChoiceName
- @content = Choice.new
- when ComplexContentName
- @complexcontent = ComplexContent.new
- when SimpleContentName
- @simplecontent = SimpleContent.new
- when AttributeName
- o = Attribute.new
- @attributes << o
- o
- else
- nil
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when FinalAttrName
- @final = value.source
- when MixedAttrName
- @mixed = (value.source == 'true')
- when NameAttrName
- @name = XSD::QName.new(targetnamespace, value.source)
- 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 2f1dfb4b6c..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.source
- when MixedAttrName
- @mixed = (value.source == '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 23ab1adf0b..0000000000
--- a/lib/wsdl/xmlSchema/data.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-# WSDL4R - XMLSchema data definitions.
-# Copyright (C) 2002, 2003, 2005 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/annotation'
-require 'wsdl/xmlSchema/schema'
-require 'wsdl/xmlSchema/import'
-require 'wsdl/xmlSchema/include'
-require 'wsdl/xmlSchema/simpleType'
-require 'wsdl/xmlSchema/simpleRestriction'
-require 'wsdl/xmlSchema/simpleExtension'
-require 'wsdl/xmlSchema/complexType'
-require 'wsdl/xmlSchema/complexContent'
-require 'wsdl/xmlSchema/simpleContent'
-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'
-require 'wsdl/xmlSchema/length'
-require 'wsdl/xmlSchema/pattern'
-
-module WSDL
-module XMLSchema
-
-
-AllName = XSD::QName.new(XSD::Namespace, 'all')
-AnnotationName = XSD::QName.new(XSD::Namespace, 'annotation')
-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')
-IncludeName = XSD::QName.new(XSD::Namespace, 'include')
-LengthName = XSD::QName.new(XSD::Namespace, 'length')
-PatternName = XSD::QName.new(XSD::Namespace, 'pattern')
-RestrictionName = XSD::QName.new(XSD::Namespace, 'restriction')
-SequenceName = XSD::QName.new(XSD::Namespace, 'sequence')
-SchemaName = XSD::QName.new(XSD::Namespace, 'schema')
-SimpleContentName = XSD::QName.new(XSD::Namespace, 'simpleContent')
-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')
-ProcessContentsAttrName = XSD::QName.new(nil, 'processContents')
-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 fffb6485d0..0000000000
--- a/lib/wsdl/xmlSchema/element.rb
+++ /dev/null
@@ -1,154 +0,0 @@
-# WSDL4R - XMLSchema element definition for WSDL.
-# Copyright (C) 2002, 2003, 2005 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
- class << self
- if RUBY_VERSION > "1.7.0"
- def attr_reader_ref(symbol)
- name = symbol.to_s
- define_method(name) {
- instance_variable_get("@#{name}") ||
- (refelement ? refelement.__send__(name) : nil)
- }
- end
- else
- def attr_reader_ref(symbol)
- name = symbol.to_s
- module_eval <<-EOS
- def #{name}
- @#{name} || (refelement ? refelement.#{name} : nil)
- end
- EOS
- end
- end
- end
-
- attr_writer :name # required
- attr_writer :form
- attr_writer :type
- attr_writer :local_simpletype
- attr_writer :local_complextype
- attr_writer :constraint
- attr_writer :maxoccurs
- attr_writer :minoccurs
- attr_writer :nillable
-
- attr_reader_ref :name
- attr_reader_ref :form
- attr_reader_ref :type
- attr_reader_ref :local_simpletype
- attr_reader_ref :local_complextype
- attr_reader_ref :constraint
- attr_reader_ref :maxoccurs
- attr_reader_ref :minoccurs
- attr_reader_ref :nillable
-
- attr_accessor :ref
-
- def initialize(name = nil, type = nil)
- super()
- @name = name
- @form = nil
- @type = type
- @local_simpletype = @local_complextype = nil
- @constraint = nil
- @maxoccurs = '1'
- @minoccurs = '1'
- @nillable = nil
- @ref = nil
- @refelement = nil
- end
-
- def refelement
- @refelement ||= (@ref ? root.collect_elements[@ref] : nil)
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def elementformdefault
- parent.elementformdefault
- end
-
- def elementform
- self.form.nil? ? parent.elementformdefault : self.form
- end
-
- def parse_element(element)
- case element
- when SimpleTypeName
- @local_simpletype = SimpleType.new
- @local_simpletype
- 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
- # namespace may be nil
- if directelement? or elementform == 'qualified'
- @name = XSD::QName.new(targetnamespace, value.source)
- else
- @name = XSD::QName.new(nil, value.source)
- end
- when FormAttrName
- @form = value.source
- when TypeAttrName
- @type = value
- when RefAttrName
- @ref = value
- when MaxOccursAttrName
- if parent.is_a?(All)
- if value.source != '1'
- raise Parser::AttrConstraintError.new(
- "cannot parse #{value} for #{attr}")
- end
- end
- @maxoccurs = value.source
- when MinOccursAttrName
- if parent.is_a?(All)
- unless ['0', '1'].include?(value.source)
- raise Parser::AttrConstraintError.new(
- "cannot parse #{value} for #{attr}")
- end
- end
- @minoccurs = value.source
- when NillableAttrName
- @nillable = (value.source == 'true')
- else
- nil
- end
- end
-
-private
-
- def directelement?
- parent.is_a?(Schema)
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/enumeration.rb b/lib/wsdl/xmlSchema/enumeration.rb
deleted file mode 100644
index 5a16476032..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.source
- value.source
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/import.rb b/lib/wsdl/xmlSchema/import.rb
deleted file mode 100644
index d3487af934..0000000000
--- a/lib/wsdl/xmlSchema/import.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# WSDL4R - XMLSchema import definition.
-# Copyright (C) 2002, 2003, 2005 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/importer'
-
-
-module WSDL
-module XMLSchema
-
-
-class Import < Info
- attr_reader :namespace
- attr_reader :schemalocation
- attr_reader :content
-
- def initialize
- super
- @namespace = nil
- @schemalocation = nil
- @content = nil
- end
-
- def parse_element(element)
- nil
- end
-
- def parse_attr(attr, value)
- case attr
- when NamespaceAttrName
- @namespace = value.source
- when SchemaLocationAttrName
- @schemalocation = URI.parse(value.source)
- if @schemalocation.relative? and !parent.location.nil? and
- !parent.location.relative?
- @schemalocation = parent.location + @schemalocation
- end
- if root.importedschema.key?(@schemalocation)
- @content = root.importedschema[@schemalocation]
- else
- root.importedschema[@schemalocation] = nil # placeholder
- @content = import(@schemalocation)
- root.importedschema[@schemalocation] = @content
- end
- @schemalocation
- else
- nil
- end
- end
-
-private
-
- def import(location)
- Importer.import(location, root)
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/importer.rb b/lib/wsdl/xmlSchema/importer.rb
deleted file mode 100644
index f57bfd972a..0000000000
--- a/lib/wsdl/xmlSchema/importer.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-# WSDL4R - XSD importer library.
-# Copyright (C) 2003, 2005 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 'soap/httpconfigloader'
-require 'wsdl/xmlSchema/parser'
-
-
-module WSDL
-module XMLSchema
-
-
-class Importer
- def self.import(location, originalroot = nil)
- new.import(location, originalroot)
- end
-
- def initialize
- @web_client = nil
- end
-
- def import(location, originalroot = nil)
- unless location.is_a?(URI)
- location = URI.parse(location)
- end
- content = parse(fetch(location), location, originalroot)
- content.location = location
- content
- end
-
-private
-
- def parse(content, location, originalroot)
- opt = {
- :location => location,
- :originalroot => originalroot
- }
- WSDL::XMLSchema::Parser.new(opt).parse(content)
- end
-
- def fetch(location)
- warn("importing: #{location}") if $DEBUG
- content = nil
- if location.scheme == 'file' or
- (location.relative? and FileTest.exist?(location.path))
- content = File.open(location.path).read
- elsif location.scheme and location.scheme.size == 1 and
- FileTest.exist?(location.to_s)
- # ToDo: remove this ugly workaround for a path with drive letter
- # (D://foo/bar)
- content = File.open(location.to_s).read
- else
- client = web_client.new(nil, "WSDL4R")
- client.proxy = ::SOAP::Env::HTTP_PROXY
- client.no_proxy = ::SOAP::Env::NO_PROXY
- if opt = ::SOAP::Property.loadproperty(::SOAP::PropertyName)
- ::SOAP::HTTPConfigLoader.set_options(client,
- opt["client.protocol.http"])
- end
- content = client.get_content(location)
- end
- content
- end
-
- 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
- warn("Loading http-access2 failed. Net/http is used.") if $DEBUG
- require 'soap/netHttpClient'
- ::SOAP::NetHttpClient
- end
- @web_client
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/include.rb b/lib/wsdl/xmlSchema/include.rb
deleted file mode 100644
index af1ef942bb..0000000000
--- a/lib/wsdl/xmlSchema/include.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# WSDL4R - XMLSchema include definition.
-# Copyright (C) 2005 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/importer'
-
-
-module WSDL
-module XMLSchema
-
-
-class Include < Info
- attr_reader :schemalocation
- attr_reader :content
-
- def initialize
- super
- @schemalocation = nil
- @content = nil
- end
-
- def parse_element(element)
- nil
- end
-
- def parse_attr(attr, value)
- case attr
- when SchemaLocationAttrName
- @schemalocation = URI.parse(value.source)
- if @schemalocation.relative?
- @schemalocation = parent.location + @schemalocation
- end
- @content = import(@schemalocation)
- @schemalocation
- else
- nil
- end
- end
-
-private
-
- def import(location)
- Importer.import(location)
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/length.rb b/lib/wsdl/xmlSchema/length.rb
deleted file mode 100644
index 7f61602da9..0000000000
--- a/lib/wsdl/xmlSchema/length.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# WSDL4R - XMLSchema length definition for WSDL.
-# Copyright (C) 2005 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 Length < Info
- def initialize
- super
- end
-
- def parse_element(element)
- nil
- end
-
- def parse_attr(attr, value)
- case attr
- when ValueAttrName
- value.source
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/parser.rb b/lib/wsdl/xmlSchema/parser.rb
deleted file mode 100644
index 057d9d9b70..0000000000
--- a/lib/wsdl/xmlSchema/parser.rb
+++ /dev/null
@@ -1,166 +0,0 @@
-# WSDL4R - WSDL XML Instance parser library.
-# Copyright (C) 2002, 2003, 2005 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 < 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
- @ignored = {}
- @location = opt[:location]
- @originalroot = opt[:originalroot]
- 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
- elename = ns.parse(name)
- if !parent
- if elename == SchemaName
- o = Schema.parse_element(elename)
- o.location = @location
- else
- raise UnknownElementError.new("unknown element: #{elename}")
- end
- o.root = @originalroot if @originalroot # o.root = o otherwise
- else
- if elename == AnnotationName
- # only the first annotation element is allowed for each element.
- o = Annotation.new
- else
- o = parent.parse_element(elename)
- end
- unless o
- unless @ignored.key?(elename)
- warn("ignored element: #{elename} of #{parent.class}")
- @ignored[elename] = elename
- end
- o = Documentation.new # which accepts any element.
- end
- # node could be a pseudo element. pseudo element has its own parent.
- o.root = parent.root
- o.parent = parent if o.parent.nil?
- end
- attrs.each do |key, value|
- attr_ele = ns.parse(key, true)
- value_ele = ns.parse(value, true)
- value_ele.source = value # for recovery; value may not be a QName
- if attr_ele == IdAttrName
- o.id = value_ele
- else
- unless o.parse_attr(attr_ele, value_ele)
- unless @ignored.key?(attr_ele)
- warn("ignored attr: #{attr_ele}")
- @ignored[attr_ele] = attr_ele
- end
- 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/pattern.rb b/lib/wsdl/xmlSchema/pattern.rb
deleted file mode 100644
index f826be4578..0000000000
--- a/lib/wsdl/xmlSchema/pattern.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# WSDL4R - XMLSchema pattern definition for WSDL.
-# Copyright (C) 2005 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 Pattern < Info
- def initialize
- super
- end
-
- def parse_element(element)
- nil
- end
-
- def parse_attr(attr, value)
- case attr
- when ValueAttrName
- parent.pattern = /\A#{value.source}\z/n
- value.source
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/schema.rb b/lib/wsdl/xmlSchema/schema.rb
deleted file mode 100644
index ec97d07aa5..0000000000
--- a/lib/wsdl/xmlSchema/schema.rb
+++ /dev/null
@@ -1,143 +0,0 @@
-# WSDL4R - XMLSchema schema definition for WSDL.
-# Copyright (C) 2002, 2003-2005 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
-
- attr_reader :importedschema
-
- def initialize
- super
- @targetnamespace = nil
- @complextypes = XSD::NamedElements.new
- @simpletypes = XSD::NamedElements.new
- @elements = XSD::NamedElements.new
- @attributes = XSD::NamedElements.new
- @imports = []
- @attributeformdefault = "unqualified"
- @elementformdefault = "unqualified"
- @importedschema = {}
- @location = nil
- @root = self
- end
-
- def location
- @location || (root.nil? ? nil : root.location)
- end
-
- def location=(location)
- @location = location
- end
-
- def parse_element(element)
- case element
- when ImportName
- o = Import.new
- @imports << o
- o
- when IncludeName
- o = Include.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
- @attributes << o
- o
- else
- nil
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when TargetNamespaceAttrName
- @targetnamespace = value.source
- when AttributeFormDefaultAttrName
- @attributeformdefault = value.source
- when ElementFormDefaultAttrName
- @elementformdefault = value.source
- else
- nil
- end
- end
-
- def collect_attributes
- result = XSD::NamedElements.new
- result.concat(@attributes)
- @imports.each do |import|
- result.concat(import.content.collect_attributes) if import.content
- end
- result
- end
-
- def collect_elements
- result = XSD::NamedElements.new
- result.concat(@elements)
- @imports.each do |import|
- result.concat(import.content.collect_elements) if import.content
- end
- result
- end
-
- def collect_complextypes
- result = XSD::NamedElements.new
- result.concat(@complextypes)
- @imports.each do |import|
- result.concat(import.content.collect_complextypes) if import.content
- end
- result
- end
-
- def collect_simpletypes
- result = XSD::NamedElements.new
- result.concat(@simpletypes)
- @imports.each do |import|
- result.concat(import.content.collect_simpletypes) if import.content
- end
- 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 823fa3b7f9..0000000000
--- a/lib/wsdl/xmlSchema/sequence.rb
+++ /dev/null
@@ -1,69 +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 elementformdefault
- parent.elementformdefault
- 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.source
- when MinOccursAttrName
- @minoccurs = value.source
- else
- nil
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/simpleContent.rb b/lib/wsdl/xmlSchema/simpleContent.rb
deleted file mode 100644
index e1f35c88b8..0000000000
--- a/lib/wsdl/xmlSchema/simpleContent.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-# WSDL4R - XMLSchema simpleContent definition for WSDL.
-# Copyright (C) 2004, 2005 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 SimpleContent < Info
- attr_reader :restriction
- attr_reader :extension
-
- def check_lexical_format(value)
- check(value)
- end
-
- def initialize
- super
- @restriction = nil
- @extension = nil
- end
-
- def base
- content.base
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def parse_element(element)
- case element
- when RestrictionName
- @restriction = SimpleRestriction.new
- @restriction
- when ExtensionName
- @extension = SimpleExtension.new
- @extension
- end
- end
-
-private
-
- def content
- @restriction || @extension
- end
-
- def check(value)
- unless content.valid?(value)
- raise XSD::ValueSpaceError.new("#{@name}: cannot accept '#{value}'")
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/simpleExtension.rb b/lib/wsdl/xmlSchema/simpleExtension.rb
deleted file mode 100644
index 3c53a7328c..0000000000
--- a/lib/wsdl/xmlSchema/simpleExtension.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# WSDL4R - XMLSchema simpleType extension definition for WSDL.
-# Copyright (C) 2005 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 SimpleExtension < Info
- attr_reader :base
- attr_reader :attributes
-
- def initialize
- super
- @base = nil
- @attributes = XSD::NamedElements.new
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def valid?(value)
- true
- end
-
- def parse_element(element)
- case element
- when AttributeName
- o = Attribute.new
- @attributes << o
- o
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when BaseAttrName
- @base = value
- end
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/simpleRestriction.rb b/lib/wsdl/xmlSchema/simpleRestriction.rb
deleted file mode 100644
index e8bf3ebfa5..0000000000
--- a/lib/wsdl/xmlSchema/simpleRestriction.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# WSDL4R - XMLSchema simpleContent restriction 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
- attr_accessor :length
- attr_accessor :pattern
-
- def initialize
- super
- @base = nil
- @enumeration = [] # NamedElements?
- @length = nil
- @pattern = nil
- end
-
- def valid?(value)
- return false unless check_restriction(value)
- return false unless check_length(value)
- return false unless check_pattern(value)
- true
- end
-
- def parse_element(element)
- case element
- when EnumerationName
- Enumeration.new # just a parsing handler
- when LengthName
- Length.new # just a parsing handler
- when PatternName
- Pattern.new # just a parsing handler
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when BaseAttrName
- @base = value
- end
- end
-
-private
-
- def check_restriction(value)
- @enumeration.empty? or @enumeration.include?(value)
- end
-
- def check_length(value)
- @length.nil? or value.size == @length
- end
-
- def check_pattern(value)
- @pattern.nil? or @pattern =~ value
- end
-end
-
-
-end
-end
diff --git a/lib/wsdl/xmlSchema/simpleType.rb b/lib/wsdl/xmlSchema/simpleType.rb
deleted file mode 100644
index e808c318c4..0000000000
--- a/lib/wsdl/xmlSchema/simpleType.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# WSDL4R - XMLSchema simpleType definition for WSDL.
-# Copyright (C) 2004, 2005 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 :restriction
-
- def check_lexical_format(value)
- if @restriction
- check_restriction(value)
- else
- raise ArgumentError.new("incomplete simpleType")
- end
- end
-
- def base
- if @restriction
- @restriction.base
- else
- raise ArgumentError.new("incomplete simpleType")
- end
- end
-
- def initialize(name = nil)
- super()
- @name = name
- @restriction = nil
- end
-
- def targetnamespace
- parent.targetnamespace
- end
-
- def parse_element(element)
- case element
- when RestrictionName
- @restriction = SimpleRestriction.new
- @restriction
- end
- end
-
- def parse_attr(attr, value)
- case attr
- when NameAttrName
- @name = XSD::QName.new(targetnamespace, value.source)
- 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
diff --git a/lib/wsdl/xmlSchema/xsd2ruby.rb b/lib/wsdl/xmlSchema/xsd2ruby.rb
deleted file mode 100644
index afe5fc5ada..0000000000
--- a/lib/wsdl/xmlSchema/xsd2ruby.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-# XSD4R - XSD to ruby mapping library.
-# Copyright (C) 2005 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/codegen/gensupport'
-require 'wsdl/xmlSchema/importer'
-require 'wsdl/soap/classDefCreator'
-
-
-module WSDL
-module XMLSchema
-
-
-class XSD2Ruby
- attr_accessor :location
- attr_reader :opt
- attr_accessor :logger
- attr_accessor :basedir
-
- def run
- unless @location
- raise RuntimeError, "XML Schema location not given"
- end
- @xsd = import(@location)
- @name = create_classname(@xsd)
- create_file
- end
-
-private
-
- def initialize
- @location = nil
- @opt = {}
- @logger = Logger.new(STDERR)
- @basedir = nil
- @xsd = nil
- @name = nil
- end
-
- def create_file
- create_classdef
- end
-
- def create_classdef
- @logger.info { "Creating class definition." }
- @classdef_filename = @name + '.rb'
- check_file(@classdef_filename) or return
- write_file(@classdef_filename) do |f|
- f << WSDL::SOAP::ClassDefCreator.new(@xsd).dump
- end
- end
-
- def write_file(filename)
- if @basedir
- filename = File.join(basedir, filename)
- end
- File.open(filename, "w") do |f|
- yield f
- end
- end
-
- def check_file(filename)
- if @basedir
- filename = File.join(basedir, filename)
- end
- if FileTest.exist?(filename)
- if @opt.key?('force')
- @logger.warn {
- "File '#{filename}' exists but overrides it."
- }
- true
- else
- @logger.warn {
- "File '#{filename}' exists. #{$0} did not override it."
- }
- false
- end
- else
- @logger.info { "Creates file '#{filename}'." }
- true
- end
- end
-
- def create_classname(xsd)
- name = nil
- if xsd.targetnamespace
- name = xsd.targetnamespace.scan(/[a-zA-Z0-9]+$/)[0]
- end
- if name.nil?
- 'default'
- else
- XSD::CodeGen::GenSupport.safevarname(name)
- end
- end
-
- def import(location)
- WSDL::XMLSchema::Importer.import(location)
- end
-end
-
-
-end
-end
diff --git a/lib/xsd/charset.rb b/lib/xsd/charset.rb
deleted file mode 100644
index cd4d8a074c..0000000000
--- a/lib/xsd/charset.rb
+++ /dev/null
@@ -1,187 +0,0 @@
-# XSD4R - Charset handling library.
-# Copyright (C) 2001, 2003, 2005 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 XSD
-
-
-module Charset
- @internal_encoding = "ASCII"
-
- class XSDError < StandardError; end
- class CharsetError < XSDError; end
- class UnknownCharsetError < CharsetError; end
- class CharsetConversionError < CharsetError; end
-
-public
-
- ###
- ## Maps
- #
- EncodingConvertMap = {}
- def Charset.init
- EncodingConvertMap[['UTF8', 'X_ISO8859_1']] =
- Proc.new { |str| str.unpack('U*').pack('C*') }
- EncodingConvertMap[['X_ISO8859_1', 'UTF8']] =
- Proc.new { |str| str.unpack('C*').pack('U*') }
- begin
- require 'xsd/iconvcharset'
- @internal_encoding = 'UTF8'
- sjtag = (/(mswin|bccwin|mingw|cygwin|emx)/ =~ RUBY_PLATFORM) ? 'cp932' :
- 'shift_jis'
- EncodingConvertMap[['UTF8', 'EUC' ]] =
- Proc.new { |str| IconvCharset.safe_iconv("euc-jp", "utf-8", str) }
- EncodingConvertMap[['EUC' , 'UTF8']] =
- Proc.new { |str| IconvCharset.safe_iconv("utf-8", "euc-jp", str) }
- EncodingConvertMap[['EUC' , 'SJIS']] =
- Proc.new { |str| IconvCharset.safe_iconv(sjtag, "euc-jp", str) }
- EncodingConvertMap[['UTF8', 'SJIS']] =
- Proc.new { |str| IconvCharset.safe_iconv(sjtag, "utf-8", str) }
- EncodingConvertMap[['SJIS', 'UTF8']] =
- Proc.new { |str| IconvCharset.safe_iconv("utf-8", sjtag, str) }
- EncodingConvertMap[['SJIS', 'EUC' ]] =
- Proc.new { |str| IconvCharset.safe_iconv("euc-jp", sjtag, str) }
- rescue LoadError
- begin
- require 'nkf'
- EncodingConvertMap[['EUC' , 'SJIS']] =
- Proc.new { |str| NKF.nkf('-sXm0', str) }
- EncodingConvertMap[['SJIS', 'EUC' ]] =
- Proc.new { |str| NKF.nkf('-eXm0', str) }
- rescue LoadError
- end
-
- begin
- require 'uconv'
- @internal_encoding = 'UTF8'
- EncodingConvertMap[['UTF8', 'EUC' ]] = Uconv.method(:u8toeuc)
- EncodingConvertMap[['UTF8', 'SJIS']] = Uconv.method(:u8tosjis)
- EncodingConvertMap[['EUC' , 'UTF8']] = Uconv.method(:euctou8)
- EncodingConvertMap[['SJIS', 'UTF8']] = Uconv.method(:sjistou8)
- rescue LoadError
- end
- end
- end
- self.init
-
- CharsetMap = {
- 'NONE' => 'us-ascii',
- 'EUC' => 'euc-jp',
- 'SJIS' => 'shift_jis',
- 'UTF8' => 'utf-8',
- 'X_ISO_8859_1' => 'iso-8859-1',
- 'X_UNKNOWN' => nil,
- }
-
-
- ###
- ## handlers
- #
- def Charset.encoding
- @internal_encoding
- end
-
- def Charset.encoding=(encoding)
- warn("xsd charset is set to #{encoding}") if $DEBUG
- @internal_encoding = encoding
- end
-
- def Charset.xml_encoding_label
- charset_label(@internal_encoding)
- end
-
- def Charset.encoding_to_xml(str, charset)
- encoding_conv(str, @internal_encoding, charset_str(charset))
- end
-
- def Charset.encoding_from_xml(str, charset)
- encoding_conv(str, charset_str(charset), @internal_encoding)
- end
-
- def Charset.encoding_conv(str, enc_from, enc_to)
- if enc_from == enc_to or enc_from == 'NONE' or enc_to == 'NONE'
- str
- elsif converter = EncodingConvertMap[[enc_from, enc_to]]
- converter.call(str)
- else
- raise CharsetConversionError.new(
- "Converter not found: #{enc_from} -> #{enc_to}")
- end
- end
-
- def Charset.charset_label(encoding)
- CharsetMap[encoding.upcase]
- end
-
- def Charset.charset_str(label)
- if CharsetMap.respond_to?(:key)
- CharsetMap.key(label.downcase) || 'X_UNKNOWN'
- else
- CharsetMap.index(label.downcase) || 'X_UNKNOWN'
- end
- end
-
- # us_ascii = '[\x00-\x7F]'
- us_ascii = '[\x9\xa\xd\x20-\x7F]' # XML 1.0 restricted.
- USASCIIRegexp = Regexp.new("\\A#{us_ascii}*\\z", nil, "NONE")
-
- twobytes_euc = '(?:[\x8E\xA1-\xFE][\xA1-\xFE])'
- threebytes_euc = '(?:\x8F[\xA1-\xFE][\xA1-\xFE])'
- character_euc = "(?:#{us_ascii}|#{twobytes_euc}|#{threebytes_euc})"
- EUCRegexp = Regexp.new("\\A#{character_euc}*\\z", nil, "NONE")
-
- # onebyte_sjis = '[\x00-\x7F\xA1-\xDF]'
- onebyte_sjis = '[\x9\xa\xd\x20-\x7F\xA1-\xDF]' # XML 1.0 restricted.
- twobytes_sjis = '(?:[\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC])'
- character_sjis = "(?:#{onebyte_sjis}|#{twobytes_sjis})"
- SJISRegexp = Regexp.new("\\A#{character_sjis}*\\z", nil, "NONE")
-
- # 0xxxxxxx
- # 110yyyyy 10xxxxxx
- twobytes_utf8 = '(?:[\xC0-\xDF][\x80-\xBF])'
- # 1110zzzz 10yyyyyy 10xxxxxx
- threebytes_utf8 = '(?:[\xE0-\xEF][\x80-\xBF][\x80-\xBF])'
- # 11110uuu 10uuuzzz 10yyyyyy 10xxxxxx
- fourbytes_utf8 = '(?:[\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])'
- character_utf8 =
- "(?:#{us_ascii}|#{twobytes_utf8}|#{threebytes_utf8}|#{fourbytes_utf8})"
- UTF8Regexp = Regexp.new("\\A#{character_utf8}*\\z", nil, "NONE")
-
- def Charset.is_us_ascii(str)
- USASCIIRegexp =~ str
- end
-
- def Charset.is_utf8(str)
- UTF8Regexp =~ str
- end
-
- def Charset.is_euc(str)
- EUCRegexp =~ str
- end
-
- def Charset.is_sjis(str)
- SJISRegexp =~ str
- end
-
- def Charset.is_ces(str, code = $KCODE)
- case code
- when 'NONE'
- is_us_ascii(str)
- when 'UTF8'
- is_utf8(str)
- when 'EUC'
- is_euc(str)
- when 'SJIS'
- is_sjis(str)
- else
- raise UnknownCharsetError.new("Unknown charset: #{code}")
- end
- end
-end
-
-
-end
diff --git a/lib/xsd/codegen.rb b/lib/xsd/codegen.rb
deleted file mode 100644
index d820ebf1f2..0000000000
--- a/lib/xsd/codegen.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# XSD4R - Generating code library
-# 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 'xsd/codegen/gensupport'
-require 'xsd/codegen/moduledef'
-require 'xsd/codegen/classdef'
-require 'xsd/codegen/methoddef'
diff --git a/lib/xsd/codegen/classdef.rb b/lib/xsd/codegen/classdef.rb
deleted file mode 100644
index 9eb1ce6607..0000000000
--- a/lib/xsd/codegen/classdef.rb
+++ /dev/null
@@ -1,203 +0,0 @@
-# XSD4R - Generating class definition code
-# 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 'xsd/codegen/gensupport'
-require 'xsd/codegen/moduledef'
-require 'xsd/codegen/methoddef'
-
-
-module XSD
-module CodeGen
-
-
-class ClassDef < ModuleDef
- include GenSupport
-
- def initialize(name, baseclass = nil)
- super(name)
- @baseclass = baseclass
- @classvar = []
- @attrdef = []
- end
-
- def def_classvar(var, value)
- var = var.sub(/\A@@/, "")
- unless safevarname?(var)
- raise ArgumentError.new("#{var} seems to be unsafe")
- end
- @classvar << [var, value]
- end
-
- def def_attr(attrname, writable = true, varname = nil)
- unless safevarname?(varname || attrname)
- raise ArgumentError.new("#{varname || attrname} seems to be unsafe")
- end
- @attrdef << [attrname, writable, varname]
- end
-
- def dump
- buf = ""
- unless @requirepath.empty?
- buf << dump_requirepath
- end
- buf << dump_emptyline unless buf.empty?
- package = @name.split(/::/)[0..-2]
- buf << dump_package_def(package) unless package.empty?
- buf << dump_comment if @comment
- buf << dump_class_def
- spacer = false
- unless @classvar.empty?
- spacer = true
- buf << dump_classvar
- end
- unless @const.empty?
- buf << dump_emptyline if spacer
- spacer = true
- buf << dump_const
- end
- unless @code.empty?
- buf << dump_emptyline if spacer
- spacer = true
- buf << dump_code
- end
- unless @attrdef.empty?
- buf << dump_emptyline if spacer
- spacer = true
- buf << dump_attributes
- end
- unless @methoddef.empty?
- buf << dump_emptyline if spacer
- spacer = true
- buf << dump_methods
- end
- buf << dump_class_def_end
- buf << dump_package_def_end(package) unless package.empty?
- buf.gsub(/^\s+$/, '')
- end
-
-private
-
- def dump_class_def
- name = @name.to_s.split(/::/)
- if @baseclass
- format("class #{name.last} < #{@baseclass}")
- else
- format("class #{name.last}")
- end
- end
-
- def dump_class_def_end
- str = format("end")
- end
-
- def dump_classvar
- dump_static(
- @classvar.collect { |var, value|
- %Q(@@#{var.sub(/^@@/, "")} = #{dump_value(value)})
- }.join("\n")
- )
- end
-
- def dump_attributes
- str = ""
- @attrdef.each do |attrname, writable, varname|
- varname ||= attrname
- if attrname == varname
- str << format(dump_accessor(attrname, writable), 2)
- end
- end
- @attrdef.each do |attrname, writable, varname|
- varname ||= attrname
- if attrname != varname
- str << "\n" unless str.empty?
- str << format(dump_attribute(attrname, writable, varname), 2)
- end
- end
- str
- end
-
- def dump_accessor(attrname, writable)
- if writable
- "attr_accessor :#{attrname}"
- else
- "attr_reader :#{attrname}"
- end
- end
-
- def dump_attribute(attrname, writable, varname)
- str = nil
- mr = MethodDef.new(attrname)
- mr.definition = "@#{varname}"
- str = mr.dump
- if writable
- mw = MethodDef.new(attrname + "=", 'value')
- mw.definition = "@#{varname} = value"
- str << "\n" + mw.dump
- end
- str
- end
-end
-
-
-end
-end
-
-
-if __FILE__ == $0
- require 'xsd/codegen/classdef'
- include XSD::CodeGen
- c = ClassDef.new("Foo::Bar::HobbitName", String)
- c.def_require("foo/bar")
- c.comment = <<-EOD
- foo
- bar
- baz
- EOD
- c.def_const("FOO", 1)
- c.def_classvar("@@foo", "var".dump)
- c.def_classvar("baz", "1".dump)
- c.def_attr("Foo", true, "foo")
- c.def_attr("bar")
- c.def_attr("baz", true)
- c.def_attr("Foo2", true, "foo2")
- c.def_attr("foo3", false, "foo3")
- c.def_method("foo") do
- <<-EOD
- foo.bar = 1
-\tbaz.each do |ele|
-\t ele
- end
- EOD
- end
- c.def_method("baz", "qux") do
- <<-EOD
- [1, 2, 3].each do |i|
- p i
- end
- EOD
- end
-
- m = MethodDef.new("qux", "quxx", "quxxx") do
- <<-EOD
- p quxx + quxxx
- EOD
- end
- m.comment = "hello world\n123"
- c.add_method(m)
- c.def_code <<-EOD
- Foo.new
- Bar.z
- EOD
- c.def_code <<-EOD
- Foo.new
- Bar.z
- EOD
- c.def_privatemethod("foo", "baz", "*arg", "&block")
-
- puts c.dump
-end
diff --git a/lib/xsd/codegen/commentdef.rb b/lib/xsd/codegen/commentdef.rb
deleted file mode 100644
index c9493a1363..0000000000
--- a/lib/xsd/codegen/commentdef.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# XSD4R - Generating comment definition code
-# 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 'xsd/codegen/gensupport'
-
-
-module XSD
-module CodeGen
-
-
-module CommentDef
- include GenSupport
-
- attr_accessor :comment
-
-private
-
- def dump_comment
- if /\A#/ =~ @comment
- format(@comment)
- else
- format(@comment).gsub(/^/, '# ')
- end
- end
-end
-
-
-end
-end
diff --git a/lib/xsd/codegen/gensupport.rb b/lib/xsd/codegen/gensupport.rb
deleted file mode 100644
index 8c2bb0d901..0000000000
--- a/lib/xsd/codegen/gensupport.rb
+++ /dev/null
@@ -1,166 +0,0 @@
-# XSD4R - Code generation support
-# Copyright (C) 2004, 2005 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 XSD
-module CodeGen
-
-# from the file 'keywords' in 1.9.
-KEYWORD = {}
-%w(
-__LINE__
-__FILE__
-BEGIN
-END
-alias
-and
-begin
-break
-case
-class
-def
-defined?
-do
-else
-elsif
-end
-ensure
-false
-for
-if
-in
-module
-next
-nil
-not
-or
-redo
-rescue
-retry
-return
-self
-super
-then
-true
-undef
-unless
-until
-when
-while
-yield
-).each { |k| KEYWORD[k] = nil }
-
-module GenSupport
- def capitalize(target)
- target.sub(/^([a-z])/) { $1.tr!('[a-z]', '[A-Z]') }
- end
- module_function :capitalize
-
- def uncapitalize(target)
- target.sub(/^([A-Z])/) { $1.tr!('[A-Z]', '[a-z]') }
- end
- module_function :uncapitalize
-
- def safeconstname(name)
- safename = name.scan(/[a-zA-Z0-9_]+/).collect { |ele|
- GenSupport.capitalize(ele)
- }.join
- if /^[A-Z]/ !~ safename or keyword?(safename)
- safename = "C_#{safename}"
- end
- safename
- end
- module_function :safeconstname
-
- def safeconstname?(name)
- /\A[A-Z][a-zA-Z0-9_]*\z/ =~ name and !keyword?(name)
- end
- module_function :safeconstname?
-
- def safemethodname(name)
- safename = name.scan(/[a-zA-Z0-9_]+/).join('_')
- safename = uncapitalize(safename)
- if /^[a-z]/ !~ safename
- safename = "m_#{safename}"
- end
- safename
- end
- module_function :safemethodname
-
- def safemethodname?(name)
- /\A[a-zA-Z_][a-zA-Z0-9_]*[=!?]?\z/ =~ name
- end
- module_function :safemethodname?
-
- def safevarname(name)
- safename = uncapitalize(name.scan(/[a-zA-Z0-9_]+/).join('_'))
- if /^[a-z]/ !~ safename or keyword?(safename)
- "v_#{safename}"
- else
- safename
- end
- end
- module_function :safevarname
-
- def safevarname?(name)
- /\A[a-z_][a-zA-Z0-9_]*\z/ =~ name and !keyword?(name)
- end
- module_function :safevarname?
-
- def keyword?(word)
- KEYWORD.key?(word)
- end
- module_function :keyword?
-
- def format(str, indent = nil)
- str = trim_eol(str)
- str = trim_indent(str)
- if indent
- str.gsub(/^/, " " * indent)
- else
- str
- end
- end
-
-private
-
- def trim_eol(str)
- str.lines.collect { |line|
- line.sub(/\r?\n\z/, "") + "\n"
- }.join
- end
-
- def trim_indent(str)
- indent = nil
- str = str.lines.collect { |line| untab(line) }.join
- str.each_line do |line|
- head = line.index(/\S/)
- if !head.nil? and (indent.nil? or head < indent)
- indent = head
- end
- end
- return str unless indent
- str.lines.collect { |line|
- line.sub(/^ {0,#{indent}}/, "")
- }.join
- end
-
- def untab(line, ts = 8)
- while pos = line.index(/\t/)
- line = line.sub(/\t/, " " * (ts - (pos % ts)))
- end
- line
- end
-
- def dump_emptyline
- "\n"
- end
-end
-
-
-end
-end
diff --git a/lib/xsd/codegen/methoddef.rb b/lib/xsd/codegen/methoddef.rb
deleted file mode 100644
index 15892fc5bf..0000000000
--- a/lib/xsd/codegen/methoddef.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-# XSD4R - Generating method definition code
-# 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 'xsd/codegen/gensupport'
-require 'xsd/codegen/commentdef'
-
-
-module XSD
-module CodeGen
-
-
-class MethodDef
- include GenSupport
- include CommentDef
-
- attr_accessor :definition
-
- def initialize(name, *params)
- unless safemethodname?(name)
- raise ArgumentError.new("name '#{name}' seems to be unsafe")
- end
- @name = name
- @params = params
- @comment = nil
- @definition = yield if block_given?
- end
-
- def dump
- buf = ""
- buf << dump_comment if @comment
- buf << dump_method_def
- buf << dump_definition if @definition and !@definition.empty?
- buf << dump_method_def_end
- buf
- end
-
-private
-
- def dump_method_def
- if @params.empty?
- format("def #{@name}")
- else
- format("def #{@name}(#{@params.join(", ")})")
- end
- end
-
- def dump_method_def_end
- format("end")
- end
-
- def dump_definition
- format(@definition, 2)
- end
-end
-
-
-end
-end
diff --git a/lib/xsd/codegen/moduledef.rb b/lib/xsd/codegen/moduledef.rb
deleted file mode 100644
index 744af2ff97..0000000000
--- a/lib/xsd/codegen/moduledef.rb
+++ /dev/null
@@ -1,191 +0,0 @@
-# XSD4R - Generating module definition code
-# 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 'xsd/codegen/gensupport'
-require 'xsd/codegen/methoddef'
-require 'xsd/codegen/commentdef'
-
-
-module XSD
-module CodeGen
-
-
-class ModuleDef
- include GenSupport
- include CommentDef
-
- def initialize(name)
- @name = name
- @comment = nil
- @const = []
- @code = []
- @requirepath = []
- @methoddef = []
- end
-
- def def_require(path)
- @requirepath << path
- end
-
- def def_const(const, value)
- unless safeconstname?(const)
- raise ArgumentError.new("#{const} seems to be unsafe")
- end
- @const << [const, value]
- end
-
- def def_code(code)
- @code << code
- end
-
- def def_method(name, *params)
- add_method(MethodDef.new(name, *params) { yield if block_given? }, :public)
- end
- alias def_publicmethod def_method
-
- def def_protectedmethod(name, *params)
- add_method(MethodDef.new(name, *params) { yield if block_given? },
- :protected)
- end
-
- def def_privatemethod(name, *params)
- add_method(MethodDef.new(name, *params) { yield if block_given? }, :private)
- end
-
- def add_method(m, visibility = :public)
- @methoddef << [visibility, m]
- end
-
- def dump
- buf = ""
- unless @requirepath.empty?
- buf << dump_requirepath
- end
- buf << dump_emptyline unless buf.empty?
- package = @name.split(/::/)[0..-2]
- buf << dump_package_def(package) unless package.empty?
- buf << dump_comment if @comment
- buf << dump_module_def
- spacer = false
- unless @const.empty?
- buf << dump_emptyline if spacer
- spacer = true
- buf << dump_const
- end
- unless @code.empty?
- buf << dump_emptyline if spacer
- spacer = true
- buf << dump_code
- end
- unless @methoddef.empty?
- buf << dump_emptyline if spacer
- spacer = true
- buf << dump_methods
- end
- buf << dump_module_def_end
- buf << dump_package_def_end(package) unless package.empty?
- buf.gsub(/^\s+$/, '')
- end
-
-private
-
- def dump_requirepath
- format(
- @requirepath.collect { |path|
- %Q(require '#{path}')
- }.join("\n")
- )
- end
-
- def dump_const
- dump_static(
- @const.sort.collect { |var, value|
- %Q(#{var} = #{dump_value(value)})
- }.join("\n")
- )
- end
-
- def dump_code
- dump_static(@code.join("\n"))
- end
-
- def dump_static(str)
- format(str, 2)
- end
-
- def dump_methods
- methods = {}
- @methoddef.each do |visibility, method|
- (methods[visibility] ||= []) << method
- end
- str = ""
- [:public, :protected, :private].each do |visibility|
- if methods[visibility]
- str << "\n" unless str.empty?
- str << visibility.to_s << "\n\n" unless visibility == :public
- str << methods[visibility].collect { |m| format(m.dump, 2) }.join("\n")
- end
- end
- str
- end
-
- def dump_value(value)
- if value.respond_to?(:to_src)
- value.to_src
- else
- value
- end
- end
-
- def dump_package_def(package)
- format(package.collect { |ele| "module #{ele}" }.join("; ")) + "\n\n"
- end
-
- def dump_package_def_end(package)
- "\n\n" + format(package.collect { |ele| "end" }.join("; "))
- end
-
- def dump_module_def
- name = @name.to_s.split(/::/)
- format("module #{name.last}")
- end
-
- def dump_module_def_end
- format("end")
- end
-end
-
-
-end
-end
-
-
-if __FILE__ == $0
- require 'xsd/codegen/moduledef'
- include XSD::CodeGen
- m = ModuleDef.new("Foo::Bar::HobbitName")
- m.def_require("foo/bar")
- m.def_require("baz")
- m.comment = <<-EOD
- foo
- bar
- baz
- EOD
- m.def_method("foo") do
- <<-EOD
- foo.bar = 1
- baz.each do |ele|
- ele + 1
- end
- EOD
- end
- m.def_method("baz", "qux")
- #m.def_protectedmethod("aaa")
- m.def_privatemethod("bbb")
- puts m.dump
-end
diff --git a/lib/xsd/datatypes.rb b/lib/xsd/datatypes.rb
deleted file mode 100644
index bbe6c8578f..0000000000
--- a/lib/xsd/datatypes.rb
+++ /dev/null
@@ -1,1269 +0,0 @@
-# XSD4R - XML Schema Datatype implementation.
-# Copyright (C) 2000, 2001, 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/charset'
-require 'uri'
-
-
-###
-## XMLSchamaDatatypes general definitions.
-#
-module XSD
-
-
-Namespace = 'http://www.w3.org/2001/XMLSchema'
-InstanceNamespace = 'http://www.w3.org/2001/XMLSchema-instance'
-
-AttrType = 'type'
-NilValue = 'true'
-
-AnyTypeLiteral = 'anyType'
-AnySimpleTypeLiteral = 'anySimpleType'
-NilLiteral = 'nil'
-StringLiteral = 'string'
-BooleanLiteral = 'boolean'
-DecimalLiteral = 'decimal'
-FloatLiteral = 'float'
-DoubleLiteral = 'double'
-DurationLiteral = 'duration'
-DateTimeLiteral = 'dateTime'
-TimeLiteral = 'time'
-DateLiteral = 'date'
-GYearMonthLiteral = 'gYearMonth'
-GYearLiteral = 'gYear'
-GMonthDayLiteral = 'gMonthDay'
-GDayLiteral = 'gDay'
-GMonthLiteral = 'gMonth'
-HexBinaryLiteral = 'hexBinary'
-Base64BinaryLiteral = 'base64Binary'
-AnyURILiteral = 'anyURI'
-QNameLiteral = 'QName'
-
-NormalizedStringLiteral = 'normalizedString'
-#3.3.2 token
-#3.3.3 language
-#3.3.4 NMTOKEN
-#3.3.5 NMTOKENS
-#3.3.6 Name
-#3.3.7 NCName
-#3.3.8 ID
-#3.3.9 IDREF
-#3.3.10 IDREFS
-#3.3.11 ENTITY
-#3.3.12 ENTITIES
-IntegerLiteral = 'integer'
-NonPositiveIntegerLiteral = 'nonPositiveInteger'
-NegativeIntegerLiteral = 'negativeInteger'
-LongLiteral = 'long'
-IntLiteral = 'int'
-ShortLiteral = 'short'
-ByteLiteral = 'byte'
-NonNegativeIntegerLiteral = 'nonNegativeInteger'
-UnsignedLongLiteral = 'unsignedLong'
-UnsignedIntLiteral = 'unsignedInt'
-UnsignedShortLiteral = 'unsignedShort'
-UnsignedByteLiteral = 'unsignedByte'
-PositiveIntegerLiteral = 'positiveInteger'
-
-AttrTypeName = QName.new(InstanceNamespace, AttrType)
-AttrNilName = QName.new(InstanceNamespace, NilLiteral)
-
-AnyTypeName = QName.new(Namespace, AnyTypeLiteral)
-AnySimpleTypeName = QName.new(Namespace, AnySimpleTypeLiteral)
-
-class Error < StandardError; end
-class ValueSpaceError < Error; end
-
-
-###
-## The base class of all datatypes with Namespace.
-#
-class NSDBase
- @@types = []
-
- attr_accessor :type
-
- def self.inherited(klass)
- @@types << klass
- end
-
- def self.types
- @@types
- end
-
- def initialize
- end
-
- def init(type)
- @type = type
- end
-end
-
-
-###
-## The base class of XSD datatypes.
-#
-class XSDAnySimpleType < NSDBase
- include XSD
- Type = QName.new(Namespace, AnySimpleTypeLiteral)
-
- # @data represents canonical space (ex. Integer: 123).
- attr_reader :data
- # @is_nil represents this data is nil or not.
- attr_accessor :is_nil
-
- def initialize(value = nil)
- init(Type, value)
- end
-
- # true or raise
- def check_lexical_format(value)
- screen_data(value)
- true
- end
-
- # set accepts a string which follows lexical space (ex. String: "+123"), or
- # an object which follows canonical space (ex. Integer: 123).
- def set(value)
- if value.nil?
- @is_nil = true
- @data = nil
- _set(nil)
- else
- @is_nil = false
- _set(screen_data(value))
- end
- end
-
- # to_s creates a string which follows lexical space (ex. String: "123").
- def to_s()
- if @is_nil
- ""
- else
- _to_s
- end
- end
-
-private
-
- def init(type, value)
- super(type)
- set(value)
- end
-
- # raises ValueSpaceError if check failed
- def screen_data(value)
- value
- end
-
- def _set(value)
- @data = value
- end
-
- def _to_s
- @data.to_s
- end
-end
-
-class XSDNil < XSDAnySimpleType
- Type = QName.new(Namespace, NilLiteral)
- Value = 'true'
-
- def initialize(value = nil)
- init(Type, value)
- end
-end
-
-
-###
-## Primitive datatypes.
-#
-class XSDString < XSDAnySimpleType
- Type = QName.new(Namespace, StringLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data(value)
- unless XSD::Charset.is_ces(value, XSD::Charset.encoding)
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
- end
- value
- end
-end
-
-class XSDBoolean < XSDAnySimpleType
- Type = QName.new(Namespace, BooleanLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data(value)
- if value.is_a?(String)
- str = value.strip
- if str == 'true' || str == '1'
- true
- elsif str == 'false' || str == '0'
- false
- else
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
- end
- else
- value ? true : false
- end
- end
-end
-
-class XSDDecimal < XSDAnySimpleType
- Type = QName.new(Namespace, DecimalLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
- def nonzero?
- (@number != '0')
- end
-
-private
-
- def screen_data(d)
- if d.is_a?(String)
- # Integer("00012") => 10 in Ruby.
- d.sub!(/^([+\-]?)0*(?=\d)/, "\\1")
- end
- screen_data_str(d)
- end
-
- def screen_data_str(str)
- /^([+\-]?)(\d*)(?:\.(\d*)?)?$/ =~ str.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
- end
- sign = $1 || '+'
- int_part = $2
- frac_part = $3
- int_part = '0' if int_part.empty?
- frac_part = frac_part ? frac_part.sub(/0+$/, '') : ''
- point = - frac_part.size
- number = int_part + frac_part
- # normalize
- if sign == '+'
- sign = ''
- elsif sign == '-'
- if number == '0'
- sign = ''
- end
- end
- [sign, point, number]
- end
-
- def _set(data)
- if data.nil?
- @sign = @point = @number = @data = nil
- return
- end
- @sign, @point, @number = data
- @data = _to_s
- @data.freeze
- end
-
- # 0.0 -> 0; right?
- def _to_s
- str = @number.dup
- if @point.nonzero?
- str[@number.size + @point, 0] = '.'
- end
- @sign + str
- end
-end
-
-module FloatConstants
- NaN = 0.0/0.0
- POSITIVE_INF = +1.0/0.0
- NEGATIVE_INF = -1.0/0.0
- POSITIVE_ZERO = +1.0/POSITIVE_INF
- NEGATIVE_ZERO = -1.0/POSITIVE_INF
- MIN_POSITIVE_SINGLE = 2.0 ** -149
-end
-
-class XSDFloat < XSDAnySimpleType
- include FloatConstants
- Type = QName.new(Namespace, FloatLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data(value)
- # "NaN".to_f => 0 in some environment. libc?
- if value.is_a?(Float)
- return narrow32bit(value)
- end
- str = value.to_s.strip
- if str == 'NaN'
- NaN
- elsif str == 'INF'
- POSITIVE_INF
- elsif str == '-INF'
- NEGATIVE_INF
- else
- if /^[+\-\.\deE]+$/ !~ str
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
- end
- # Float("-1.4E") might fail on some system.
- str << '0' if /e$/i =~ str
- begin
- return narrow32bit(Float(str))
- rescue ArgumentError
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
- end
- end
- end
-
- def _to_s
- if @data.nan?
- 'NaN'
- elsif @data.infinite? == 1
- 'INF'
- elsif @data.infinite? == -1
- '-INF'
- else
- sign = XSDFloat.positive?(@data) ? '+' : '-'
- sign + sprintf("%.10g", @data.abs).sub(/[eE]([+-])?0+/) { 'e' + $1 }
- end
- end
-
- # Convert to single-precision 32-bit floating point value.
- def narrow32bit(f)
- if f.nan? || f.infinite?
- f
- elsif f.abs < MIN_POSITIVE_SINGLE
- XSDFloat.positive?(f) ? POSITIVE_ZERO : NEGATIVE_ZERO
- else
- f
- end
- end
-
- def self.positive?(value)
- (1 / value) > 0.0
- end
-end
-
-# Ruby's Float is double-precision 64-bit floating point value.
-class XSDDouble < XSDAnySimpleType
- include FloatConstants
- Type = QName.new(Namespace, DoubleLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data(value)
- # "NaN".to_f => 0 in some environment. libc?
- if value.is_a?(Float)
- return value
- end
- str = value.to_s.strip
- if str == 'NaN'
- NaN
- elsif str == 'INF'
- POSITIVE_INF
- elsif str == '-INF'
- NEGATIVE_INF
- else
- begin
- return Float(str)
- rescue ArgumentError
- # '1.4e' cannot be parsed on some architecture.
- if /e\z/i =~ str
- begin
- return Float(str + '0')
- rescue ArgumentError
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
- end
- else
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
- end
- end
- end
- end
-
- def _to_s
- if @data.nan?
- 'NaN'
- elsif @data.infinite? == 1
- 'INF'
- elsif @data.infinite? == -1
- '-INF'
- else
- sign = (1 / @data > 0.0) ? '+' : '-'
- sign + sprintf("%.16g", @data.abs).sub(/[eE]([+-])?0+/) { 'e' + $1 }
- end
- end
-end
-
-class XSDDuration < XSDAnySimpleType
- Type = QName.new(Namespace, DurationLiteral)
-
- attr_accessor :sign
- attr_accessor :year
- attr_accessor :month
- attr_accessor :day
- attr_accessor :hour
- attr_accessor :min
- attr_accessor :sec
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data(value)
- /^([+\-]?)P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/ =~ value.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
- end
- if ($5 and ((!$2 and !$3 and !$4) or (!$6 and !$7 and !$8)))
- # Should we allow 'PT5S' here?
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
- end
- sign = $1
- year = $2.to_i
- month = $3.to_i
- day = $4.to_i
- hour = $6.to_i
- min = $7.to_i
- sec = $8 ? XSDDecimal.new($8) : 0
- [sign, year, month, day, hour, min, sec]
- end
-
- def _set(data)
- if data.nil?
- @sign = @year = @month = @day = @hour = @min = @sec = @data = nil
- return
- end
- @sign, @year, @month, @day, @hour, @min, @sec = data
- @data = _to_s
- @data.freeze
- end
-
- def _to_s
- str = ''
- str << @sign if @sign
- str << 'P'
- l = ''
- l << "#{ @year }Y" if @year.nonzero?
- l << "#{ @month }M" if @month.nonzero?
- l << "#{ @day }D" if @day.nonzero?
- r = ''
- r << "#{ @hour }H" if @hour.nonzero?
- r << "#{ @min }M" if @min.nonzero?
- r << "#{ @sec }S" if @sec.nonzero?
- str << l
- if l.empty?
- str << "0D"
- end
- unless r.empty?
- str << "T" << r
- end
- str
- end
-end
-
-
-require 'rational'
-require 'date'
-
-module XSDDateTimeImpl
- SecInDay = 86400 # 24 * 60 * 60
-
- def to_obj(klass)
- if klass == Time
- to_time
- elsif klass == Date
- to_date
- elsif klass == DateTime
- to_datetime
- else
- nil
- end
- end
-
- def to_time
- begin
- if @data.offset * SecInDay == Time.now.utc_offset
- d = @data
- usec = (d.sec_fraction * SecInDay * 1000000).round
- Time.local(d.year, d.month, d.mday, d.hour, d.min, d.sec, usec)
- else
- d = @data.newof
- usec = (d.sec_fraction * SecInDay * 1000000).round
- Time.gm(d.year, d.month, d.mday, d.hour, d.min, d.sec, usec)
- end
- rescue ArgumentError
- nil
- end
- end
-
- def to_date
- Date.new0(@data.class.jd_to_ajd(@data.jd, 0, 0), 0, @data.start)
- end
-
- def to_datetime
- data
- end
-
- def tz2of(str)
- /^(?:Z|(?:([+\-])(\d\d):(\d\d))?)$/ =~ str
- sign = $1
- hour = $2.to_i
- min = $3.to_i
-
- of = case sign
- when '+'
- of = +(hour.to_r * 60 + min) / 1440 # 24 * 60
- when '-'
- of = -(hour.to_r * 60 + min) / 1440 # 24 * 60
- else
- 0
- end
- of
- end
-
- def of2tz(offset)
- diffmin = offset * 24 * 60
- if diffmin.zero?
- 'Z'
- else
- ((diffmin < 0) ? '-' : '+') << format('%02d:%02d',
- (diffmin.abs / 60.0).to_i, (diffmin.abs % 60.0).to_i)
- end
- end
-
- def screen_data(t)
- # convert t to a DateTime as an internal representation.
- if t.respond_to?(:to_datetime) # 1.9 or later
- t.to_datetime
- elsif t.is_a?(DateTime)
- t
- elsif t.is_a?(Date)
- t = screen_data_str(t)
- t <<= 12 if t.year < 0
- t
- elsif t.is_a?(Time)
- jd = DateTime.civil_to_jd(t.year, t.mon, t.mday, DateTime::ITALY)
- fr = DateTime.time_to_day_fraction(t.hour, t.min, [t.sec, 59].min) +
- t.usec.to_r / 1000000 / SecInDay
- of = t.utc_offset.to_r / SecInDay
- DateTime.new0(DateTime.jd_to_ajd(jd, fr, of), of, DateTime::ITALY)
- else
- screen_data_str(t)
- end
- end
-
- def add_tz(s)
- s + of2tz(@data.offset)
- end
-end
-
-class XSDDateTime < XSDAnySimpleType
- include XSDDateTimeImpl
- Type = QName.new(Namespace, DateTimeLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data_str(t)
- /^([+\-]?\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d(?:\.(\d*))?)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
- end
- if $1 == '0000'
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
- end
- year = $1.to_i
- if year < 0
- year += 1
- end
- mon = $2.to_i
- mday = $3.to_i
- hour = $4.to_i
- min = $5.to_i
- sec = $6.to_i
- secfrac = $7
- zonestr = $8
- data = DateTime.civil(year, mon, mday, hour, min, sec, tz2of(zonestr))
- if secfrac
- diffday = secfrac.to_i.to_r / (10 ** secfrac.size) / SecInDay
- data += diffday
- # FYI: new0 and jd_to_rjd are not necessary to use if you don't have
- # exceptional reason.
- end
- [data, secfrac]
- end
-
- def _set(data)
- if data.nil?
- @data = @secfrac = nil
- return
- end
- @data, @secfrac = data
- end
-
- def _to_s
- year = (@data.year > 0) ? @data.year : @data.year - 1
- s = format('%.4d-%02d-%02dT%02d:%02d:%02d',
- year, @data.mon, @data.mday, @data.hour, @data.min, @data.sec)
- if @data.sec_fraction.nonzero?
- if @secfrac
- s << ".#{ @secfrac }"
- else
- s << sprintf("%.16f",
- (@data.sec_fraction * SecInDay).to_f).sub(/^0/, '').sub(/0*$/, '')
- end
- end
- add_tz(s)
- end
-end
-
-class XSDTime < XSDAnySimpleType
- include XSDDateTimeImpl
- Type = QName.new(Namespace, TimeLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data_str(t)
- /^(\d\d):(\d\d):(\d\d(?:\.(\d*))?)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
- end
- hour = $1.to_i
- min = $2.to_i
- sec = $3.to_i
- secfrac = $4
- zonestr = $5
- data = DateTime.civil(1, 1, 1, hour, min, sec, tz2of(zonestr))
- if secfrac
- diffday = secfrac.to_i.to_r / (10 ** secfrac.size) / SecInDay
- data += diffday
- end
- [data, secfrac]
- end
-
- def _set(data)
- if data.nil?
- @data = @secfrac = nil
- return
- end
- @data, @secfrac = data
- end
-
- def _to_s
- s = format('%02d:%02d:%02d', @data.hour, @data.min, @data.sec)
- if @data.sec_fraction.nonzero?
- if @secfrac
- s << ".#{ @secfrac }"
- else
- s << sprintf("%.16f",
- (@data.sec_fraction * SecInDay).to_f).sub(/^0/, '').sub(/0*$/, '')
- end
- end
- add_tz(s)
- end
-end
-
-class XSDDate < XSDAnySimpleType
- include XSDDateTimeImpl
- Type = QName.new(Namespace, DateLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data_str(t)
- /^([+\-]?\d{4,})-(\d\d)-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
- end
- year = $1.to_i
- if year < 0
- year += 1
- end
- mon = $2.to_i
- mday = $3.to_i
- zonestr = $4
- DateTime.civil(year, mon, mday, 0, 0, 0, tz2of(zonestr))
- end
-
- def _to_s
- year = (@data.year > 0) ? @data.year : @data.year - 1
- s = format('%.4d-%02d-%02d', year, @data.mon, @data.mday)
- add_tz(s)
- end
-end
-
-class XSDGYearMonth < XSDAnySimpleType
- include XSDDateTimeImpl
- Type = QName.new(Namespace, GYearMonthLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data_str(t)
- /^([+\-]?\d{4,})-(\d\d)(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
- end
- year = $1.to_i
- if year < 0
- year += 1
- end
- mon = $2.to_i
- zonestr = $3
- DateTime.civil(year, mon, 1, 0, 0, 0, tz2of(zonestr))
- end
-
- def _to_s
- year = (@data.year > 0) ? @data.year : @data.year - 1
- s = format('%.4d-%02d', year, @data.mon)
- add_tz(s)
- end
-end
-
-class XSDGYear < XSDAnySimpleType
- include XSDDateTimeImpl
- Type = QName.new(Namespace, GYearLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data_str(t)
- /^([+\-]?\d{4,})(Z|(?:([+\-])(\d\d):(\d\d))?)?$/ =~ t.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
- end
- year = $1.to_i
- if year < 0
- year += 1
- end
- zonestr = $2
- DateTime.civil(year, 1, 1, 0, 0, 0, tz2of(zonestr))
- end
-
- def _to_s
- year = (@data.year > 0) ? @data.year : @data.year - 1
- s = format('%.4d', year)
- add_tz(s)
- end
-end
-
-class XSDGMonthDay < XSDAnySimpleType
- include XSDDateTimeImpl
- Type = QName.new(Namespace, GMonthDayLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data_str(t)
- /^(\d\d)-(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
- end
- mon = $1.to_i
- mday = $2.to_i
- zonestr = $3
- DateTime.civil(1, mon, mday, 0, 0, 0, tz2of(zonestr))
- end
-
- def _to_s
- s = format('%02d-%02d', @data.mon, @data.mday)
- add_tz(s)
- end
-end
-
-class XSDGDay < XSDAnySimpleType
- include XSDDateTimeImpl
- Type = QName.new(Namespace, GDayLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data_str(t)
- /^(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
- end
- mday = $1.to_i
- zonestr = $2
- DateTime.civil(1, 1, mday, 0, 0, 0, tz2of(zonestr))
- end
-
- def _to_s
- s = format('%02d', @data.mday)
- add_tz(s)
- end
-end
-
-class XSDGMonth < XSDAnySimpleType
- include XSDDateTimeImpl
- Type = QName.new(Namespace, GMonthLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data_str(t)
- /^(\d\d)(Z|(?:[+\-]\d\d:\d\d)?)?$/ =~ t.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ t }'.")
- end
- mon = $1.to_i
- zonestr = $2
- DateTime.civil(1, mon, 1, 0, 0, 0, tz2of(zonestr))
- end
-
- def _to_s
- s = format('%02d', @data.mon)
- add_tz(s)
- end
-end
-
-class XSDHexBinary < XSDAnySimpleType
- Type = QName.new(Namespace, HexBinaryLiteral)
-
- # String in Ruby could be a binary.
- def initialize(value = nil)
- init(Type, value)
- end
-
- def set_encoded(value)
- if /^[0-9a-fA-F]*$/ !~ value
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
- end
- @data = String.new(value).strip
- @is_nil = false
- end
-
- def string
- [@data].pack("H*")
- end
-
-private
-
- def screen_data(value)
- value.unpack("H*")[0].tr('a-f', 'A-F')
- end
-end
-
-class XSDBase64Binary < XSDAnySimpleType
- Type = QName.new(Namespace, Base64BinaryLiteral)
-
- # String in Ruby could be a binary.
- def initialize(value = nil)
- init(Type, value)
- end
-
- def set_encoded(value)
- if /^[A-Za-z0-9+\/=]*$/ !~ value
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
- end
- @data = String.new(value).strip
- @is_nil = false
- end
-
- def string
- @data.unpack("m")[0]
- end
-
-private
-
- def screen_data(value)
- [value].pack("m").strip
- end
-end
-
-class XSDAnyURI < XSDAnySimpleType
- Type = QName.new(Namespace, AnyURILiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data(value)
- begin
- URI.parse(value.to_s.strip)
- rescue URI::InvalidURIError
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
- end
- end
-end
-
-class XSDQName < XSDAnySimpleType
- Type = QName.new(Namespace, QNameLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data(value)
- /^(?:([^:]+):)?([^:]+)$/ =~ value.to_s.strip
- unless Regexp.last_match
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
- end
- prefix = $1
- localpart = $2
- [prefix, localpart]
- end
-
- def _set(data)
- if data.nil?
- @prefix = @localpart = @data = nil
- return
- end
- @prefix, @localpart = data
- @data = _to_s
- @data.freeze
- end
-
- def _to_s
- if @prefix
- "#{ @prefix }:#{ @localpart }"
- else
- "#{ @localpart }"
- end
- end
-end
-
-
-###
-## Derived types
-#
-class XSDNormalizedString < XSDString
- Type = QName.new(Namespace, NormalizedStringLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data(value)
- if /[\t\r\n]/ =~ value
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
- end
- super
- end
-end
-
-class XSDInteger < XSDDecimal
- Type = QName.new(Namespace, IntegerLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def screen_data_str(str)
- begin
- data = Integer(str)
- rescue ArgumentError
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
- end
- unless validate(data)
- raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.")
- end
- data
- end
-
- def _set(value)
- @data = value
- end
-
- def _to_s()
- @data.to_s
- end
-
- def validate(v)
- max = maxinclusive
- min = mininclusive
- (max.nil? or v <= max) and (min.nil? or v >= min)
- end
-
- def maxinclusive
- nil
- end
-
- def mininclusive
- nil
- end
-
- PositiveMinInclusive = 1
- def positive(v)
- PositiveMinInclusive <= v
- end
-end
-
-class XSDNonPositiveInteger < XSDInteger
- Type = QName.new(Namespace, NonPositiveIntegerLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- 0
- end
-
- def mininclusive
- nil
- end
-end
-
-class XSDNegativeInteger < XSDNonPositiveInteger
- Type = QName.new(Namespace, NegativeIntegerLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- -1
- end
-
- def mininclusive
- nil
- end
-end
-
-class XSDLong < XSDInteger
- Type = QName.new(Namespace, LongLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- +9223372036854775807
- end
-
- def mininclusive
- -9223372036854775808
- end
-end
-
-class XSDInt < XSDLong
- Type = QName.new(Namespace, IntLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- +2147483647
- end
-
- def mininclusive
- -2147483648
- end
-end
-
-class XSDShort < XSDInt
- Type = QName.new(Namespace, ShortLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- +32767
- end
-
- def mininclusive
- -32768
- end
-end
-
-class XSDByte < XSDShort
- Type = QName.new(Namespace, ByteLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- +127
- end
-
- def mininclusive
- -128
- end
-end
-
-class XSDNonNegativeInteger < XSDInteger
- Type = QName.new(Namespace, NonNegativeIntegerLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- nil
- end
-
- def mininclusive
- 0
- end
-end
-
-class XSDUnsignedLong < XSDNonNegativeInteger
- Type = QName.new(Namespace, UnsignedLongLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- +18446744073709551615
- end
-
- def mininclusive
- 0
- end
-end
-
-class XSDUnsignedInt < XSDUnsignedLong
- Type = QName.new(Namespace, UnsignedIntLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- +4294967295
- end
-
- def mininclusive
- 0
- end
-end
-
-class XSDUnsignedShort < XSDUnsignedInt
- Type = QName.new(Namespace, UnsignedShortLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- +65535
- end
-
- def mininclusive
- 0
- end
-end
-
-class XSDUnsignedByte < XSDUnsignedShort
- Type = QName.new(Namespace, UnsignedByteLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- +255
- end
-
- def mininclusive
- 0
- end
-end
-
-class XSDPositiveInteger < XSDNonNegativeInteger
- Type = QName.new(Namespace, PositiveIntegerLiteral)
-
- def initialize(value = nil)
- init(Type, value)
- end
-
-private
-
- def maxinclusive
- nil
- end
-
- def mininclusive
- 1
- end
-end
-
-
-end
diff --git a/lib/xsd/datatypes1999.rb b/lib/xsd/datatypes1999.rb
deleted file mode 100644
index c7d6479e54..0000000000
--- a/lib/xsd/datatypes1999.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# XSD4R - XML Schema Datatype 1999 support
-# Copyright (C) 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/datatypes'
-
-
-module XSD
- Namespace.replace('http://www.w3.org/1999/XMLSchema')
- InstanceNamespace.replace('http://www.w3.org/1999/XMLSchema-instance')
- AnyTypeLiteral.replace('ur-type')
- AnySimpleTypeLiteral.replace('ur-type')
- NilLiteral.replace('null')
- NilValue.replace('1')
- DateTimeLiteral.replace('timeInstant')
-end
diff --git a/lib/xsd/iconvcharset.rb b/lib/xsd/iconvcharset.rb
deleted file mode 100644
index 7e629d569b..0000000000
--- a/lib/xsd/iconvcharset.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# XSD4R - Charset handling with iconv.
-# 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 'iconv'
-
-
-module XSD
-
-
-class IconvCharset
- def self.safe_iconv(to, from, str)
- iconv = Iconv.new(to, from)
- out = ""
- begin
- out << iconv.iconv(str)
- rescue Iconv::IllegalSequence => e
- out << e.success
- ch, str = e.failed.split(//, 2)
- out << '?'
- warn("Failed to convert #{ch}")
- retry
- end
- return out
- end
-end
-
-
-end
diff --git a/lib/xsd/mapping.rb b/lib/xsd/mapping.rb
deleted file mode 100644
index 06d30d4cbf..0000000000
--- a/lib/xsd/mapping.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-# XSD4R - XML Mapping for Ruby
-# Copyright (C) 2005 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 "soap/parser"
-require 'soap/encodingstyle/literalHandler'
-require "soap/generator"
-require "soap/mapping"
-require "soap/mapping/wsdlliteralregistry"
-
-
-module XSD
-
-
-module Mapping
- MappingRegistry = SOAP::Mapping::WSDLLiteralRegistry.new
- MappingOpt = {:default_encodingstyle => SOAP::LiteralNamespace}
-
- def self.obj2xml(obj, elename = nil, io = nil)
- if !elename.nil? and !elename.is_a?(XSD::QName)
- elename = XSD::QName.new(nil, elename)
- end
- elename ||= XSD::QName.new(nil, SOAP::Mapping.name2elename(obj.class.to_s))
- soap = SOAP::Mapping.obj2soap(obj, MappingRegistry)
- soap.elename = elename
- generator = SOAP::SOAPGenerator.new(MappingOpt)
- generator.generate(soap, io)
- end
-
- def self.xml2obj(stream)
- parser = SOAP::Parser.new(MappingOpt)
- soap = parser.parse(stream)
- SOAP::Mapping.soap2obj(soap, MappingRegistry)
- end
-end
-
-
-end
diff --git a/lib/xsd/namedelements.rb b/lib/xsd/namedelements.rb
deleted file mode 100644
index a13396bb71..0000000000
--- a/lib/xsd/namedelements.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-# XSD4R - WSDL named element collection.
-# Copyright (C) 2002, 2003, 2005 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 XSD
-
-
-class NamedElements
- include Enumerable
-
- def initialize
- @elements = []
- @cache = {}
- end
-
- def dup
- o = NamedElements.new
- o.elements = @elements.dup
- o
- end
-
- def freeze
- super
- @elements.freeze
- self
- end
-
- def empty?
- size == 0
- end
-
- def size
- @elements.size
- end
-
- def [](idx)
- if idx.is_a?(Numeric)
- @elements[idx]
- else
- @cache[idx] ||= @elements.find { |item| item.name == idx }
- end
- end
-
- def find_name(name)
- @elements.find { |item| item.name.name == name }
- end
-
- def keys
- collect { |element| element.name }
- end
-
- def each
- @elements.each do |element|
- yield(element)
- end
- end
-
- def <<(rhs)
- @elements << rhs
- self
- end
-
- def delete(rhs)
- @elements.delete(rhs)
- end
-
- def +(rhs)
- o = NamedElements.new
- o.elements = @elements + rhs.elements
- o
- end
-
- def concat(rhs)
- @elements.concat(rhs.elements)
- self
- end
-
- Empty = NamedElements.new.freeze
-
-protected
-
- def elements=(rhs)
- @elements = rhs
- end
-
- def elements
- @elements
- end
-end
-
-end
diff --git a/lib/xsd/ns.rb b/lib/xsd/ns.rb
deleted file mode 100644
index 53eeae7130..0000000000
--- a/lib/xsd/ns.rb
+++ /dev/null
@@ -1,140 +0,0 @@
-# XSD4R - XML Schema Namespace library
-# Copyright (C) 2000-2003, 2005 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'
-
-
-module XSD
-
-
-class NS
- class Assigner
- def initialize
- @count = 0
- end
-
- def assign(ns)
- @count += 1
- "n#{@count}"
- end
- end
-
- attr_reader :default_namespace
-
- class FormatError < Error; end
-
-public
-
- def initialize(tag2ns = {})
- @tag2ns = tag2ns
- @assigner = nil
- @ns2tag = {}
- @tag2ns.each do |tag, ns|
- @ns2tag[ns] = tag
- end
- @default_namespace = nil
- end
-
- def assign(ns, tag = nil)
- if (tag == '')
- @default_namespace = ns
- tag
- else
- @assigner ||= Assigner.new
- tag ||= @assigner.assign(ns)
- @ns2tag[ns] = tag
- @tag2ns[tag] = ns
- tag
- end
- end
-
- def assigned?(ns)
- @default_namespace == ns or @ns2tag.key?(ns)
- end
-
- def assigned_tag?(tag)
- @tag2ns.key?(tag)
- end
-
- def clone_ns
- cloned = NS.new(@tag2ns.dup)
- cloned.assigner = @assigner
- cloned.assign(@default_namespace, '') if @default_namespace
- cloned
- end
-
- def name(name)
- if (name.namespace == @default_namespace)
- name.name
- elsif @ns2tag.key?(name.namespace)
- "#{@ns2tag[name.namespace]}:#{name.name}"
- else
- raise FormatError.new("namespace: #{name.namespace} not defined yet")
- end
- end
-
- def compare(ns, name, rhs)
- if (ns == @default_namespace)
- return true if (name == rhs)
- end
- @tag2ns.each do |assigned_tag, assigned_ns|
- if assigned_ns == ns && "#{assigned_tag}:#{name}" == rhs
- return true
- end
- end
- false
- end
-
- # $1 and $2 are necessary.
- ParseRegexp = Regexp.new('^([^:]+)(?::(.+))?$')
-
- def parse(str, local = false)
- if ParseRegexp =~ str
- if (name = $2) and (ns = @tag2ns[$1])
- return XSD::QName.new(ns, name)
- end
- end
- XSD::QName.new(local ? nil : @default_namespace, str)
- end
-
- # For local attribute key parsing
- # <foo xmlns="urn:a" xmlns:n1="urn:a" bar="1" n1:baz="2" />
- # =>
- # {}bar, {urn:a}baz
- def parse_local(elem)
- ParseRegexp =~ elem
- if $2
- ns = @tag2ns[$1]
- name = $2
- if !ns
- raise FormatError.new("unknown namespace qualifier: #{$1}")
- end
- elsif $1
- ns = nil
- name = $1
- else
- raise FormatError.new("illegal element format: #{elem}")
- end
- XSD::QName.new(ns, name)
- end
-
- def each_ns
- @ns2tag.each do |ns, tag|
- yield(ns, tag)
- end
- end
-
-protected
-
- def assigner=(assigner)
- @assigner = assigner
- end
-end
-
-
-end
diff --git a/lib/xsd/qname.rb b/lib/xsd/qname.rb
deleted file mode 100644
index bb9763a69a..0000000000
--- a/lib/xsd/qname.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-# XSD4R - XML QName definition.
-# Copyright (C) 2002, 2003, 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.
-
-
-module XSD
-
-
-class QName
- attr_accessor :namespace
- attr_accessor :name
- attr_accessor :source
-
- def initialize(namespace = nil, name = nil)
- @namespace = namespace
- @name = name
- @source = nil
- end
-
- def dup_name(name)
- XSD::QName.new(@namespace, name)
- end
-
- def dump
- ns = @namespace.nil? ? 'nil' : @namespace.dump
- name = @name.nil? ? 'nil' : @name.dump
- "XSD::QName.new(#{ns}, #{name})"
- end
-
- def match(rhs)
- if rhs.namespace and (rhs.namespace != @namespace)
- return false
- end
- if rhs.name and (rhs.name != @name)
- return false
- end
- true
- end
-
- def ==(rhs)
- !rhs.nil? and @namespace == rhs.namespace and @name == rhs.name
- end
-
- def ===(rhs)
- (self == rhs)
- end
-
- def eql?(rhs)
- (self == rhs)
- end
-
- def hash
- @namespace.hash ^ @name.hash
- end
-
- def to_s
- "{#{ namespace }}#{ name }"
- end
-
- def inspect
- sprintf("#<%s:0x%x %s>", self.class.name, __id__,
- "{#{ namespace }}#{ name }")
- end
-
- NormalizedNameRegexp = /^\{([^}]*)\}(.*)$/
- def parse(str)
- NormalizedNameRegexp =~ str
- self.new($1, $2)
- end
-
- EMPTY = QName.new.freeze
-end
-
-
-end
diff --git a/lib/xsd/xmlparser.rb b/lib/xsd/xmlparser.rb
deleted file mode 100644
index e79e36c58c..0000000000
--- a/lib/xsd/xmlparser.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-# XSD4R - 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/xmlparser/parser'
-
-
-module XSD
-
-
-module XMLParser
- def create_parser(host, opt)
- XSD::XMLParser::Parser.create_parser(host, opt)
- end
- module_function :create_parser
-
- # $1 is necessary.
- NSParseRegexp = Regexp.new('^xmlns:?(.*)$')
-
- def filter_ns(ns, attrs)
- return attrs if attrs.nil? or attrs.empty?
- newattrs = {}
- attrs.each do |key, value|
- if (NSParseRegexp =~ key)
- # '' means 'default namespace'.
- tag = $1 || ''
- ns.assign(value, tag)
- else
- newattrs[key] = value
- end
- end
- newattrs
- end
- module_function :filter_ns
-end
-
-
-end
-
-
-# Try to load XML processor.
-loaded = false
-[
- 'xsd/xmlparser/xmlparser',
- 'xsd/xmlparser/xmlscanner',
- 'xsd/xmlparser/rexmlparser',
-].each do |lib|
- begin
- require lib
- loaded = true
- break
- rescue LoadError
- end
-end
-unless loaded
- raise RuntimeError.new("XML processor module not found.")
-end
diff --git a/lib/xsd/xmlparser/parser.rb b/lib/xsd/xmlparser/parser.rb
deleted file mode 100644
index ad01d55aa0..0000000000
--- a/lib/xsd/xmlparser/parser.rb
+++ /dev/null
@@ -1,96 +0,0 @@
-# XSD4R - 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'
-
-
-module XSD
-module XMLParser
-
-
-class Parser
- class ParseError < Error; end
- class FormatDecodeError < ParseError; end
- class UnknownElementError < FormatDecodeError; end
- class UnknownAttributeError < FormatDecodeError; end
- class UnexpectedElementError < FormatDecodeError; end
- class ElementConstraintError < FormatDecodeError; end
-
- @@parser_factory = nil
-
- def self.factory
- @@parser_factory
- end
-
- def self.create_parser(host, opt = {})
- @@parser_factory.new(host, opt)
- end
-
- def self.add_factory(factory)
- if $DEBUG
- puts "Set #{ factory } as XML processor."
- end
- @@parser_factory = factory
- end
-
-public
-
- attr_accessor :charset
-
- def initialize(host, opt = {})
- @host = host
- @charset = opt[:charset] || nil
- end
-
- def parse(string_or_readable)
- @textbuf = ''
- prologue
- do_parse(string_or_readable)
- epilogue
- end
-
-private
-
- def do_parse(string_or_readable)
- raise NotImplementError.new(
- 'Method do_parse must be defined in derived class.')
- end
-
- def start_element(name, attrs)
- @host.start_element(name, attrs)
- end
-
- def characters(text)
- @host.characters(text)
- end
-
- def end_element(name)
- @host.end_element(name)
- end
-
- def prologue
- end
-
- def epilogue
- end
-
- def xmldecl_encoding=(charset)
- if @charset.nil?
- @charset = charset
- else
- # Definition in a stream (like HTTP) has a priority.
- p "encoding definition: #{ charset } is ignored." if $DEBUG
- end
- end
-end
-
-
-end
-end
diff --git a/lib/xsd/xmlparser/rexmlparser.rb b/lib/xsd/xmlparser/rexmlparser.rb
deleted file mode 100644
index 61da9aafc7..0000000000
--- a/lib/xsd/xmlparser/rexmlparser.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# XSD4R - REXMLParser XML 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/xmlparser'
-require 'rexml/streamlistener'
-require 'rexml/document'
-
-
-module XSD
-module XMLParser
-
-
-class REXMLParser < XSD::XMLParser::Parser
- include REXML::StreamListener
-
- def do_parse(string_or_readable)
- source = nil
- source = REXML::SourceFactory.create_from(string_or_readable)
- source.encoding = charset if charset
- # Listener passes a String in utf-8.
- @charset = 'utf-8'
- REXML::Document.parse_stream(source, self)
- end
-
- def epilogue
- end
-
- def tag_start(name, attrs)
- start_element(name, attrs)
- end
-
- def tag_end(name)
- end_element(name)
- end
-
- def text(text)
- characters(text)
- end
-
- def xmldecl(version, encoding, standalone)
- # Version should be checked.
- end
-
- add_factory(self)
-end
-
-
-end
-end
diff --git a/lib/xsd/xmlparser/xmlparser.rb b/lib/xsd/xmlparser/xmlparser.rb
deleted file mode 100644
index 6db914cd37..0000000000
--- a/lib/xsd/xmlparser/xmlparser.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-# XSD4R - XMLParser XML parser library.
-# Copyright (C) 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/xmlparser'
-require 'xml/parser'
-
-
-module XSD
-module XMLParser
-
-
-class XMLParser < XSD::XMLParser::Parser
- class Listener < XML::Parser
- begin
- require 'xml/encoding-ja'
- include XML::Encoding_ja
- rescue LoadError
- # uconv may not be installed.
- end
- end
-
- def do_parse(string_or_readable)
- # XMLParser passes a String in utf-8.
- @charset = 'utf-8'
- @parser = Listener.new
- @parser.parse(string_or_readable) do |type, name, data|
- case type
- when XML::Parser::START_ELEM
- start_element(name, data)
- when XML::Parser::END_ELEM
- end_element(name)
- when XML::Parser::CDATA
- characters(data)
- else
- raise FormatDecodeError.new("Unexpected XML: #{ type }/#{ name }/#{ data }.")
- end
- end
- end
-
- add_factory(self)
-end
-
-
-end
-end
diff --git a/lib/xsd/xmlparser/xmlscanner.rb b/lib/xsd/xmlparser/xmlscanner.rb
deleted file mode 100644
index c80dc23910..0000000000
--- a/lib/xsd/xmlparser/xmlscanner.rb
+++ /dev/null
@@ -1,147 +0,0 @@
-# XSD4R - XMLScan XML parser library.
-# Copyright (C) 2002, 2003, 2005 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/xmlparser'
-require 'xmlscan/scanner'
-
-
-module XSD
-module XMLParser
-
-
-class XMLScanner < XSD::XMLParser::Parser
- include XMLScan::Visitor
-
- def do_parse(string_or_readable)
- @attrs = {}
- @curattr = nil
- @scanner = XMLScan::XMLScanner.new(self)
- @scanner.kcode = XSD::Charset.charset_str(charset) if charset
- @scanner.parse(string_or_readable)
- end
-
- def scanner_kcode=(charset)
- @scanner.kcode = XSD::Charset.charset_str(charset) if charset
- self.xmldecl_encoding = charset
- end
-
- ENTITY_REF_MAP = {
- 'lt' => '<',
- 'gt' => '>',
- 'amp' => '&',
- 'quot' => '"',
- 'apos' => '\''
- }
-
- def parse_error(msg)
- raise ParseError.new(msg)
- end
-
- def wellformed_error(msg)
- raise NotWellFormedError.new(msg)
- end
-
- def valid_error(msg)
- raise NotValidError.new(msg)
- end
-
- def warning(msg)
- p msg if $DEBUG
- end
-
- # def on_xmldecl; end
-
- def on_xmldecl_version(str)
- # 1.0 expected.
- end
-
- def on_xmldecl_encoding(str)
- self.scanner_kcode = str
- end
-
- # def on_xmldecl_standalone(str); end
-
- # def on_xmldecl_other(name, value); end
-
- # def on_xmldecl_end; end
-
- # def on_doctype(root, pubid, sysid); end
-
- # def on_prolog_space(str); end
-
- # def on_comment(str); end
-
- # def on_pi(target, pi); end
-
- def on_chardata(str)
- characters(str)
- end
-
- # def on_cdata(str); end
-
- def on_etag(name)
- end_element(name)
- end
-
- def on_entityref(ref)
- characters(ENTITY_REF_MAP[ref])
- end
-
- def on_charref(code)
- characters([code].pack('U'))
- end
-
- def on_charref_hex(code)
- on_charref(code)
- end
-
- # def on_start_document; end
-
- # def on_end_document; end
-
- def on_stag(name)
- @attrs = {}
- end
-
- def on_attribute(name)
- @attrs[name] = @curattr = ''
- end
-
- def on_attr_value(str)
- @curattr << str
- end
-
- def on_attr_entityref(ref)
- @curattr << ENTITY_REF_MAP[ref]
- end
-
- def on_attr_charref(code)
- @curattr << [code].pack('U')
- end
-
- def on_attr_charref_hex(code)
- on_attr_charref(code)
- end
-
- # def on_attribute_end(name); end
-
- def on_stag_end_empty(name)
- on_stag_end(name)
- on_etag(name)
- end
-
- def on_stag_end(name)
- start_element(name, @attrs)
- end
-
- add_factory(self)
-end
-
-
-end
-end
diff --git a/test/soap/asp.net/hello.wsdl b/test/soap/asp.net/hello.wsdl
deleted file mode 100644
index b94129c152..0000000000
--- a/test/soap/asp.net/hello.wsdl
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
-xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
-xmlns:s="http://www.w3.org/2001/XMLSchema"
-xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
-xmlns:tns="http://localhost/WebService/"
-xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
-xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
-targetNamespace="http://localhost/WebService/"
-xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified"
-targetNamespace="http://localhost/WebService/">
- <s:element name="HelloWorld">
- <s:complexType />
- </s:element>
- <s:element name="HelloWorldResponse">
- <s:complexType>
- <s:sequence>
- <s:element minOccurs="0" maxOccurs="1"
-name="HelloWorldResult" type="s:string" />
- </s:sequence>
- </s:complexType>
- </s:element>
- <s:element name="SayHello">
- <s:complexType>
- <s:sequence>
- <s:element minOccurs="0" maxOccurs="1" name="name"
-type="s:string" />
- </s:sequence>
- </s:complexType>
- </s:element>
- <s:element name="SayHelloResponse">
- <s:complexType>
- <s:sequence>
- <s:element minOccurs="0" maxOccurs="1"
-name="SayHelloResult" type="s:string" />
- </s:sequence>
- </s:complexType>
- </s:element>
- </s:schema>
- </wsdl:types>
- <wsdl:message name="HelloWorldSoapIn">
- <wsdl:part name="parameters" element="tns:HelloWorld" />
- </wsdl:message>
- <wsdl:message name="HelloWorldSoapOut">
- <wsdl:part name="parameters" element="tns:HelloWorldResponse" />
- </wsdl:message>
- <wsdl:message name="SayHelloSoapIn">
- <wsdl:part name="parameters" element="tns:SayHello" />
- </wsdl:message>
- <wsdl:message name="SayHelloSoapOut">
- <wsdl:part name="parameters" element="tns:SayHelloResponse" />
- </wsdl:message>
- <wsdl:portType name="Service1Soap">
- <wsdl:operation name="HelloWorld">
- <wsdl:input message="tns:HelloWorldSoapIn" />
- <wsdl:output message="tns:HelloWorldSoapOut" />
- </wsdl:operation>
- <wsdl:operation name="SayHello">
- <wsdl:input message="tns:SayHelloSoapIn" />
- <wsdl:output message="tns:SayHelloSoapOut" />
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
-style="document" />
- <wsdl:operation name="HelloWorld">
- <soap:operation
-soapAction="http://localhost/WebService/HelloWorld" style="document" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="SayHello">
- <soap:operation soapAction="http://localhost/WebService/SayHello"
-style="document" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="Service1">
- <documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
- <wsdl:port name="Service1Soap" binding="tns:Service1Soap">
- <soap:address
-location="http://localhost/WebService/Service1.asmx" />
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/test/soap/asp.net/test_aspdotnet.rb b/test/soap/asp.net/test_aspdotnet.rb
deleted file mode 100644
index 7d5f3fd288..0000000000
--- a/test/soap/asp.net/test_aspdotnet.rb
+++ /dev/null
@@ -1,111 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/standaloneServer'
-require 'soap/rpc/driver'
-
-
-module SOAP; module ASPDotNet
-
-
-class TestASPDotNet < Test::Unit::TestCase
- class Server < ::SOAP::RPC::StandaloneServer
- Namespace = "http://localhost/WebService/"
-
- def on_init
- add_document_method(
- self,
- Namespace + 'SayHello',
- 'sayHello',
- XSD::QName.new(Namespace, 'SayHello'),
- XSD::QName.new(Namespace, 'SayHelloResponse')
- )
- end
-
- def sayHello(arg)
- name = arg['name']
- "Hello #{name}"
- end
- end
-
- Port = 17171
- Endpoint = "http://localhost:#{Port}/"
-
- def setup
- setup_server
- @client = nil
- end
-
- def teardown
- teardown_server
- @client.reset_stream if @client
- end
-
- def setup_server
- @server = Server.new('Test', Server::Namespace, '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def test_document_method
- @client = SOAP::RPC::Driver.new(Endpoint, Server::Namespace)
- @client.wiredump_dev = STDOUT if $DEBUG
- @client.add_document_method('sayHello', Server::Namespace + 'SayHello',
- XSD::QName.new(Server::Namespace, 'SayHello'),
- XSD::QName.new(Server::Namespace, 'SayHelloResponse'))
- assert_equal("Hello Mike", @client.sayHello(:name => "Mike"))
- end
-
- def test_aspdotnethandler
- @client = SOAP::RPC::Driver.new(Endpoint, Server::Namespace)
- @client.wiredump_dev = STDOUT if $DEBUG
- @client.add_method_with_soapaction('sayHello', Server::Namespace + 'SayHello', 'name')
- @client.default_encodingstyle = SOAP::EncodingStyle::ASPDotNetHandler::Namespace
- assert_equal("Hello Mike", @client.sayHello("Mike"))
- end
-
- if defined?(HTTPAccess2)
-
- # qualified!
- REQUEST_ASPDOTNETHANDLER =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:sayHello xmlns:n1="http://localhost/WebService/">
- <n1:name>Mike</n1:name>
- </n1:sayHello>
- </env:Body>
-</env:Envelope>]
-
- def test_aspdotnethandler_envelope
- @client = SOAP::RPC::Driver.new(Endpoint, Server::Namespace)
- @client.wiredump_dev = str = ''
- @client.add_method_with_soapaction('sayHello', Server::Namespace + 'SayHello', 'name')
- @client.default_encodingstyle = SOAP::EncodingStyle::ASPDotNetHandler::Namespace
- assert_equal("Hello Mike", @client.sayHello("Mike"))
- assert_equal(REQUEST_ASPDOTNETHANDLER, parse_requestxml(str))
- end
-
- def parse_requestxml(str)
- str.split(/\r?\n\r?\n/)[3]
- end
-
- end
-end
-
-
-end; end
diff --git a/test/soap/calc/calc.rb b/test/soap/calc/calc.rb
deleted file mode 100644
index 6bc78803b3..0000000000
--- a/test/soap/calc/calc.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-module CalcService
- def self.add(lhs, rhs)
- lhs + rhs
- end
-
- def self.sub(lhs, rhs)
- lhs - rhs
- end
-
- def self.multi(lhs, rhs)
- lhs * rhs
- end
-
- def self.div(lhs, rhs)
- lhs / rhs
- end
-end
diff --git a/test/soap/calc/calc2.rb b/test/soap/calc/calc2.rb
deleted file mode 100644
index 69495730e7..0000000000
--- a/test/soap/calc/calc2.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-class CalcService2
- def initialize(value = 0)
- @value = value
- end
-
- def set_value(value)
- @value = value
- end
-
- def get_value
- @value
- end
-
- def +(rhs)
- @value + rhs
- end
-
- def -(rhs)
- @value - rhs
- end
-
- def *(rhs)
- @value * rhs
- end
-
- def /(rhs)
- @value / rhs
- end
-end
diff --git a/test/soap/calc/server.cgi b/test/soap/calc/server.cgi
deleted file mode 100644
index 1eb0d1d864..0000000000
--- a/test/soap/calc/server.cgi
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'soap/rpc/cgistub'
-
-class CalcServer < SOAP::RPC::CGIStub
- def initialize(*arg)
- super
-
- require 'calc'
- servant = CalcService
- add_servant(servant, 'http://tempuri.org/calcService')
- end
-end
-
-status = CalcServer.new('CalcServer', nil).start
diff --git a/test/soap/calc/server.rb b/test/soap/calc/server.rb
deleted file mode 100644
index a93774d909..0000000000
--- a/test/soap/calc/server.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/standaloneServer'
-require 'calc'
-
-class CalcServer < SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super
-
- servant = CalcService
- add_servant(servant, 'http://tempuri.org/calcService')
- end
-end
-
-if $0 == __FILE__
- status = CalcServer.new('CalcServer', nil, '0.0.0.0', 17171).start
-end
diff --git a/test/soap/calc/server2.rb b/test/soap/calc/server2.rb
deleted file mode 100644
index 01c6d75289..0000000000
--- a/test/soap/calc/server2.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'soap/rpc/standaloneServer'
-require 'calc2'
-
-class CalcServer2 < SOAP::RPC::StandaloneServer
- def on_init
- servant = CalcService2.new
- add_method(servant, 'set_value', 'newValue')
- add_method(servant, 'get_value')
- add_method_as(servant, '+', 'add', 'lhs')
- add_method_as(servant, '-', 'sub', 'lhs')
- add_method_as(servant, '*', 'multi', 'lhs')
- add_method_as(servant, '/', 'div', 'lhs')
- end
-end
-
-if $0 == __FILE__
- status = CalcServer2.new('CalcServer', 'http://tempuri.org/calcService', '0.0.0.0', 17171).start
-end
diff --git a/test/soap/calc/test_calc.rb b/test/soap/calc/test_calc.rb
deleted file mode 100644
index 88738716a6..0000000000
--- a/test/soap/calc/test_calc.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'server.rb'
-
-
-module SOAP
-module Calc
-
-
-class TestCalc < Test::Unit::TestCase
- Port = 17171
-
- def setup
- @server = CalcServer.new(self.class.name, nil, '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- @server.start
- }
- @endpoint = "http://localhost:#{Port}/"
- @calc = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
- @calc.add_method('add', 'lhs', 'rhs')
- @calc.add_method('sub', 'lhs', 'rhs')
- @calc.add_method('multi', 'lhs', 'rhs')
- @calc.add_method('div', 'lhs', 'rhs')
- end
-
- def teardown
- @server.shutdown
- @t.kill
- @t.join
- @calc.reset_stream
- end
-
- def test_calc
- assert_equal(3, @calc.add(1, 2))
- assert_equal(-1.1, @calc.sub(1.1, 2.2))
- assert_equal(2.42, @calc.multi(1.1, 2.2))
- assert_equal(2, @calc.div(5, 2))
- assert_equal(2.5, @calc.div(5.0, 2))
- assert_equal(1.0/0.0, @calc.div(1.1, 0))
- assert_raises(ZeroDivisionError) do
- @calc.div(1, 0)
- end
- end
-end
-
-
-end
-end
diff --git a/test/soap/calc/test_calc2.rb b/test/soap/calc/test_calc2.rb
deleted file mode 100644
index f334b29bdb..0000000000
--- a/test/soap/calc/test_calc2.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'server2.rb'
-
-
-module SOAP
-module Calc
-
-
-class TestCalc2 < Test::Unit::TestCase
- Port = 17171
-
- def setup
- @server = CalcServer2.new('CalcServer', 'http://tempuri.org/calcService', '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- Thread.current.abort_on_exception = true
- @server.start
- }
- @endpoint = "http://localhost:#{Port}/"
- @var = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
- @var.wiredump_dev = STDERR if $DEBUG
- @var.add_method('set_value', 'newValue')
- @var.add_method('get_value')
- @var.add_method_as('+', 'add', 'rhs')
- @var.add_method_as('-', 'sub', 'rhs')
- @var.add_method_as('*', 'multi', 'rhs')
- @var.add_method_as('/', 'div', 'rhs')
- end
-
- def teardown
- @server.shutdown
- @t.kill
- @t.join
- @var.reset_stream
- end
-
- def test_calc2
- assert_equal(1, @var.set_value(1))
- assert_equal(3, @var + 2)
- assert_equal(-1.2, @var - 2.2)
- assert_equal(2.2, @var * 2.2)
- assert_equal(0, @var / 2)
- assert_equal(0.5, @var / 2.0)
- assert_raises(ZeroDivisionError) do
- @var / 0
- end
- end
-end
-
-
-end
-end
diff --git a/test/soap/calc/test_calc_cgi.rb b/test/soap/calc/test_calc_cgi.rb
deleted file mode 100644
index dc701978c4..0000000000
--- a/test/soap/calc/test_calc_cgi.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'logger'
-require 'webrick'
-require 'rbconfig'
-
-
-module SOAP
-module Calc
-
-
-class TestCalcCGI < Test::Unit::TestCase
- # This test shuld be run after installing ruby.
- RUBYBIN = File.join(
- RbConfig::CONFIG["bindir"],
- RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]
- )
- RUBYBIN << " -d" if $DEBUG
-
- Port = 17171
-
- def setup
- logger = Logger.new(STDERR)
- logger.level = Logger::Severity::ERROR
- @server = WEBrick::HTTPServer.new(
- :BindAddress => "0.0.0.0",
- :Logger => logger,
- :Port => Port,
- :AccessLog => [],
- :DocumentRoot => File.dirname(File.expand_path(__FILE__)),
- :CGIPathEnv => ENV['PATH'],
- :CGIInterpreter => RUBYBIN
- )
- @t = Thread.new {
- Thread.current.abort_on_exception = true
- @server.start
- }
- @endpoint = "http://localhost:#{Port}/server.cgi"
- @calc = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
- @calc.wiredump_dev = STDERR if $DEBUG
- @calc.add_method('add', 'lhs', 'rhs')
- @calc.add_method('sub', 'lhs', 'rhs')
- @calc.add_method('multi', 'lhs', 'rhs')
- @calc.add_method('div', 'lhs', 'rhs')
- end
-
- def teardown
- @server.shutdown
- @t.kill
- @t.join
- @calc.reset_stream
- end
-
- def test_calc_cgi
- assert_equal(3, @calc.add(1, 2))
- assert_equal(-1.1, @calc.sub(1.1, 2.2))
- assert_equal(2.42, @calc.multi(1.1, 2.2))
- assert_equal(2, @calc.div(5, 2))
- assert_equal(2.5, @calc.div(5.0, 2))
- assert_equal(1.0/0.0, @calc.div(1.1, 0))
- assert_raises(ZeroDivisionError) do
- @calc.div(1, 0)
- end
- end
-end
-
-
-end
-end
diff --git a/test/soap/fault/test_customfault.rb b/test/soap/fault/test_customfault.rb
deleted file mode 100644
index 2f7bc2be6e..0000000000
--- a/test/soap/fault/test_customfault.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'soap/rpc/standaloneServer'
-
-
-module SOAP
-module Fault
-
-
-class TestCustomFault < Test::Unit::TestCase
- Port = 17171
-
- class CustomFaultServer < SOAP::RPC::StandaloneServer
- def on_init
- add_method(self, 'fault', 'msg')
- end
-
- def fault(msg)
- SOAPFault.new(SOAPString.new("mycustom"),
- SOAPString.new("error: #{msg}"),
- SOAPString.new(self.class.name))
- end
- end
-
- def setup
- @server = CustomFaultServer.new('customfault', 'urn:customfault', '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- Thread.current.abort_on_exception = true
- @server.start
- }
- @endpoint = "http://localhost:#{Port}/"
- @client = SOAP::RPC::Driver.new(@endpoint, 'urn:customfault')
- @client.wiredump_dev = STDERR if $DEBUG
- @client.add_method("fault", "msg")
- end
-
- def teardown
- @server.shutdown
- @t.kill
- @t.join
- @client.reset_stream
- end
-
- def test_custom_fault
- begin
- @client.fault("message")
- assert(false, 'exception not raised')
- rescue SOAP::FaultError => e
- assert(true, 'exception raised')
- assert_equal('error: message', e.message)
- end
- end
-end
-
-
-end
-end
diff --git a/test/soap/header/server.cgi b/test/soap/header/server.cgi
deleted file mode 100644
index 2a188538d9..0000000000
--- a/test/soap/header/server.cgi
+++ /dev/null
@@ -1,119 +0,0 @@
-require 'pstore'
-require 'soap/rpc/cgistub'
-require 'soap/header/simplehandler'
-
-
-class AuthHeaderPortServer < SOAP::RPC::CGIStub
- PortName = 'http://tempuri.org/authHeaderPort'
- SupportPortName = 'http://tempuri.org/authHeaderSupportPort'
- MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth")
- SessionDB = File.join(File.expand_path(File.dirname(__FILE__)), 'session.pstoredb')
-
- class AuthHeaderService
- def self.create
- new
- end
-
- def deposit(amt)
- "deposit #{amt} OK"
- end
-
- def withdrawal(amt)
- "withdrawal #{amt} OK"
- end
- end
-
- class AuthHeaderSupportService
- def delete_sessiondb
- File.unlink(SessionDB) if File.file?(SessionDB)
- backup = SessionDB + "~"
- File.unlink(backup) if File.file?(backup)
- end
- end
-
- def initialize(*arg)
- super
- add_rpc_servant(AuthHeaderService.new, PortName)
- add_rpc_servant(AuthHeaderSupportService.new, SupportPortName)
- add_rpc_headerhandler(ServerAuthHeaderHandler.new)
- end
-
- class ServerAuthHeaderHandler < SOAP::Header::SimpleHandler
- Users = {
- 'NaHi' => 'passwd',
- 'HiNa' => 'wspass'
- }
-
- def initialize
- super(MyHeaderName)
- @db = PStore.new(SessionDB)
- @db.transaction do
- @db["root"] = {} unless @db.root?("root")
- end
- @userid = @sessionid = nil
- end
-
- def login(userid, passwd)
- userid and passwd and Users[userid] == passwd
- end
-
- def auth(sessionid)
- in_sessiondb do |root|
- root[sessionid][0]
- end
- end
-
- def create_session(userid)
- in_sessiondb do |root|
- while true
- key = create_sessionkey
- break unless root[key]
- end
- root[key] = [userid]
- key
- end
- end
-
- def destroy_session(sessionkey)
- in_sessiondb do |root|
- root.delete(sessionkey)
- end
- end
-
- def on_simple_outbound
- { "sessionid" => @sessionid }
- end
-
- def on_simple_inbound(my_header, mu)
- succeeded = false
- userid = my_header["userid"]
- passwd = my_header["passwd"]
- if login(userid, passwd)
- succeeded = true
- elsif sessionid = my_header["sessionid"]
- if userid = auth(sessionid)
- destroy_session(sessionid)
- succeeded = true
- end
- end
- raise RuntimeError.new("authentication failed") unless succeeded
- @userid = userid
- @sessionid = create_session(userid)
- end
-
- private
-
- def create_sessionkey
- Time.now.usec.to_s
- end
-
- def in_sessiondb
- @db.transaction do
- yield(@db["root"])
- end
- end
- end
-end
-
-
-status = AuthHeaderPortServer.new('AuthHeaderPortServer', nil).start
diff --git a/test/soap/header/test_authheader.rb b/test/soap/header/test_authheader.rb
deleted file mode 100644
index 47e1e76b82..0000000000
--- a/test/soap/header/test_authheader.rb
+++ /dev/null
@@ -1,240 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'soap/rpc/standaloneServer'
-require 'soap/header/simplehandler'
-
-
-module SOAP
-module Header
-
-
-class TestAuthHeader < Test::Unit::TestCase
- Port = 17171
- PortName = 'http://tempuri.org/authHeaderPort'
- MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth")
- DummyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "dummy")
-
- class AuthHeaderPortServer < SOAP::RPC::StandaloneServer
- class AuthHeaderService
- def self.create
- new
- end
-
- def deposit(amt)
- "deposit #{amt} OK"
- end
-
- def withdrawal(amt)
- "withdrawal #{amt} OK"
- end
- end
-
- def initialize(*arg)
- super
- add_rpc_servant(AuthHeaderService.new, PortName)
- ServerAuthHeaderHandler.init
- add_request_headerhandler(ServerAuthHeaderHandler)
- end
-
- class ServerAuthHeaderHandler < SOAP::Header::SimpleHandler
- class << self
- def create
- new
- end
-
- def init
- @users = {
- 'NaHi' => 'passwd',
- 'HiNa' => 'wspass'
- }
- @sessions = {}
- end
-
- def login(userid, passwd)
- userid and passwd and @users[userid] == passwd
- end
-
- def auth(sessionid)
- @sessions[sessionid][0]
- end
-
- def create_session(userid)
- while true
- key = create_sessionkey
- break unless @sessions[key]
- end
- @sessions[key] = [userid]
- key
- end
-
- def destroy_session(sessionkey)
- @sessions.delete(sessionkey)
- end
-
- def sessions
- @sessions
- end
-
- private
-
- def create_sessionkey
- Time.now.usec.to_s
- end
- end
-
- def initialize
- super(MyHeaderName)
- @userid = @sessionid = nil
- end
-
- def on_simple_outbound
- { "sessionid" => @sessionid }
- end
-
- def on_simple_inbound(my_header, mu)
- auth = false
- userid = my_header["userid"]
- passwd = my_header["passwd"]
- if self.class.login(userid, passwd)
- auth = true
- elsif sessionid = my_header["sessionid"]
- if userid = self.class.auth(sessionid)
- self.class.destroy_session(sessionid)
- auth = true
- end
- end
- raise RuntimeError.new("authentication failed") unless auth
- @userid = userid
- @sessionid = self.class.create_session(userid)
- end
- end
- end
-
- class ClientAuthHeaderHandler < SOAP::Header::SimpleHandler
- def initialize(userid, passwd, mustunderstand)
- super(MyHeaderName)
- @sessionid = nil
- @userid = userid
- @passwd = passwd
- @mustunderstand = mustunderstand
- end
-
- def on_simple_outbound
- if @sessionid
- { "sessionid" => @sessionid }
- else
- { "userid" => @userid, "passwd" => @passwd }
- end
- end
-
- def on_simple_inbound(my_header, mustunderstand)
- @sessionid = my_header["sessionid"]
- end
-
- def sessionid
- @sessionid
- end
- end
-
- class DummyHeaderHandler < SOAP::Header::SimpleHandler
- def initialize(mustunderstand)
- super(DummyHeaderName)
- @mustunderstand = mustunderstand
- end
-
- def on_simple_outbound
- { XSD::QName.new("foo", "bar") => nil }
- end
-
- def on_simple_inbound(my_header, mustunderstand)
- end
- end
-
- def setup
- @endpoint = "http://localhost:#{Port}/"
- setup_server
- setup_client
- end
-
- def setup_server
- @server = AuthHeaderPortServer.new(self.class.name, nil, '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- @server.start
- }
- end
-
- def setup_client
- @client = SOAP::RPC::Driver.new(@endpoint, PortName)
- @client.wiredump_dev = STDERR if $DEBUG
- @client.add_method('deposit', 'amt')
- @client.add_method('withdrawal', 'amt')
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @t.kill
- @t.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def test_success_no_mu
- h = ClientAuthHeaderHandler.new('NaHi', 'passwd', false)
- @client.headerhandler << h
- do_transaction_check(h)
- end
-
- def test_success_mu
- h = ClientAuthHeaderHandler.new('NaHi', 'passwd', true)
- @client.headerhandler << h
- do_transaction_check(h)
- end
-
- def test_no_mu
- h = ClientAuthHeaderHandler.new('NaHi', 'passwd', true)
- @client.headerhandler << h
- @client.headerhandler << DummyHeaderHandler.new(false)
- do_transaction_check(h)
- end
-
- def test_mu
- h = ClientAuthHeaderHandler.new('NaHi', 'passwd', true)
- @client.headerhandler << h
- @client.headerhandler << (h2 = DummyHeaderHandler.new(true))
- assert_raise(SOAP::UnhandledMustUnderstandHeaderError) do
- assert_equal("deposit 150 OK", @client.deposit(150))
- end
- @client.headerhandler.delete(h2)
- @client.headerhandler << (h2 = DummyHeaderHandler.new(false))
- do_transaction_check(h)
- end
-
- def do_transaction_check(h)
- assert_equal("deposit 150 OK", @client.deposit(150))
- serversess = AuthHeaderPortServer::ServerAuthHeaderHandler.sessions[h.sessionid]
- assert_equal("NaHi", serversess[0])
- assert_equal("withdrawal 120 OK", @client.withdrawal(120))
- serversess = AuthHeaderPortServer::ServerAuthHeaderHandler.sessions[h.sessionid]
- assert_equal("NaHi", serversess[0])
- end
-
- def test_authfailure
- h = ClientAuthHeaderHandler.new('NaHi', 'pa', false)
- @client.headerhandler << h
- assert_raises(RuntimeError) do
- @client.deposit(150)
- end
- end
-end
-
-
-end
-end
diff --git a/test/soap/header/test_authheader_cgi.rb b/test/soap/header/test_authheader_cgi.rb
deleted file mode 100644
index 8d41837f58..0000000000
--- a/test/soap/header/test_authheader_cgi.rb
+++ /dev/null
@@ -1,121 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'soap/rpc/standaloneServer'
-require 'soap/header/simplehandler'
-require 'logger'
-require 'webrick'
-require 'rbconfig'
-
-
-module SOAP
-module Header
-
-
-class TestAuthHeaderCGI < Test::Unit::TestCase
- # This test shuld be run after installing ruby.
- RUBYBIN = File.join(
- RbConfig::CONFIG["bindir"],
- RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]
- )
- RUBYBIN << " -d" if $DEBUG
-
- Port = 17171
- PortName = 'http://tempuri.org/authHeaderPort'
- SupportPortName = 'http://tempuri.org/authHeaderSupportPort'
- MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth")
-
- class ClientAuthHeaderHandler < SOAP::Header::SimpleHandler
- def initialize(userid, passwd)
- super(MyHeaderName)
- @sessionid = nil
- @userid = userid
- @passwd = passwd
- end
-
- def on_simple_outbound
- if @sessionid
- { "sessionid" => @sessionid }
- else
- { "userid" => @userid, "passwd" => @passwd }
- end
- end
-
- def on_simple_inbound(my_header, mustunderstand)
- @sessionid = my_header["sessionid"]
- end
-
- def sessionid
- @sessionid
- end
- end
-
- def setup
- @endpoint = "http://localhost:#{Port}/"
- setup_server
- setup_client
- end
-
- def setup_server
- @endpoint = "http://localhost:#{Port}/server.cgi"
- logger = Logger.new(STDERR)
- logger.level = Logger::Severity::ERROR
- @server = WEBrick::HTTPServer.new(
- :BindAddress => "0.0.0.0",
- :Logger => logger,
- :Port => Port,
- :AccessLog => [],
- :DocumentRoot => File.dirname(File.expand_path(__FILE__)),
- :CGIPathEnv => ENV['PATH'],
- :CGIInterpreter => RUBYBIN
- )
- @t = Thread.new {
- Thread.current.abort_on_exception = true
- @server.start
- }
- end
-
- def setup_client
- @client = SOAP::RPC::Driver.new(@endpoint, PortName)
- @client.wiredump_dev = STDERR if $DEBUG
- @client.add_method('deposit', 'amt')
- @client.add_method('withdrawal', 'amt')
- @supportclient = SOAP::RPC::Driver.new(@endpoint, SupportPortName)
- @supportclient.add_method('delete_sessiondb')
- end
-
- def teardown
- @supportclient.delete_sessiondb
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @t.kill
- @t.join
- end
-
- def teardown_client
- @client.reset_stream
- @supportclient.reset_stream
- end
-
- def test_success
- h = ClientAuthHeaderHandler.new('NaHi', 'passwd')
- @client.headerhandler << h
- assert_equal("deposit 150 OK", @client.deposit(150))
- assert_equal("withdrawal 120 OK", @client.withdrawal(120))
- end
-
- def test_authfailure
- h = ClientAuthHeaderHandler.new('NaHi', 'pa')
- @client.headerhandler << h
- assert_raises(RuntimeError) do
- @client.deposit(150)
- end
- end
-end
-
-
-end
-end
diff --git a/test/soap/header/test_simplehandler.rb b/test/soap/header/test_simplehandler.rb
deleted file mode 100644
index 75dbd4a550..0000000000
--- a/test/soap/header/test_simplehandler.rb
+++ /dev/null
@@ -1,116 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'soap/rpc/standaloneServer'
-require 'soap/header/simplehandler'
-
-
-module SOAP
-module Header
-
-
-class TestSimpleHandler < Test::Unit::TestCase
- Port = 17171
- PortName = 'http://tempuri.org/authHeaderPort'
-
- class PingPortServer < SOAP::RPC::StandaloneServer
- class PingService
- def self.create
- new
- end
-
- def ping
- Thread.current[:pingheader]
- end
- end
-
- def initialize(*arg)
- super
- add_rpc_servant(PingService.new, PortName)
- add_request_headerhandler(PingServerHeaderHandler)
- end
-
- class PingServerHeaderHandler < SOAP::Header::SimpleHandler
- MyHeaderName = XSD::QName.new("http://xmlsoap.org/Ping", "PingHeader")
-
- def self.create
- new
- end
-
- def initialize()
- super(MyHeaderName)
- end
-
- def on_simple_outbound
- "dummy"
- end
-
- def on_simple_inbound(my_header, mu)
- Thread.current[:pingheader] = my_header
- end
- end
- end
-
- class PingClientHeaderHandler < SOAP::Header::SimpleHandler
- MyHeaderName = XSD::QName.new("http://xmlsoap.org/Ping", "PingHeader")
-
- def initialize(pingHeader)
- super(MyHeaderName)
- @pingHeader = pingHeader
- @mustunderstand = false
- end
-
- def on_simple_outbound
- @pingHeader # --- note, not a Hash
- end
-
- def on_simple_inbound(my_header, mustunderstand)
- Thread.current[:pingheader] = my_header
- end
- end
-
- def setup
- @endpoint = "http://localhost:#{Port}/"
- setup_server
- setup_client
- end
-
- def setup_server
- @server = PingPortServer.new(self.class.name, nil, '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- @server.start
- }
- end
-
- def setup_client
- @client = SOAP::RPC::Driver.new(@endpoint, PortName)
- @client.wiredump_dev = STDERR if $DEBUG
- @client.add_method('ping')
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @t.kill
- @t.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def test_string
- h = PingClientHeaderHandler.new('pingheader')
- @client.headerhandler << h
- assert_equal("pingheader", @client.ping)
- assert_equal("dummy", Thread.current[:pingheader])
- end
-end
-
-
-end
-end
diff --git a/test/soap/helloworld/hw_s.rb b/test/soap/helloworld/hw_s.rb
deleted file mode 100644
index 1a54adb924..0000000000
--- a/test/soap/helloworld/hw_s.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-require 'soap/rpc/standaloneServer'
-
-class HelloWorldServer < SOAP::RPC::StandaloneServer
- def on_init
- add_method(self, 'hello_world', 'from')
- end
-
- def hello_world(from)
- "Hello World, from #{ from }"
- end
-end
-
-if $0 == __FILE__
- server = HelloWorldServer.new('hws', 'urn:hws', '0.0.0.0', 17171)
- server.start
-end
diff --git a/test/soap/helloworld/test_helloworld.rb b/test/soap/helloworld/test_helloworld.rb
deleted file mode 100644
index 40c35b57fb..0000000000
--- a/test/soap/helloworld/test_helloworld.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'hw_s.rb'
-
-
-module SOAP
-module HelloWorld
-
-
-class TestHelloWorld < Test::Unit::TestCase
- Port = 17171
-
- def setup
- @server = HelloWorldServer.new('hws', 'urn:hws', '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- Thread.current.abort_on_exception = true
- @server.start
- }
- @endpoint = "http://localhost:#{Port}/"
- @client = SOAP::RPC::Driver.new(@endpoint, 'urn:hws')
- @client.add_method("hello_world", "from")
- end
-
- def teardown
- @server.shutdown
- @t.kill
- @t.join
- @client.reset_stream
- end
-
- def test_hello_world
- assert_equal("Hello World, from NaHi", @client.hello_world("NaHi"))
- assert_equal("Hello World, from <&>", @client.hello_world("<&>"))
- end
-end
-
-
-end
-end
diff --git a/test/soap/marshal/test_digraph.rb b/test/soap/marshal/test_digraph.rb
deleted file mode 100644
index d7f30654f8..0000000000
--- a/test/soap/marshal/test_digraph.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-require 'test/unit'
-require 'soap/marshal'
-
-
-module SOAP
-module Marshal
-
-
-class Node; include SOAP::Marshallable
- attr_reader :first, :second, :str
-
- def initialize(*init_next)
- @first = init_next[0]
- @second = init_next[1]
- end
-end
-
-class TestDigraph < Test::Unit::TestCase
- def setup
- @n9 = Node.new
- @n81 = Node.new(@n9)
- @n82 = Node.new(@n9)
- @n7 = Node.new(@n81, @n82)
- @n61 = Node.new(@n7)
- @n62 = Node.new(@n7)
- @n5 = Node.new(@n61, @n62)
- @n41 = Node.new(@n5)
- @n42 = Node.new(@n5)
- @n3 = Node.new(@n41, @n42)
- @n21 = Node.new(@n3)
- @n22 = Node.new(@n3)
- @n1 = Node.new(@n21, @n22)
- end
-
- def test_marshal
- f = File.open("digraph_marshalled_string.soap", "wb")
- SOAP::Marshal.dump(@n1, f)
- f.close
- f = File.open("digraph_marshalled_string.soap")
- str = f.read
- f.close
- newnode = SOAP::Marshal.unmarshal(str)
- assert_equal(newnode.first.first.__id__, newnode.second.first.__id__)
- assert_equal(newnode.first.first.first.first.__id__, newnode.second.first.second.first.__id__)
- end
-
- def teardown
- if File.exist?("digraph_marshalled_string.soap")
- File.unlink("digraph_marshalled_string.soap")
- end
- end
-end
-
-
-end
-end
diff --git a/test/soap/marshal/test_marshal.rb b/test/soap/marshal/test_marshal.rb
deleted file mode 100644
index 5cc30a2b5d..0000000000
--- a/test/soap/marshal/test_marshal.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-require 'test/unit'
-require 'soap/marshal'
-dir = File.join(File.dirname(File.expand_path(__FILE__)), '../../ruby')
-orgpath = $:.dup
-begin
- $:.push(dir)
- require 'marshaltestlib'
-ensure
- $:.replace(orgpath)
-end
-
-module SOAP
-module Marshal
-class TestMarshal < Test::Unit::TestCase
- include MarshalTestLib
-
- def encode(o)
- SOAPMarshal.dump(o)
- end
-
- def decode(s)
- SOAPMarshal.load(s)
- end
-end
-end
-end
diff --git a/test/soap/marshal/test_struct.rb b/test/soap/marshal/test_struct.rb
deleted file mode 100644
index 33975c31b0..0000000000
--- a/test/soap/marshal/test_struct.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require 'test/unit'
-require 'soap/marshal'
-
-
-module SOAP
-module Marshal
-
-
-Foo1 = ::Struct.new("Foo1", :m)
-Foo2 = ::Struct.new(:m)
-class Foo3
- attr_accessor :m
-end
-
-class TestStruct < Test::Unit::TestCase
- def test_foo1
- org = Foo1.new
- org.m = org
- obj = convert(org)
- assert_equal(Foo1, obj.class)
- assert_equal(obj.m, obj)
- end
-
- def test_foo2
- org = Foo2.new
- org.m = org
- obj = convert(org)
- assert_equal(Foo2, obj.class)
- assert_equal(obj.m, obj)
- end
-
- def test_foo3
- org = Foo3.new
- org.m = org
- obj = convert(org)
- assert_equal(Foo3, obj.class)
- assert_equal(obj.m, obj)
- end
-
- def convert(obj)
- SOAP::Marshal.unmarshal(SOAP::Marshal.marshal(obj))
- end
-end
-
-
-end
-end
diff --git a/test/soap/ssl/README b/test/soap/ssl/README
deleted file mode 100644
index 98ebcf7c23..0000000000
--- a/test/soap/ssl/README
+++ /dev/null
@@ -1 +0,0 @@
-* certificates and keys in this directory is copied from http-access2 test.
diff --git a/test/soap/ssl/ca.cert b/test/soap/ssl/ca.cert
deleted file mode 100644
index bcabbee4ad..0000000000
--- a/test/soap/ssl/ca.cert
+++ /dev/null
@@ -1,23 +0,0 @@
------BEGIN CERTIFICATE-----
-MIID0DCCArigAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGDAJKUDES
-MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxCzAJBgNVBAMMAkNBMB4X
-DTA0MDEzMDAwNDIzMloXDTM2MDEyMjAwNDIzMlowPDELMAkGA1UEBgwCSlAxEjAQ
-BgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMQswCQYDVQQDDAJDQTCCASIw
-DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANbv0x42BTKFEQOE+KJ2XmiSdZpR
-wjzQLAkPLRnLB98tlzs4xo+y4RyY/rd5TT9UzBJTIhP8CJi5GbS1oXEerQXB3P0d
-L5oSSMwGGyuIzgZe5+vZ1kgzQxMEKMMKlzA73rbMd4Jx3u5+jdbP0EDrPYfXSvLY
-bS04n2aX7zrN3x5KdDrNBfwBio2/qeaaj4+9OxnwRvYP3WOvqdW0h329eMfHw0pi
-JI0drIVdsEqClUV4pebT/F+CPUPkEh/weySgo9wANockkYu5ujw2GbLFcO5LXxxm
-dEfcVr3r6t6zOA4bJwL0W/e6LBcrwiG/qPDFErhwtgTLYf6Er67SzLyA66UCAwEA
-AaOB3DCB2TAPBgNVHRMBAf8EBTADAQH/MDEGCWCGSAGG+EIBDQQkFiJSdWJ5L09w
-ZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBRJ7Xd380KzBV7f
-USKIQ+O/vKbhDzAOBgNVHQ8BAf8EBAMCAQYwZAYDVR0jBF0wW4AUSe13d/NCswVe
-31EiiEPjv7ym4Q+hQKQ+MDwxCzAJBgNVBAYMAkpQMRIwEAYDVQQKDAlKSU4uR1Iu
-SlAxDDAKBgNVBAsMA1JSUjELMAkGA1UEAwwCQ0GCAQAwDQYJKoZIhvcNAQEFBQAD
-ggEBAIu/mfiez5XN5tn2jScgShPgHEFJBR0BTJBZF6xCk0jyqNx/g9HMj2ELCuK+
-r/Y7KFW5c5M3AQ+xWW0ZSc4kvzyTcV7yTVIwj2jZ9ddYMN3nupZFgBK1GB4Y05GY
-MJJFRkSu6d/Ph5ypzBVw2YMT/nsOo5VwMUGLgS7YVjU+u/HNWz80J3oO17mNZllj
-PvORJcnjwlroDnS58KoJ7GDgejv3ESWADvX1OHLE4cRkiQGeLoEU4pxdCxXRqX0U
-PbwIkZN9mXVcrmPHq8MWi4eC/V7hnbZETMHuWhUoiNdOEfsAXr3iP4KjyyRdwc7a
-d/xgcK06UVQRL/HbEYGiQL056mc=
------END CERTIFICATE-----
diff --git a/test/soap/ssl/client.cert b/test/soap/ssl/client.cert
deleted file mode 100644
index ad13c4b735..0000000000
--- a/test/soap/ssl/client.cert
+++ /dev/null
@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDKDCCAhCgAwIBAgIBAjANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGDAJKUDES
-MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxCzAJBgNVBAMMAkNBMB4X
-DTA0MDEzMTAzMTQ1OFoXDTM1MDEyMzAzMTQ1OFowZTELMAkGA1UEBgwCSlAxEjAQ
-BgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMRAwDgYDVQQDDAdleGFtcGxl
-MSIwIAYJKoZIhvcNAQkBDBNleGFtcGxlQGV4YW1wbGUub3JnMIGfMA0GCSqGSIb3
-DQEBAQUAA4GNADCBiQKBgQDRWssrK8Gyr+500hpLjCGR3+AHL8/hEJM5zKi/MgLW
-jTkvsgOwbYwXOiNtAbR9y4/ucDq7EY+cMUMHES4uFaPTcOaAV0aZRmk8AgslN1tQ
-gNS6ew7/Luq3DcVeWkX8PYgR9VG0mD1MPfJ6+IFA5d3vKpdBkBgN4l46jjO0/2Xf
-ewIDAQABo4GPMIGMMAwGA1UdEwEB/wQCMAAwMQYJYIZIAYb4QgENBCQWIlJ1Ynkv
-T3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFOFvay0H7lr2
-xUx6waYEV2bVDYQhMAsGA1UdDwQEAwIF4DAdBgNVHSUEFjAUBggrBgEFBQcDAgYI
-KwYBBQUHAwQwDQYJKoZIhvcNAQEFBQADggEBABd2dYWqbDIWf5sWFvslezxJv8gI
-w64KCJBuyJAiDuf+oazr3016kMzAlt97KecLZDusGNagPrq02UX7YMoQFsWJBans
-cDtHrkM0al5r6/WGexNMgtYbNTYzt/IwodISGBgZ6dsOuhznwms+IBsTNDAvWeLP
-lt2tOqD8kEmjwMgn0GDRuKjs4EoboA3kMULb1p9akDV9ZESU3eOtpS5/G5J5msLI
-9WXbYBjcjvkLuJH9VsJhb+R58Vl0ViemvAHhPilSl1SPWVunGhv6FcIkdBEi1k9F
-e8BNMmsEjFiANiIRvpdLRbiGBt0KrKTndVfsmoKCvY48oCOvnzxtahFxfs8=
------END CERTIFICATE-----
diff --git a/test/soap/ssl/client.key b/test/soap/ssl/client.key
deleted file mode 100644
index 37bc62f259..0000000000
--- a/test/soap/ssl/client.key
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICWwIBAAKBgQDRWssrK8Gyr+500hpLjCGR3+AHL8/hEJM5zKi/MgLWjTkvsgOw
-bYwXOiNtAbR9y4/ucDq7EY+cMUMHES4uFaPTcOaAV0aZRmk8AgslN1tQgNS6ew7/
-Luq3DcVeWkX8PYgR9VG0mD1MPfJ6+IFA5d3vKpdBkBgN4l46jjO0/2XfewIDAQAB
-AoGAZcz8llWErtsV3QB9gNb3S/PNADGjqBFjReva8n3jG2k4sZSibpwWTwUaTNtT
-ZQgjSRKRvH1hk9XwffNAvXAQZNNkuj/16gO2oO45nyLj4dO365ujLptWnVIWDHOE
-uN0GeiZO+VzcCisT0WCq4tvtLeH8svrxzA8cbXIEyOK7NiECQQDwo2zPFyKAZ/Cu
-lDJ6zKT+RjfWwW7DgWzirAlTrt4ViMaW+IaDH29TmQpb4V4NuR3Xi+2Xl4oicu6S
-36TW9+/FAkEA3rgfOQJuLlWSnw1RTGwvnC816a/W7iYYY7B+0U4cDbfWl7IoXT4y
-M8nV/HESooviZLqBwzAYSoj3fFKYBKpGPwJAUO8GN5iWWA2dW3ooiDiv/X1sZmRk
-dojfMFWgRW747tEzya8Ivq0h6kH8w+5GjeMG8Gn1nRiwsulo6Ckj7dEx6QJACyui
-7UIQ8qP6GZ4aYMHgVW4Mvy7Bkeo5OO7GPYs0Xv/EdJFL8vlGnVBXOjUVoS9w6Gpu
-TbLg1QQvnX2rADjmEwJANxZO2GUkaWGsEif8aGW0x5g/IdaMGG27pTWk5zqix7P3
-1UDrdo/JOXhptovhRi06EppIxAxYmbh9vd9VN8Itlw==
------END RSA PRIVATE KEY-----
diff --git a/test/soap/ssl/server.cert b/test/soap/ssl/server.cert
deleted file mode 100644
index 998ccc5892..0000000000
--- a/test/soap/ssl/server.cert
+++ /dev/null
@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIC/zCCAeegAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQGDAJKUDES
-MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxDjAMBgNVBAMMBVN1YkNB
-MB4XDTA0MDEzMTAzMTMxNloXDTMzMDEyMzAzMTMxNlowQzELMAkGA1UEBgwCSlAx
-EjAQBgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMRIwEAYDVQQDDAlsb2Nh
-bGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANFJTxWqup3nV9dsJAku
-p+WaXnPNIzcpAA3qMGZDJTJsfa8Du7ZxTP0XJK5mETttBrn711cJxAuP3KjqnW9S
-vtZ9lY2sXJ6Zj62sN5LwG3VVe25dI28yR1EsbHjJ5Zjf9tmggMC6am52dxuHbt5/
-vHo4ngJuKE/U+eeGRivMn6gFAgMBAAGjgYUwgYIwDAYDVR0TAQH/BAIwADAxBglg
-hkgBhvhCAQ0EJBYiUnVieS9PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAd
-BgNVHQ4EFgQUpZIyygD9JxFYHHOTEuWOLbCKfckwCwYDVR0PBAQDAgWgMBMGA1Ud
-JQQMMAoGCCsGAQUFBwMBMA0GCSqGSIb3DQEBBQUAA4IBAQBwAIj5SaBHaA5X31IP
-CFCJiep96awfp7RANO0cuUj+ZpGoFn9d6FXY0g+Eg5wAkCNIzZU5NHN9xsdOpnUo
-zIBbyTfQEPrge1CMWMvL6uGaoEXytq84VTitF/xBTky4KtTn6+es4/e7jrrzeUXQ
-RC46gkHObmDT91RkOEGjHLyld2328jo3DIN/VTHIryDeVHDWjY5dENwpwdkhhm60
-DR9IrNBbXWEe9emtguNXeN0iu1ux0lG1Hc6pWGQxMlRKNvGh0yZB9u5EVe38tOV0
-jQaoNyL7qzcQoXD3Dmbi1p0iRmg/+HngISsz8K7k7MBNVsSclztwgCzTZOBiVtkM
-rRlQ
------END CERTIFICATE-----
diff --git a/test/soap/ssl/server.key b/test/soap/ssl/server.key
deleted file mode 100644
index 9ba2218a03..0000000000
--- a/test/soap/ssl/server.key
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQDRSU8Vqrqd51fXbCQJLqflml5zzSM3KQAN6jBmQyUybH2vA7u2
-cUz9FySuZhE7bQa5+9dXCcQLj9yo6p1vUr7WfZWNrFyemY+trDeS8Bt1VXtuXSNv
-MkdRLGx4yeWY3/bZoIDAumpudncbh27ef7x6OJ4CbihP1PnnhkYrzJ+oBQIDAQAB
-AoGBAIf4CstW2ltQO7+XYGoex7Hh8s9lTSW/G2vu5Hbr1LTHy3fzAvdq8MvVR12O
-rk9fa+lU9vhzPc0NMB0GIDZ9GcHuhW5hD1Wg9OSCbTOkZDoH3CAFqonjh4Qfwv5W
-IPAFn9KHukdqGXkwEMdErsUaPTy9A1V/aROVEaAY+HJgq/eZAkEA/BP1QMV04WEZ
-Oynzz7/lLizJGGxp2AOvEVtqMoycA/Qk+zdKP8ufE0wbmCE3Qd6GoynavsHb6aGK
-gQobb8zDZwJBANSK6MrXlrZTtEaeZuyOB4mAmRzGzOUVkUyULUjEx2GDT93ujAma
-qm/2d3E+wXAkNSeRpjUmlQXy/2oSqnGvYbMCQQDRM+cYyEcGPUVpWpnj0shrF/QU
-9vSot/X1G775EMTyaw6+BtbyNxVgOIu2J+rqGbn3c+b85XqTXOPL0A2RLYkFAkAm
-syhSDtE9X55aoWsCNZY/vi+i4rvaFoQ/WleogVQAeGVpdo7/DK9t9YWoFBIqth0L
-mGSYFu9ZhvZkvQNV8eYrAkBJ+rOIaLDsmbrgkeDruH+B/9yrm4McDtQ/rgnOGYnH
-LjLpLLOrgUxqpzLWe++EwSLwK2//dHO+SPsQJ4xsyQJy
------END RSA PRIVATE KEY-----
diff --git a/test/soap/ssl/sslsvr.rb b/test/soap/ssl/sslsvr.rb
deleted file mode 100644
index 4f67eb9485..0000000000
--- a/test/soap/ssl/sslsvr.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-require 'webrick/https'
-require 'logger'
-require 'rbconfig'
-
-require 'soap/rpc/httpserver'
-
-class HelloWorldServer < SOAP::RPC::HTTPServer
-private
-
- def on_init
- self.level = Logger::Severity::FATAL
- @default_namespace = 'urn:ssltst'
- add_method(self, 'hello_world', 'from')
- end
-
- def hello_world(from)
- "Hello World, from #{ from }"
- end
-end
-
-
-if $0 == __FILE__
- PORT = 17171
- DIR = File.dirname(File.expand_path(__FILE__))
-
- def cert(filename)
- OpenSSL::X509::Certificate.new(File.open(File.join(DIR, filename)) { |f|
- f.read
- })
- end
-
- def key(filename)
- OpenSSL::PKey::RSA.new(File.open(File.join(DIR, filename)) { |f|
- f.read
- })
- end
-
- $server = HelloWorldServer.new(
- :BindAddress => "0.0.0.0",
- :Port => PORT,
- :AccessLog => [],
- :SSLEnable => true,
- :SSLCACertificateFile => File.join(DIR, 'ca.cert'),
- :SSLCertificate => cert('server.cert'),
- :SSLPrivateKey => key('server.key'),
- :SSLVerifyClient => nil, #OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT|OpenSSL::SSL::VERIFY_PEER,
- :SSLClientCA => cert('ca.cert'),
- :SSLCertName => nil
- )
- t = Thread.new {
- Thread.current.abort_on_exception = true
- $server.start
- }
- STDOUT.sync = true
- puts $$
- t.join
-end
diff --git a/test/soap/ssl/subca.cert b/test/soap/ssl/subca.cert
deleted file mode 100644
index 1e471851b8..0000000000
--- a/test/soap/ssl/subca.cert
+++ /dev/null
@@ -1,21 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGDAJKUDES
-MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxCzAJBgNVBAMMAkNBMB4X
-DTA0MDEzMDAwNDMyN1oXDTM1MDEyMjAwNDMyN1owPzELMAkGA1UEBgwCSlAxEjAQ
-BgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMQ4wDAYDVQQDDAVTdWJDQTCC
-ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ0Ou7AyRcRXnB/kVHv/6kwe
-ANzgg/DyJfsAUqW90m7Lu1nqyug8gK0RBd77yU0w5HOAMHTVSdpjZK0g2sgx4Mb1
-d/213eL9TTl5MRVEChTvQr8q5DVG/8fxPPE7fMI8eOAzd98/NOAChk+80r4Sx7fC
-kGVEE1bKwY1MrUsUNjOY2d6t3M4HHV3HX1V8ShuKfsHxgCmLzdI8U+5CnQedFgkm
-3e+8tr8IX5RR1wA1Ifw9VadF7OdI/bGMzog/Q8XCLf+WPFjnK7Gcx6JFtzF6Gi4x
-4dp1Xl45JYiVvi9zQ132wu8A1pDHhiNgQviyzbP+UjcB/tsOpzBQF8abYzgEkWEC
-AwEAAaNyMHAwDwYDVR0TAQH/BAUwAwEB/zAxBglghkgBhvhCAQ0EJBYiUnVieS9P
-cGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUlCjXWLsReYzH
-LzsxwVnCXmKoB/owCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQCJ/OyN
-rT8Cq2Y+G2yA/L1EMRvvxwFBqxavqaqHl/6rwsIBFlB3zbqGA/0oec6MAVnYynq4
-c4AcHTjx3bQ/S4r2sNTZq0DH4SYbQzIobx/YW8PjQUJt8KQdKMcwwi7arHP7A/Ha
-LKu8eIC2nsUBnP4NhkYSGhbmpJK+PFD0FVtD0ZIRlY/wsnaZNjWWcnWF1/FNuQ4H
-ySjIblqVQkPuzebv3Ror6ZnVDukn96Mg7kP4u6zgxOeqlJGRe1M949SS9Vudjl8X
-SF4aZUUB9pQGhsqQJVqaz2OlhGOp9D0q54xko/rekjAIcuDjl1mdX4F2WRrzpUmZ
-uY/bPeOBYiVsOYVe
------END CERTIFICATE-----
diff --git a/test/soap/ssl/test_ssl.rb b/test/soap/ssl/test_ssl.rb
deleted file mode 100644
index 772b77c940..0000000000
--- a/test/soap/ssl/test_ssl.rb
+++ /dev/null
@@ -1,204 +0,0 @@
-require 'test/unit'
-begin
- require 'http-access2'
-rescue LoadError
-end
-require 'soap/rpc/driver'
-
-if defined?(HTTPAccess2) and defined?(OpenSSL)
-
-module SOAP; module SSL
-
-
-class TestSSL < Test::Unit::TestCase
- PORT = 17171
-
- DIR = File.dirname(File.expand_path(__FILE__))
- require 'rbconfig'
- RUBY = File.join(
- RbConfig::CONFIG["bindir"],
- RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]
- )
-
- def setup
- @url = "https://localhost:#{PORT}/hello"
- @serverpid = @client = nil
- @verify_callback_called = false
- setup_server
- setup_client
- end
-
- def teardown
- teardown_client
- teardown_server
- end
-
- def test_options
- cfg = @client.streamhandler.client.ssl_config
- assert_nil(cfg.client_cert)
- assert_nil(cfg.client_key)
- assert_nil(cfg.client_ca)
- assert_equal(OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT, cfg.verify_mode)
- assert_nil(cfg.verify_callback)
- assert_nil(cfg.timeout)
- assert_equal(OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_SSLv2, cfg.options)
- assert_equal("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH", cfg.ciphers)
- assert_instance_of(OpenSSL::X509::Store, cfg.cert_store)
- # dummy call to ensure sslsvr initialization finished.
- assert_raise(OpenSSL::SSL::SSLError) do
- @client.hello_world("ssl client")
- end
- end
-
- def test_verification
- cfg = @client.options
- cfg["protocol.http.ssl_config.verify_callback"] = method(:verify_callback).to_proc
- @verify_callback_called = false
- ssle = assert_raise(OpenSSL::SSL::SSLError) {@client.hello_world("ssl client")}
- assert_equal("certificate verify failed", ssle.message)
- assert(@verify_callback_called)
- #
- cfg["protocol.http.ssl_config.client_cert"] = File.join(DIR, "client.cert")
- cfg["protocol.http.ssl_config.client_key"] = File.join(DIR, "client.key")
- @verify_callback_called = false
- ssle = assert_raise(OpenSSL::SSL::SSLError) {@client.hello_world("ssl client")}
- assert_equal("certificate verify failed", ssle.message)
- assert(@verify_callback_called)
- #
- cfg["protocol.http.ssl_config.ca_file"] = File.join(DIR, "ca.cert")
- @verify_callback_called = false
- ssle = assert_raise(OpenSSL::SSL::SSLError) {@client.hello_world("ssl client")}
- assert_equal("certificate verify failed", ssle.message)
- assert(@verify_callback_called)
- #
- cfg["protocol.http.ssl_config.ca_file"] = File.join(DIR, "subca.cert")
- @verify_callback_called = false
- assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
- assert(@verify_callback_called)
- #
- cfg["protocol.http.ssl_config.verify_depth"] = "1"
- @verify_callback_called = false
- ssle = assert_raise(OpenSSL::SSL::SSLError) {@client.hello_world("ssl client")}
- assert_equal("certificate verify failed", ssle.message)
- assert(@verify_callback_called)
- #
- cfg["protocol.http.ssl_config.verify_depth"] = ""
- cfg["protocol.http.ssl_config.cert_store"] = OpenSSL::X509::Store.new
- cfg["protocol.http.ssl_config.verify_mode"] = OpenSSL::SSL::VERIFY_PEER.to_s
- ssle = assert_raise(OpenSSL::SSL::SSLError) {@client.hello_world("ssl client")}
- assert_equal("certificate verify failed", ssle.message)
- #
- cfg["protocol.http.ssl_config.verify_mode"] = ""
- assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
- end
-
- def test_property
- testpropertyname = File.join(DIR, 'soapclient.properties')
- File.open(testpropertyname, "w") do |f|
- f <<<<__EOP__
-protocol.http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_PEER
-# depth: 1 causes an error (intentional)
-protocol.http.ssl_config.verify_depth = 1
-protocol.http.ssl_config.client_cert = #{File.join(DIR, 'client.cert')}
-protocol.http.ssl_config.client_key = #{File.join(DIR, 'client.key')}
-protocol.http.ssl_config.ca_file = #{File.join(DIR, 'ca.cert')}
-protocol.http.ssl_config.ca_file = #{File.join(DIR, 'subca.cert')}
-protocol.http.ssl_config.ciphers = ALL
-__EOP__
- end
- begin
- @client.loadproperty(testpropertyname)
- @client.options["protocol.http.ssl_config.verify_callback"] = method(:verify_callback).to_proc
- @verify_callback_called = false
- # NG with String
- ssle = assert_raise(OpenSSL::SSL::SSLError) {@client.hello_world("ssl client")}
- assert_equal("certificate verify failed", ssle.message)
- assert(@verify_callback_called)
- # NG with Integer
- @client.options["protocol.http.ssl_config.verify_depth"] = 0
- ssle = assert_raise(OpenSSL::SSL::SSLError) {@client.hello_world("ssl client")}
- assert_equal("certificate verify failed", ssle.message)
- assert(@verify_callback_called)
- # OK with empty
- @client.options["protocol.http.ssl_config.verify_depth"] = ""
- @verify_callback_called = false
- assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
- assert(@verify_callback_called)
- # OK with nil
- @client.options["protocol.http.ssl_config.verify_depth"] = nil
- @verify_callback_called = false
- assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
- assert(@verify_callback_called)
- # OK with String
- @client.options["protocol.http.ssl_config.verify_depth"] = "3"
- @verify_callback_called = false
- assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
- assert(@verify_callback_called)
- # OK with Integer
- @client.options["protocol.http.ssl_config.verify_depth"] = 3
- @verify_callback_called = false
- assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
- assert(@verify_callback_called)
- ensure
- File.unlink(testpropertyname)
- end
- end
-
- def test_ciphers
- cfg = @client.options
- cfg["protocol.http.ssl_config.client_cert"] = File.join(DIR, 'client.cert')
- cfg["protocol.http.ssl_config.client_key"] = File.join(DIR, 'client.key')
- cfg["protocol.http.ssl_config.ca_file"] = File.join(DIR, "ca.cert")
- cfg["protocol.http.ssl_config.ca_file"] = File.join(DIR, "subca.cert")
- #cfg.timeout = 123
- cfg["protocol.http.ssl_config.ciphers"] = "!ALL"
- #
- ssle = assert_raise(OpenSSL::SSL::SSLError) {@client.hello_world("ssl client")}
- # depends on OpenSSL version. (?:0.9.8|0.9.7)
- assert_match(/\A(?:SSL_CTX_set_cipher_list:: no cipher match|no ciphers available)\z/, ssle.message)
- #
- cfg["protocol.http.ssl_config.ciphers"] = "ALL"
- assert_equal("Hello World, from ssl client", @client.hello_world("ssl client"))
- end
-
-private
-
- def q(str)
- %Q["#{str}"]
- end
-
- def setup_server
- svrcmd = "#{q(RUBY)} "
- #svrcmd << "-d " if $DEBUG
- svrcmd << File.join(DIR, "sslsvr.rb")
- svrout = IO.popen(svrcmd)
- @serverpid = Integer(svrout.gets.chomp)
- end
-
- def setup_client
- @client = SOAP::RPC::Driver.new(@url, 'urn:ssltst')
- @client.add_method("hello_world", "from")
- end
-
- def teardown_server
- if @serverpid
- Process.kill('KILL', @serverpid)
- Process.waitpid(@serverpid)
- end
- end
-
- def teardown_client
- @client.reset_stream if @client
- end
-
- def verify_callback(ok, cert)
- @verify_callback_called = true
- p ["client", ok, cert] if $DEBUG
- ok
- end
-end
-
-
-end; end
-
-end
diff --git a/test/soap/struct/test_struct.rb b/test/soap/struct/test_struct.rb
deleted file mode 100644
index d92f4bc18a..0000000000
--- a/test/soap/struct/test_struct.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/httpserver'
-require 'soap/rpc/driver'
-
-
-module SOAP; module Struct
-
-
-class TestStruct < Test::Unit::TestCase
- Namespace = "urn:example.com:simpletype-rpc"
- class Server < ::SOAP::RPC::HTTPServer
- @@test_struct = ::Struct.new(:one, :two)
-
- def on_init
- add_method(self, 'a_method')
- end
-
- def a_method
- @@test_struct.new("string", 1)
- end
- end
-
- Port = 17171
-
- def setup
- setup_server
- setup_client
- end
-
- def setup_server
- @server = Server.new(
- :Port => Port,
- :BindAddress => "0.0.0.0",
- :AccessLog => [],
- :SOAPDefaultNamespace => Namespace
- )
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_client
- @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/", Namespace)
- @client.wiredump_dev = STDERR if $DEBUG
- @client.add_method('a_method')
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def test_struct
- assert_equal("string", @client.a_method.one)
- assert_equal(1, @client.a_method.two)
- end
-end
-
-
-end; end
diff --git a/test/soap/swa/test_file.rb b/test/soap/swa/test_file.rb
deleted file mode 100644
index 1ec7aa92a7..0000000000
--- a/test/soap/swa/test_file.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'soap/rpc/standaloneServer'
-require 'soap/attachment'
-
-
-module SOAP
-module SWA
-
-
-class TestFile < Test::Unit::TestCase
- Port = 17171
- THIS_FILE = File.expand_path(__FILE__)
-
- class SwAService
- def get_file
- return {
- 'name' => $0,
- 'file' => SOAP::Attachment.new(File.open(THIS_FILE)) # closed when GCed.
- }
- end
-
- def put_file(name, file)
- "File '#{name}' was received ok."
- end
- end
-
- def setup
- @server = SOAP::RPC::StandaloneServer.new('SwAServer',
- 'http://www.acmetron.com/soap', '0.0.0.0', Port)
- @server.add_servant(SwAService.new)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- @server.start
- }
- @endpoint = "http://localhost:#{Port}/"
- @client = SOAP::RPC::Driver.new(@endpoint, 'http://www.acmetron.com/soap')
- @client.add_method('get_file')
- @client.add_method('put_file', 'name', 'file')
- @client.wiredump_dev = STDERR if $DEBUG
- end
-
- def teardown
- @server.shutdown
- @t.kill
- @t.join
- @client.reset_stream
- end
-
- def test_get_file
- assert_equal(
- File.open(THIS_FILE) { |f| f.read },
- @client.get_file['file'].content
- )
- end
-
- def test_put_file
- assert_equal(
- "File 'foo' was received ok.",
- @client.put_file('foo',
- SOAP::Attachment.new(File.open(THIS_FILE)))
- )
- assert_equal(
- "File 'bar' was received ok.",
- @client.put_file('bar',
- SOAP::Attachment.new(File.open(THIS_FILE) { |f| f.read }))
- )
- end
-end
-
-
-end
-end
diff --git a/test/soap/test_basetype.rb b/test/soap/test_basetype.rb
deleted file mode 100644
index 3785873560..0000000000
--- a/test/soap/test_basetype.rb
+++ /dev/null
@@ -1,970 +0,0 @@
-require 'test/unit'
-require 'soap/baseData'
-
-
-module SOAP
-
-
-class TestSOAP < Test::Unit::TestCase
- NegativeZero = (-1.0 / (1.0 / 0.0))
-
- def setup
- # Nothing to do.
- end
-
- def teardown
- # Nothing to do.
- end
-
- def assert_parsed_result(klass, str)
- o = klass.new(str)
- assert_equal(str, o.to_s)
- end
-
- def test_SOAPNil
- o = SOAP::SOAPNil.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::NilLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- o = SOAP::SOAPNil.new(nil)
- assert_equal(true, o.is_nil)
- assert_equal(nil, o.data)
- assert_equal("", o.to_s)
- o = SOAP::SOAPNil.new('var')
- assert_equal(false, o.is_nil)
- assert_equal('var', o.data)
- assert_equal('var', o.to_s)
- end
-
- def test_SOAPString
- o = SOAP::SOAPString.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::StringLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- str = "abc"
- assert_equal(str, SOAP::SOAPString.new(str).data)
- assert_equal(str, SOAP::SOAPString.new(str).to_s)
- assert_raises(XSD::ValueSpaceError) do
- SOAP::SOAPString.new("\0")
- end
- assert_raises(XSD::ValueSpaceError) do
- p SOAP::SOAPString.new("\xC0\xC0").to_s
- end
- end
-
- def test_SOAPBoolean
- o = SOAP::SOAPBoolean.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::BooleanLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- ["true", true],
- ["1", true],
- ["false", false],
- ["0", false],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPBoolean.new(data).data)
- assert_equal(expected.to_s, SOAP::SOAPBoolean.new(data).to_s)
- end
-
- assert_raises(XSD::ValueSpaceError) do
- SOAP::SOAPBoolean.new("nil").to_s
- end
- end
-
- def test_SOAPDecimal
- o = SOAP::SOAPDecimal.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::DecimalLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 1000000000,
- -9999999999,
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
- -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
- ]
- targets.each do |dec|
- assert_equal(dec.to_s, SOAP::SOAPDecimal.new(dec).data)
- end
-
- targets = [
- "0",
- "0.00000001",
- "1000000000",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123.45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
- ]
- targets.each do |str|
- assert_equal(str, SOAP::SOAPDecimal.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["0.0", "0"],
- ["-0.0", "0"],
- ["+0.0", "0"],
- ["0.", "0"],
- [".0", "0"],
- [
- "+0.12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "0.1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- ],
- [
- ".0000012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "0.000001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- ],
- [
- "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.",
- "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
- ],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPDecimal.new(data).to_s)
- end
-
- targets = [
- "0.000000000000a",
- "00a.0000000000001",
- "+-5",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- SOAP::SOAPDecimal.new(d)
- end
- end
- end
-
- def test_SOAPFloat
- o = SOAP::SOAPFloat.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::FloatLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 3.14159265358979,
- 12.34e36,
- 1.402e-45,
- -1.402e-45,
- ]
- targets.each do |f|
- assert_equal(f, SOAP::SOAPFloat.new(f).data)
- end
-
- targets = [
- "+3.141592654",
- "+1.234e+37",
- "+1.402e-45",
- "-1.402e-45",
- ]
- targets.each do |f|
- assert_equal(f, SOAP::SOAPFloat.new(f).to_s)
- end
-
- targets = [
- [3, "+3"], # should be 3.0?
- [-2, "-2"], # ditto
- [3.14159265358979, "+3.141592654"],
- [12.34e36, "+1.234e+37"],
- [1.402e-45, "+1.402e-45"],
- [-1.402e-45, "-1.402e-45"],
- ["1.402e", "+1.402"],
- ["12.34E36", "+1.234e+37"],
- ["1.402E-45", "+1.402e-45"],
- ["-1.402E-45", "-1.402e-45"],
- ["1.402E", "+1.402"],
- ]
- targets.each do |f, str|
- assert_equal(str, SOAP::SOAPFloat.new(f).to_s)
- end
-
- assert_equal("+0", SOAP::SOAPFloat.new(+0.0).to_s)
- assert_equal("-0", SOAP::SOAPFloat.new(NegativeZero).to_s)
- assert(SOAP::SOAPFloat.new(0.0/0.0).data.nan?)
- assert_equal("INF", SOAP::SOAPFloat.new(1.0/0.0).to_s)
- assert_equal(1, SOAP::SOAPFloat.new(1.0/0.0).data.infinite?)
- assert_equal("-INF", SOAP::SOAPFloat.new(-1.0/0.0).to_s)
- assert_equal(-1, SOAP::SOAPFloat.new(-1.0/0.0).data.infinite?)
-
- targets = [
- "0.000000000000a",
- "00a.0000000000001",
- "+-5",
- "5_0",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- SOAP::SOAPFloat.new(d)
- end
- end
- end
-
- def test_SOAPDouble
- o = SOAP::SOAPDouble.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::DoubleLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 3.14159265358979,
- 12.34e36,
- 1.402e-45,
- -1.402e-45,
- ]
- targets.each do |f|
- assert_equal(f, SOAP::SOAPDouble.new(f).data)
- end
-
- targets = [
- "+3.14159265358979",
- "+1.234e+37",
- "+1.402e-45",
- "-1.402e-45",
- ]
- targets.each do |f|
- assert_equal(f, SOAP::SOAPDouble.new(f).to_s)
- end
-
- targets = [
- [3, "+3"], # should be 3.0?
- [-2, "-2"], # ditto.
- [3.14159265358979, "+3.14159265358979"],
- [12.34e36, "+1.234e+37"],
- [1.402e-45, "+1.402e-45"],
- [-1.402e-45, "-1.402e-45"],
- ["1.402e", "+1.402"],
- ["12.34E36", "+1.234e+37"],
- ["1.402E-45", "+1.402e-45"],
- ["-1.402E-45", "-1.402e-45"],
- ["1.402E", "+1.402"],
- ]
- targets.each do |f, str|
- assert_equal(str, SOAP::SOAPDouble.new(f).to_s)
- end
-
- assert_equal("+0", SOAP::SOAPFloat.new(+0.0).to_s)
- assert_equal("-0", SOAP::SOAPFloat.new(NegativeZero).to_s)
- assert_equal("NaN", SOAP::SOAPDouble.new(0.0/0.0).to_s)
- assert(SOAP::SOAPDouble.new(0.0/0.0).data.nan?)
- assert_equal("INF", SOAP::SOAPDouble.new(1.0/0.0).to_s)
- assert_equal(1, SOAP::SOAPDouble.new(1.0/0.0).data.infinite?)
- assert_equal("-INF", SOAP::SOAPDouble.new(-1.0/0.0).to_s)
- assert_equal(-1, SOAP::SOAPDouble.new(-1.0/0.0).data.infinite?)
-
- targets = [
- "0.000000000000a",
- "00a.0000000000001",
- "+-5",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- SOAP::SOAPDouble.new(d)
- end
- end
- end
-
- def test_SOAPDuration
- o = SOAP::SOAPDuration.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::DurationLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "P1Y2M3DT4H5M6S",
- "P1234Y5678M9012DT3456H7890M1234.5678S",
- "P0DT3456H7890M1234.5678S",
- "P1234Y5678M9012D",
- "-P1234Y5678M9012DT3456H7890M1234.5678S",
- "P5678M9012DT3456H7890M1234.5678S",
- "-P1234Y9012DT3456H7890M1234.5678S",
- "+P1234Y5678MT3456H7890M1234.5678S",
- "P1234Y5678M9012DT7890M1234.5678S",
- "-P1234Y5678M9012DT3456H1234.5678S",
- "+P1234Y5678M9012DT3456H7890M",
- "P123400000000000Y",
- "-P567800000000000M",
- "+P901200000000000D",
- "P0DT345600000000000H",
- "-P0DT789000000000000M",
- "+P0DT123400000000000.000000000005678S",
- "P1234YT1234.5678S",
- "-P5678MT7890M",
- "+P9012DT3456H",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPDuration, str)
- end
-
- targets = [
- ["P0Y0M0DT0H0M0S",
- "P0D"],
- ["-P0DT0S",
- "-P0D"],
- ["P01234Y5678M9012DT3456H7890M1234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ["P1234Y005678M9012DT3456H7890M1234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ["P1234Y5678M0009012DT3456H7890M1234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ["P1234Y5678M9012DT00003456H7890M1234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ["P1234Y5678M9012DT3456H000007890M1234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ["P1234Y5678M9012DT3456H7890M0000001234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPDuration.new(data).to_s)
- end
- end
-
- def test_SOAPDateTime
- o = SOAP::SOAPDateTime.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::DateTimeLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "2002-05-18T16:52:20Z",
- "0001-01-01T00:00:00Z",
- "9999-12-31T23:59:59Z",
- "19999-12-31T23:59:59Z",
- "2002-12-31T23:59:59.999Z",
- "2002-12-31T23:59:59.001Z",
- "2002-12-31T23:59:59.99999999999999999999Z",
- "2002-12-31T23:59:59.00000000000000000001Z",
- "2002-12-31T23:59:59+09:00",
- "2002-12-31T23:59:59+00:01",
- "2002-12-31T23:59:59-00:01",
- "2002-12-31T23:59:59-23:59",
- "2002-12-31T23:59:59.00000000000000000001+13:30",
- "2002-12-31T23:59:59.51375Z",
- "2002-12-31T23:59:59.51345+12:34",
- "-2002-05-18T16:52:20Z",
- "-4711-12-31T23:59:59Z",
- "-4713-01-01T12:00:00Z",
- "-19999-12-31T23:59:59Z",
- "-2002-12-31T23:59:59+00:01",
- "-0001-12-31T23:59:59.00000000000000000001+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPDateTime, str)
- end
-
- targets = [
- ["2002-12-31T23:59:59.00",
- "2002-12-31T23:59:59Z"],
- ["2002-12-31T23:59:59+00:00",
- "2002-12-31T23:59:59Z"],
- ["2002-12-31T23:59:59-00:00",
- "2002-12-31T23:59:59Z"],
- ["-2002-12-31T23:59:59.00",
- "-2002-12-31T23:59:59Z"],
- ["-2002-12-31T23:59:59+00:00",
- "-2002-12-31T23:59:59Z"],
- ["-2002-12-31T23:59:59-00:00",
- "-2002-12-31T23:59:59Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPDateTime.new(data).to_s)
- d = DateTime.parse(data)
- d >>= 12 if d.year < 0 # XSDDateTime.year(-1) == DateTime.year(0)
- assert_equal(expected, SOAP::SOAPDateTime.new(d).to_s)
- end
-
- targets = [
- "1-05-18T16:52:20Z",
- "05-18T16:52:20Z",
- "2002-05T16:52:20Z",
- "2002-05-18T16:52Z",
- "",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError, d.to_s) do
- SOAP::SOAPDateTime.new(d)
- end
- end
- end
-
- def test_SOAPTime
- o = SOAP::SOAPTime.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::TimeLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "16:52:20Z",
- "00:00:00Z",
- "23:59:59Z",
- "23:59:59.999Z",
- "23:59:59.001Z",
- "23:59:59.99999999999999999999Z",
- "23:59:59.00000000000000000001Z",
- "23:59:59+09:00",
- "23:59:59+00:01",
- "23:59:59-00:01",
- "23:59:59-23:59",
- "23:59:59.00000000000000000001+13:30",
- "23:59:59.51375Z",
- "23:59:59.51375+12:34",
- "23:59:59+00:01",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPTime, str)
- end
-
- targets = [
- ["23:59:59.00",
- "23:59:59Z"],
- ["23:59:59+00:00",
- "23:59:59Z"],
- ["23:59:59-00:00",
- "23:59:59Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPTime.new(data).to_s)
- end
- end
-
- def test_SOAPDate
- o = SOAP::SOAPDate.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::DateLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "2002-05-18Z",
- "0001-01-01Z",
- "9999-12-31Z",
- "19999-12-31Z",
- "2002-12-31+09:00",
- "2002-12-31+00:01",
- "2002-12-31-00:01",
- "2002-12-31-23:59",
- "2002-12-31+13:30",
- "-2002-05-18Z",
- "-19999-12-31Z",
- "-2002-12-31+00:01",
- "-0001-12-31+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPDate, str)
- end
-
- targets = [
- ["2002-12-31",
- "2002-12-31Z"],
- ["2002-12-31+00:00",
- "2002-12-31Z"],
- ["2002-12-31-00:00",
- "2002-12-31Z"],
- ["-2002-12-31",
- "-2002-12-31Z"],
- ["-2002-12-31+00:00",
- "-2002-12-31Z"],
- ["-2002-12-31-00:00",
- "-2002-12-31Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPDate.new(data).to_s)
- d = Date.parse(data)
- d >>= 12 if d.year < 0 # XSDDate.year(-1) == Date.year(0)
- assert_equal(expected, SOAP::SOAPDate.new(d).to_s)
- end
- end
-
- def test_SOAPGYearMonth
- o = SOAP::SOAPGYearMonth.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::GYearMonthLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "2002-05Z",
- "0001-01Z",
- "9999-12Z",
- "19999-12Z",
- "2002-12+09:00",
- "2002-12+00:01",
- "2002-12-00:01",
- "2002-12-23:59",
- "2002-12+13:30",
- "-2002-05Z",
- "-19999-12Z",
- "-2002-12+00:01",
- "-0001-12+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPGYearMonth, str)
- end
-
- targets = [
- ["2002-12",
- "2002-12Z"],
- ["2002-12+00:00",
- "2002-12Z"],
- ["2002-12-00:00",
- "2002-12Z"],
- ["-2002-12",
- "-2002-12Z"],
- ["-2002-12+00:00",
- "-2002-12Z"],
- ["-2002-12-00:00",
- "-2002-12Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPGYearMonth.new(data).to_s)
- end
- end
-
- def test_SOAPGYear
- o = SOAP::SOAPGYear.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::GYearLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "2002Z",
- "0001Z",
- "9999Z",
- "19999Z",
- "2002+09:00",
- "2002+00:01",
- "2002-00:01",
- "2002-23:59",
- "2002+13:30",
- "-2002Z",
- "-19999Z",
- "-2002+00:01",
- "-0001+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPGYear, str)
- end
-
- targets = [
- ["2002",
- "2002Z"],
- ["2002+00:00",
- "2002Z"],
- ["2002-00:00",
- "2002Z"],
- ["-2002",
- "-2002Z"],
- ["-2002+00:00",
- "-2002Z"],
- ["-2002-00:00",
- "-2002Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPGYear.new(data).to_s)
- end
- end
-
- def test_SOAPGMonthDay
- o = SOAP::SOAPGMonthDay.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::GMonthDayLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "05-18Z",
- "01-01Z",
- "12-31Z",
- "12-31+09:00",
- "12-31+00:01",
- "12-31-00:01",
- "12-31-23:59",
- "12-31+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPGMonthDay, str)
- end
-
- targets = [
- ["12-31",
- "12-31Z"],
- ["12-31+00:00",
- "12-31Z"],
- ["12-31-00:00",
- "12-31Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPGMonthDay.new(data).to_s)
- end
- end
-
- def test_SOAPGDay
- o = SOAP::SOAPGDay.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::GDayLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "18Z",
- "01Z",
- "31Z",
- "31+09:00",
- "31+00:01",
- "31-00:01",
- "31-23:59",
- "31+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPGDay, str)
- end
-
- targets = [
- ["31",
- "31Z"],
- ["31+00:00",
- "31Z"],
- ["31-00:00",
- "31Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPGDay.new(data).to_s)
- end
- end
-
- def test_SOAPGMonth
- o = SOAP::SOAPGMonth.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::GMonthLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "05Z",
- "01Z",
- "12Z",
- "12+09:00",
- "12+00:01",
- "12-00:01",
- "12-23:59",
- "12+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPGMonth, str)
- end
-
- targets = [
- ["12",
- "12Z"],
- ["12+00:00",
- "12Z"],
- ["12-00:00",
- "12Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPGMonth.new(data).to_s)
- end
- end
-
- def test_SOAPHexBinary
- o = SOAP::SOAPHexBinary.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::HexBinaryLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "abcdef",
- "\xe3\x81\xaa\xe3\x81\xb2",
- "\0",
- "",
- ]
- targets.each do |str|
- assert_equal(str, SOAP::SOAPHexBinary.new(str).string)
- assert_equal(str.unpack("H*")[0].tr('a-f', 'A-F'),
- SOAP::SOAPHexBinary.new(str).data)
- o = SOAP::SOAPHexBinary.new
- o.set_encoded(str.unpack("H*")[0].tr('a-f', 'A-F'))
- assert_equal(str, o.string)
- o.set_encoded(str.unpack("H*")[0].tr('A-F', 'a-f'))
- assert_equal(str, o.string)
- end
-
- targets = [
- "0FG7",
- "0fg7",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError, d.to_s) do
- o = SOAP::SOAPHexBinary.new
- o.set_encoded(d)
- p o.string
- end
- end
- end
-
- def test_SOAPBase64Binary
- o = SOAP::SOAPBase64.new
- assert_equal(SOAP::EncodingNamespace, o.type.namespace)
- assert_equal(SOAP::Base64Literal, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "abcdef",
- "\xe3\x81\xaa\xe3\x81\xb2",
- "\0",
- "",
- ]
- targets.each do |str|
- assert_equal(str, SOAP::SOAPBase64.new(str).string)
- assert_equal([str].pack("m").chomp, SOAP::SOAPBase64.new(str).data)
- o = SOAP::SOAPBase64.new
- o.set_encoded([str].pack("m").chomp)
- assert_equal(str, o.string)
- end
-
- targets = [
- "-",
- "*",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError, d.to_s) do
- o = SOAP::SOAPBase64.new
- o.set_encoded(d)
- p o.string
- end
- end
- end
-
- def test_SOAPAnyURI
- o = SOAP::SOAPAnyURI.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::AnyURILiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- # Too few tests here I know. Believe uri module. :)
- targets = [
- "foo",
- "http://foo",
- "http://foo/bar/baz",
- "http://foo/bar#baz",
- "http://foo/bar%20%20?a+b",
- "HTTP://FOO/BAR%20%20?A+B",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPAnyURI, str)
- end
- end
-
- def test_SOAPQName
- o = SOAP::SOAPQName.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::QNameLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- # More strict test is needed but current implementation allows all non-':'
- # chars like ' ', C0 or C1...
- targets = [
- "foo",
- "foo:bar",
- "a:b",
- ]
- targets.each do |str|
- assert_parsed_result(SOAP::SOAPQName, str)
- end
- end
-
-
- ###
- ## Derived types
- #
-
- def test_SOAPInteger
- o = SOAP::SOAPInteger.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::IntegerLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 1000000000,
- -9999999999,
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
- -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
- ]
- targets.each do |int|
- assert_equal(int, SOAP::SOAPInteger.new(int).data)
- end
-
- targets = [
- "0",
- "1000000000",
- "-9999999999",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
- ]
- targets.each do |str|
- assert_equal(str, SOAP::SOAPInteger.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["-000123", "-123"],
- [
- "+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
- ],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPInteger.new(data).to_s)
- end
-
- targets = [
- "0.0",
- "-5.2",
- "0.000000000000a",
- "+-5",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- SOAP::SOAPInteger.new(d)
- end
- end
- end
-
- def test_SOAPLong
- o = SOAP::SOAPLong.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::LongLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 123,
- -123,
- 9223372036854775807,
- -9223372036854775808,
- ]
- targets.each do |lng|
- assert_equal(lng, SOAP::SOAPLong.new(lng).data)
- end
-
- targets = [
- "0",
- "123",
- "-123",
- "9223372036854775807",
- "-9223372036854775808",
- ]
- targets.each do |str|
- assert_equal(str, SOAP::SOAPLong.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["-000123", "-123"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPLong.new(data).to_s)
- end
-
- targets = [
- 9223372036854775808,
- -9223372036854775809,
- "0.0",
- "-5.2",
- "0.000000000000a",
- "+-5",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- SOAP::SOAPLong.new(d)
- end
- end
- end
-
- def test_SOAPInt
- o = SOAP::SOAPInt.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::IntLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 123,
- -123,
- 2147483647,
- -2147483648,
- ]
- targets.each do |lng|
- assert_equal(lng, SOAP::SOAPInt.new(lng).data)
- end
-
- targets = [
- "0",
- "123",
- "-123",
- "2147483647",
- "-2147483648",
- ]
- targets.each do |str|
- assert_equal(str, SOAP::SOAPInt.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["-000123", "-123"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, SOAP::SOAPInt.new(data).to_s)
- end
-
- targets = [
- 2147483648,
- -2147483649,
- "0.0",
- "-5.2",
- "0.000000000000a",
- "+-5",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- SOAP::SOAPInt.new(d)
- end
- end
- end
-end
-
-
-end
diff --git a/test/soap/test_envelopenamespace.rb b/test/soap/test_envelopenamespace.rb
deleted file mode 100644
index 5b7d281341..0000000000
--- a/test/soap/test_envelopenamespace.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'webrick'
-require 'logger'
-
-
-module SOAP
-
-
-class TestEnvelopeNamespace < Test::Unit::TestCase
- Port = 17171
- TemporaryNamespace = 'urn:foo'
-
- def setup
- @logger = Logger.new(STDERR)
- @logger.level = Logger::Severity::ERROR
- @url = "http://localhost:#{Port}/"
- @server = @client = nil
- @server_thread = nil
- setup_server
- setup_client
- end
-
- def teardown
- teardown_client
- teardown_server
- end
-
- def setup_server
- @server = WEBrick::HTTPServer.new(
- :BindAddress => "0.0.0.0",
- :Logger => @logger,
- :Port => Port,
- :AccessLog => [],
- :DocumentRoot => File.dirname(File.expand_path(__FILE__))
- )
- @server.mount(
- '/',
- WEBrick::HTTPServlet::ProcHandler.new(method(:do_server_proc).to_proc)
- )
- @server_thread = start_server_thread(@server)
- end
-
- def setup_client
- @client = SOAP::RPC::Driver.new(@url, '')
- @client.add_method("do_server_proc")
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def do_server_proc(req, res)
- res['content-type'] = 'text/xml'
- res.body = <<__EOX__
-<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:env="#{TemporaryNamespace}">
- <env:Body>
- <n1:do_server_proc xmlns:n1="urn:foo" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <return>hello world</return>
- </n1:do_server_proc>
- </env:Body>
-</env:Envelope>
-__EOX__
- end
-
- def test_normal
- assert_raise(SOAP::ResponseFormatError) do
- @client.do_server_proc
- end
- @client.options["soap.envelope.requestnamespace"] = TemporaryNamespace
- @client.options["soap.envelope.responsenamespace"] = TemporaryNamespace
- assert_equal('hello world', @client.do_server_proc)
- end
-end
-
-
-end
diff --git a/test/soap/test_httpconfigloader.rb b/test/soap/test_httpconfigloader.rb
deleted file mode 100644
index b06243f661..0000000000
--- a/test/soap/test_httpconfigloader.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-require 'test/unit'
-require 'soap/httpconfigloader'
-require 'soap/rpc/driver'
-
-if defined?(HTTPAccess2)
-
-module SOAP
-
-
-class TestHTTPConfigLoader < Test::Unit::TestCase
- DIR = File.dirname(File.expand_path(__FILE__))
-
- def setup
- @client = SOAP::RPC::Driver.new(nil, nil)
- end
-
- def test_property
- testpropertyname = File.join(DIR, 'soapclient.properties')
- File.open(testpropertyname, "w") do |f|
- f <<<<__EOP__
-protocol.http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_PEER
-# depth: 1 causes an error (intentional)
-protocol.http.ssl_config.verify_depth = 1
-protocol.http.ssl_config.ciphers = ALL
-__EOP__
- end
- begin
- @client.loadproperty(testpropertyname)
- assert_equal('ALL', @client.options['protocol.http.ssl_config.ciphers'])
- ensure
- File.unlink(testpropertyname)
- end
- end
-end
-
-
-end
-
-end
diff --git a/test/soap/test_mapping.rb b/test/soap/test_mapping.rb
deleted file mode 100644
index 26222e6719..0000000000
--- a/test/soap/test_mapping.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-require 'test/unit'
-require 'soap/mapping'
-
-
-module SOAP
-
-
-class TestMapping < Test::Unit::TestCase
- def test_date
- targets = [
- ["2002-12-31",
- "2002-12-31Z"],
- ["2002-12-31+00:00",
- "2002-12-31Z"],
- ["2002-12-31-00:00",
- "2002-12-31Z"],
- ["-2002-12-31",
- "-2002-12-31Z"],
- ["-2002-12-31+00:00",
- "-2002-12-31Z"],
- ["-2002-12-31-00:00",
- "-2002-12-31Z"],
- ]
- targets.each do |str, expectec|
- d = Date.parse(str)
- assert_equal(d.class, convert(d).class)
- assert_equal(d, convert(d))
- end
- end
-
- def test_datetime
- targets = [
- ["2002-12-31T23:59:59.00",
- "2002-12-31T23:59:59Z"],
- ["2002-12-31T23:59:59+00:00",
- "2002-12-31T23:59:59Z"],
- ["2002-12-31T23:59:59-00:00",
- "2002-12-31T23:59:59Z"],
- ["-2002-12-31T23:59:59.00",
- "-2002-12-31T23:59:59Z"],
- ["-2002-12-31T23:59:59+00:00",
- "-2002-12-31T23:59:59Z"],
- ["-2002-12-31T23:59:59-00:00",
- "-2002-12-31T23:59:59Z"],
- ]
- targets.each do |str, expectec|
- d = DateTime.parse(str)
- assert_equal(d.class, convert(d).class)
- assert_equal(d, convert(d))
- end
- end
-
- def convert(obj)
- SOAP::Mapping.soap2obj(SOAP::Mapping.obj2soap(obj))
- end
-end
-
-
-end
diff --git a/test/soap/test_no_indent.rb b/test/soap/test_no_indent.rb
deleted file mode 100644
index f49fb7389f..0000000000
--- a/test/soap/test_no_indent.rb
+++ /dev/null
@@ -1,86 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/standaloneServer'
-require 'soap/rpc/driver'
-
-if defined?(HTTPAccess2)
-
-module SOAP
-
-
-class TestNoIndent < Test::Unit::TestCase
- Port = 17171
-
- class NopServer < SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super
- add_rpc_method(self, 'nop')
- end
-
- def nop
- SOAP::RPC::SOAPVoid.new
- end
- end
-
- def setup
- @server = NopServer.new(self.class.name, nil, '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- @server.start
- }
- @endpoint = "http://localhost:#{Port}/"
- @client = SOAP::RPC::Driver.new(@endpoint)
- @client.add_rpc_method('nop')
- end
-
- def teardown
- @server.shutdown
- @t.kill
- @t.join
- @client.reset_stream
- end
-
- INDENT_XML =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <nop env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- </nop>
- </env:Body>
-</env:Envelope>]
-
- NO_INDENT_XML =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-<env:Body>
-<nop env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-</nop>
-</env:Body>
-</env:Envelope>]
-
- def test_indent
- @client.wiredump_dev = str = ''
- @client.options["soap.envelope.no_indent"] = false
- @client.nop
- assert_equal(INDENT_XML, parse_requestxml(str))
- end
-
- def test_no_indent
- @client.wiredump_dev = str = ''
- @client.options["soap.envelope.no_indent"] = true
- @client.nop
- assert_equal(NO_INDENT_XML, parse_requestxml(str))
- end
-
- def parse_requestxml(str)
- str.split(/\r?\n\r?\n/)[3]
- end
-end
-
-
-end
-
-end
diff --git a/test/soap/test_property.rb b/test/soap/test_property.rb
deleted file mode 100644
index 7acd2c8437..0000000000
--- a/test/soap/test_property.rb
+++ /dev/null
@@ -1,424 +0,0 @@
-require 'test/unit'
-require 'soap/property'
-
-
-module SOAP
-
-
-class TestProperty < Test::Unit::TestCase
- FrozenError = (RUBY_VERSION >= "1.9.0") ? RuntimeError : TypeError
-
- def setup
- @prop = ::SOAP::Property.new
- end
-
- def teardown
- # Nothing to do.
- end
-
- def test_s_load
- propstr = <<__EOP__
-
-# comment1
-
-# comment2\r
-# comment2
-
-\r
-a.b.0 = 1
-a.b.1 = 2
-a.b.2 = 3
-client.protocol.http.proxy=http://myproxy:8080 \r
-client.protocol.http.no_proxy: intranet.example.com,local.example.com\r
-client.protocol.http.protocol_version = 1.0
-foo\\:bar\\=baz = qux
-foo\\\\.bar.baz=\tq\\\\ux\ttab
- a\\ b = 1
-[ppp.qqq.rrr]
-sss = 3
-ttt.uuu = 4
-
-[ sss.ttt.uuu ]
-vvv.www = 5
-[ ]
-xxx.yyy.zzz = 6
-__EOP__
- prop = Property.load(propstr)
- assert_equal(["1", "2", "3"], prop["a.b"].values.sort)
- assert_equal("intranet.example.com,local.example.com",
- prop["client.protocol.http.no_proxy"])
- assert_equal("http://myproxy:8080", prop["client.protocol.http.proxy"])
- assert_equal("1.0", prop["client.protocol.http.protocol_version"])
- assert_equal("q\\ux\ttab", prop['foo\.bar.baz'])
- assert_equal("1", prop['a b'])
- assert_equal("3", prop['ppp.qqq.rrr.sss'])
- assert_equal("4", prop['ppp.qqq.rrr.ttt.uuu'])
- assert_equal("5", prop['sss.ttt.uuu.vvv.www'])
- assert_equal("6", prop['xxx.yyy.zzz'])
- end
-
- def test_load
- prop = Property.new
- hooked = false
- prop.add_hook("foo.bar.baz") do |name, value|
- assert_equal(["foo", "bar", "baz"], name)
- assert_equal("123", value)
- hooked = true
- end
- prop.lock
- prop["foo.bar"].lock
- prop.load("foo.bar.baz = 123")
- assert(hooked)
- assert_raises(FrozenError) do
- prop.load("foo.bar.qux = 123")
- end
- prop.load("foo.baz = 456")
- assert_equal("456", prop["foo.baz"])
- end
-
- def test_initialize
- prop = ::SOAP::Property.new
- # store is empty
- assert_nil(prop["a"])
- # does hook work?
- assert_equal(1, prop["a"] = 1)
- end
-
- def test_aref
- # name_to_a
- assert_nil(@prop[:foo])
- assert_nil(@prop["foo"])
- assert_nil(@prop[[:foo]])
- assert_nil(@prop[["foo"]])
- assert_raises(ArgumentError) do
- @prop[1]
- end
- @prop[:foo] = :foo
- assert_equal(:foo, @prop[:foo])
- assert_equal(:foo, @prop["foo"])
- assert_equal(:foo, @prop[[:foo]])
- assert_equal(:foo, @prop[["foo"]])
- end
-
- def test_referent
- # referent(1)
- assert_nil(@prop["foo.foo"])
- assert_nil(@prop[["foo", "foo"]])
- assert_nil(@prop[["foo", :foo]])
- @prop["foo.foo"] = :foo
- assert_equal(:foo, @prop["foo.foo"])
- assert_equal(:foo, @prop[["foo", "foo"]])
- assert_equal(:foo, @prop[[:foo, "foo"]])
- # referent(2)
- @prop["bar.bar.bar"] = :bar
- assert_equal(:bar, @prop["bar.bar.bar"])
- assert_equal(:bar, @prop[["bar", "bar", "bar"]])
- assert_equal(:bar, @prop[[:bar, "bar", :bar]])
- end
-
- def test_to_key_and_deref
- @prop["foo.foo"] = :foo
- assert_equal(:foo, @prop["fOo.FoO"])
- assert_equal(:foo, @prop[[:fOO, :FOO]])
- assert_equal(:foo, @prop[["FoO", :Foo]])
- # deref_key negative test
- assert_raises(ArgumentError) do
- @prop["baz"] = 1
- @prop["baz.qux"] = 2
- end
- end
-
- def test_hook_name
- tag = Object.new
- tested = false
- @prop.add_hook("foo.bar") do |key, value|
- assert_raise(FrozenError) do
- key << "baz"
- end
- tested = true
- end
- @prop["foo.bar"] = tag
- assert(tested)
- end
-
- def test_value_hook
- tag = Object.new
- tested = false
- @prop.add_hook("FOO.BAR.BAZ") do |key, value|
- assert_equal(["Foo", "baR", "baZ"], key)
- assert_equal(tag, value)
- tested = true
- end
- @prop["Foo.baR.baZ"] = tag
- assert_equal(tag, @prop["foo.bar.baz"])
- assert(tested)
- @prop["foo.bar"] = 1 # unhook the above block
- assert_equal(1, @prop["foo.bar"])
- end
-
- def test_key_hook_no_cascade
- tag = Object.new
- tested = 0
- @prop.add_hook do |key, value|
- assert(false)
- end
- @prop.add_hook(false) do |key, value|
- assert(false)
- end
- @prop.add_hook("foo") do |key, value|
- assert(false)
- end
- @prop.add_hook("foo.bar", false) do |key, value|
- assert(false)
- end
- @prop.add_hook("foo.bar.baz") do |key, value|
- assert(false)
- end
- @prop.add_hook("foo.bar.baz.qux", false) do |key, value|
- assert_equal(["foo", "bar", "baz", "qux"], key)
- assert_equal(tag, value)
- tested += 1
- end
- @prop["foo.bar.baz.qux"] = tag
- assert_equal(tag, @prop["foo.bar.baz.qux"])
- assert_equal(1, tested)
- end
-
- def test_key_hook_cascade
- tag = Object.new
- tested = 0
- @prop.add_hook(true) do |key, value|
- assert_equal(["foo", "bar", "baz", "qux"], key)
- assert_equal(tag, value)
- tested += 1
- end
- @prop.add_hook("foo", true) do |key, value|
- assert_equal(["foo", "bar", "baz", "qux"], key)
- assert_equal(tag, value)
- tested += 1
- end
- @prop.add_hook("foo.bar", true) do |key, value|
- assert_equal(["foo", "bar", "baz", "qux"], key)
- assert_equal(tag, value)
- tested += 1
- end
- @prop.add_hook("foo.bar.baz", true) do |key, value|
- assert_equal(["foo", "bar", "baz", "qux"], key)
- assert_equal(tag, value)
- tested += 1
- end
- @prop.add_hook("foo.bar.baz.qux", true) do |key, value|
- assert_equal(["foo", "bar", "baz", "qux"], key)
- assert_equal(tag, value)
- tested += 1
- end
- @prop["foo.bar.baz.qux"] = tag
- assert_equal(tag, @prop["foo.bar.baz.qux"])
- assert_equal(5, tested)
- end
-
- def test_keys
- assert(@prop.keys.empty?)
- @prop["foo"] = 1
- @prop["bar"]
- @prop["BAz"] = 2
- assert_equal(2, @prop.keys.size)
- assert(@prop.keys.member?("foo"))
- assert(@prop.keys.member?("baz"))
- #
- assert_nil(@prop["a"])
- @prop["a.a"] = 1
- assert_instance_of(::SOAP::Property, @prop["a"])
- @prop["a.b"] = 1
- @prop["a.c"] = 1
- assert_equal(3, @prop["a"].keys.size)
- assert(@prop["a"].keys.member?("a"))
- assert(@prop["a"].keys.member?("b"))
- assert(@prop["a"].keys.member?("c"))
- end
-
- def test_lshift
- assert(@prop.empty?)
- @prop << 1
- assert_equal([1], @prop.values)
- assert_equal(1, @prop["0"])
- @prop << 1
- assert_equal([1, 1], @prop.values)
- assert_equal(1, @prop["1"])
- @prop << 1
- assert_equal([1, 1, 1], @prop.values)
- assert_equal(1, @prop["2"])
- #
- @prop["abc.def"] = o = SOAP::Property.new
- tested = 0
- o.add_hook do |k, v|
- tested += 1
- end
- @prop["abc.def"] << 1
- @prop["abc.def"] << 2
- @prop["abc.def"] << 3
- @prop["abc.def"] << 4
- assert_equal(4, tested)
- end
-
- def test_lock_each
- @prop["a.b.c.d.e"] = 1
- @prop["a.b.d"] = branch = ::SOAP::Property.new
- @prop["a.b.d.e.f"] = 2
- @prop.lock
- assert(@prop.locked?)
- assert_instance_of(::SOAP::Property, @prop["a"])
- assert_raises(FrozenError) do
- @prop["b"]
- end
- #
- @prop["a"].lock
- assert_raises(FrozenError) do
- @prop["a"]
- end
- assert_instance_of(::SOAP::Property, @prop["a.b"])
- #
- @prop["a.b"].lock
- assert_raises(FrozenError) do
- @prop["a.b"]
- end
- assert_raises(FrozenError) do
- @prop["a"]
- end
- #
- @prop["a.b.c.d"].lock
- assert_instance_of(::SOAP::Property, @prop["a.b.c"])
- assert_raises(FrozenError) do
- @prop["a.b.c.d"]
- end
- assert_instance_of(::SOAP::Property, @prop["a.b.d"])
- #
- branch["e"].lock
- assert_instance_of(::SOAP::Property, @prop["a.b.d"])
- assert_raises(FrozenError) do
- @prop["a.b.d.e"]
- end
- assert_raises(FrozenError) do
- branch["e"]
- end
- end
-
- def test_lock_cascade
- @prop["a.a"] = nil
- @prop["a.b.c"] = 1
- @prop["b"] = false
- @prop.lock(true)
- assert(@prop.locked?)
- assert_equal(nil, @prop["a.a"])
- assert_equal(1, @prop["a.b.c"])
- assert_equal(false, @prop["b"])
- assert_raises(FrozenError) do
- @prop["c"]
- end
- assert_raises(FrozenError) do
- @prop["c"] = 2
- end
- assert_raises(FrozenError) do
- @prop["a.b.R"]
- end
- assert_raises(FrozenError) do
- @prop.add_hook do
- assert(false)
- end
- end
- assert_raises(FrozenError) do
- @prop.add_hook("c") do
- assert(false)
- end
- end
- assert_raises(FrozenError) do
- @prop.add_hook("a.c") do
- assert(false)
- end
- end
- assert_nil(@prop["a.a"])
- @prop["a.a"] = 2
- assert_equal(2, @prop["a.a"])
- #
- @prop.unlock(true)
- assert_nil(@prop["c"])
- @prop["c"] = 2
- assert_equal(2, @prop["c"])
- @prop["a.d.a.a"] = :foo
- assert_equal(:foo, @prop["a.d.a.a"])
- tested = false
- @prop.add_hook("a.c") do |name, value|
- assert(true)
- tested = true
- end
- @prop["a.c"] = 3
- assert(tested)
- end
-
- def test_hook_then_lock
- tested = false
- @prop.add_hook("a.b.c") do |name, value|
- assert_equal(["a", "b", "c"], name)
- tested = true
- end
- @prop["a.b"].lock
- assert(!tested)
- @prop["a.b.c"] = 5
- assert(tested)
- assert_equal(5, @prop["a.b.c"])
- assert_raises(FrozenError) do
- @prop["a.b.d"] = 5
- end
- end
-
- def test_lock_unlock_return
- assert_equal(@prop, @prop.lock)
- assert_equal(@prop, @prop.unlock)
- end
-
- def test_lock_split
- @prop["a.b.c"] = 1
- assert_instance_of(::SOAP::Property, @prop["a.b"])
- @prop["a.b.d"] = branch = ::SOAP::Property.new
- @prop["a.b.d.e"] = 2
- assert_equal(branch, @prop["a.b.d"])
- assert_equal(branch, @prop[:a][:b][:d])
- @prop.lock(true)
- # split error 1
- assert_raises(FrozenError) do
- @prop["a.b"]
- end
- # split error 2
- assert_raises(FrozenError) do
- @prop["a"]
- end
- @prop["a.b.c"] = 2
- assert_equal(2, @prop["a.b.c"])
- # replace error
- assert_raises(FrozenError) do
- @prop["a.b.c"] = ::SOAP::Property.new
- end
- # override error
- assert_raises(FrozenError) do
- @prop["a.b"] = 1
- end
- #
- assert_raises(FrozenError) do
- @prop["a.b.d"] << 1
- end
- assert_raises(FrozenError) do
- branch << 1
- end
- branch.unlock(true)
- branch << 1
- branch << 2
- branch << 3
- assert_equal(2, @prop["a.b.d.e"])
- assert_equal(1, @prop["a.b.d.1"])
- assert_equal(2, @prop["a.b.d.2"])
- assert_equal(3, @prop["a.b.d.3"])
- end
-end
-
-
-end
diff --git a/test/soap/test_soapelement.rb b/test/soap/test_soapelement.rb
deleted file mode 100644
index 66e2a836a4..0000000000
--- a/test/soap/test_soapelement.rb
+++ /dev/null
@@ -1,122 +0,0 @@
-require 'test/unit'
-require 'soap/baseData'
-require 'soap/mapping'
-
-
-module SOAP
-
-
-class TestSOAPElement < Test::Unit::TestCase
- include SOAP
-
- def setup
- # Nothing to do.
- end
-
- def teardown
- # Nothing to do.
- end
-
- def d(elename = nil, text = nil)
- elename ||= n(nil, nil)
- if text
- SOAPElement.new(elename, text)
- else
- SOAPElement.new(elename) # do not merge.
- end
- end
-
- def n(namespace, name)
- XSD::QName.new(namespace, name)
- end
-
- def test_initialize
- elename = n(nil, nil)
- obj = d(elename)
- assert_equal(elename, obj.elename)
- assert_equal(LiteralNamespace, obj.encodingstyle)
- assert_equal({}, obj.extraattr)
- assert_equal([], obj.precedents)
- assert_equal(nil, obj.qualified)
- assert_equal(nil, obj.text)
- assert(obj.members.empty?)
-
- obj = d("foo", "text")
- assert_equal(n(nil, "foo"), obj.elename)
- assert_equal("text", obj.text)
- end
-
- def test_add
- obj = d()
- child = d("abc")
- obj.add(child)
- assert(obj.key?("abc"))
- assert_same(child, obj["abc"])
- assert_same(child, obj.abc)
- def obj.foo; 1; end
- child = d("foo")
- obj.add(child)
- assert_equal(1, obj.foo)
- assert_equal(child, obj.var_foo)
- child = d("_?a?b_")
- obj.add(child)
- assert_equal(child, obj.__send__('_?a?b_'))
- end
-
- def test_member
- obj = d()
- c1 = d("c1")
- obj.add(c1)
- c2 = d("c2")
- obj.add(c2)
- assert(obj.key?("c1"))
- assert(obj.key?("c2"))
- assert_equal(c1, obj["c1"])
- assert_equal(c2, obj["c2"])
- c22 = d("c22")
- obj["c2"] = c22
- assert(obj.key?("c2"))
- assert_equal(c22, obj["c2"])
- assert_equal(["c1", "c2"], obj.members.sort)
- #
- k_expect = ["c1", "c2"]
- v_expect = [c1, c22]
- obj.each do |k, v|
- assert(k_expect.include?(k))
- assert(v_expect.include?(v))
- k_expect.delete(k)
- v_expect.delete(v)
- end
- assert(k_expect.empty?)
- assert(v_expect.empty?)
- end
-
- def test_to_obj
- obj = d("root")
- ct1 = d("ct1", "t1")
- obj.add(ct1)
- c2 = d("c2")
- ct2 = d("ct2", "t2")
- c2.add(ct2)
- obj.add(c2)
- assert_equal({ "ct1" => "t1", "c2" => { "ct2" => "t2" }}, obj.to_obj)
- #
- assert_equal(nil, d().to_obj)
- assert_equal("abc", d(nil, "abc").to_obj)
- assert_equal(nil, d("abc", nil).to_obj)
- end
-
- def test_from_obj
- source = { "ct1" => "t1", "c2" => { "ct2" => "t2" }}
- assert_equal(source, SOAPElement.from_obj(source).to_obj)
- source = { "1" => nil }
- assert_equal(source, SOAPElement.from_obj(source).to_obj)
- source = {}
- assert_equal(nil, SOAPElement.from_obj(source).to_obj) # not {}
- source = nil
- assert_equal(nil, SOAPElement.from_obj(source).to_obj)
- end
-end
-
-
-end
diff --git a/test/soap/test_streamhandler.rb b/test/soap/test_streamhandler.rb
deleted file mode 100644
index c31254513f..0000000000
--- a/test/soap/test_streamhandler.rb
+++ /dev/null
@@ -1,209 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/driver'
-require 'webrick'
-require 'webrick/httpproxy'
-require 'logger'
-
-
-module SOAP
-
-
-class TestStreamHandler < Test::Unit::TestCase
- Port = 17171
- ProxyPort = 17172
-
- def setup
- @logger = Logger.new(STDERR)
- @logger.level = Logger::Severity::ERROR
- @url = "http://localhost:#{Port}/"
- @proxyurl = "http://localhost:#{ProxyPort}/"
- @server = @proxyserver = @client = nil
- @server_thread = @proxyserver_thread = nil
- setup_server
- setup_client
- end
-
- def teardown
- teardown_client
- teardown_proxyserver if @proxyserver
- teardown_server
- end
-
- def setup_server
- @server = WEBrick::HTTPServer.new(
- :BindAddress => "0.0.0.0",
- :Logger => @logger,
- :Port => Port,
- :AccessLog => [],
- :DocumentRoot => File.dirname(File.expand_path(__FILE__))
- )
- @server.mount(
- '/',
- WEBrick::HTTPServlet::ProcHandler.new(method(:do_server_proc).to_proc)
- )
- @server_thread = start_server_thread(@server)
- end
-
- def setup_proxyserver
- @proxyserver = WEBrick::HTTPProxyServer.new(
- :BindAddress => "0.0.0.0",
- :Logger => @logger,
- :Port => ProxyPort,
- :AccessLog => []
- )
- @proxyserver_thread = start_server_thread(@proxyserver)
- end
-
- def setup_client
- @client = SOAP::RPC::Driver.new(@url, '')
- @client.add_method("do_server_proc")
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def teardown_proxyserver
- @proxyserver.shutdown
- @proxyserver_thread.kill
- @proxyserver_thread.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def do_server_proc(req, res)
- res['content-type'] = 'text/xml'
- res.body = <<__EOX__
-<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:do_server_proc xmlns:n1="urn:foo" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <return xsi:nil="true"/>
- </n1:do_server_proc>
- </env:Body>
-</env:Envelope>
-__EOX__
- end
-
- def parse_req_header(str)
- if ::SOAP::HTTPStreamHandler::Client.to_s == 'SOAP::NetHttpClient'
- str = eval(str.split(/\r?\n/)[4][3..-1])
- end
- parse_req_header_http_access2(str)
- end
-
- def parse_req_header_http_access2(str)
- headerp = false
- headers = {}
- req = nil
- str.split(/(?:\r?\n)/).each do |line|
- if headerp and /^$/ =~line
- headerp = false
- break
- end
- if headerp
- k, v = line.scan(/^([^:]+):\s*(.*)$/)[0]
- headers[k.downcase] = v
- end
- if /^POST/ =~ line
- req = line
- headerp = true
- end
- end
- return req, headers
- end
-
- def test_normal
- str = ""
- @client.wiredump_dev = str
- assert_nil(@client.do_server_proc)
- r, h = parse_req_header(str)
- assert_match(%r"POST / HTTP/1.", r)
- assert(/^text\/xml;/ =~ h["content-type"])
- end
-
- def test_uri
- # initialize client with URI object
- @client = SOAP::RPC::Driver.new(URI.parse(@url), '')
- @client.add_method("do_server_proc")
- # same as test_normal
- str = ""
- @client.wiredump_dev = str
- assert_nil(@client.do_server_proc)
- r, h = parse_req_header(str)
- assert_match(%r"POST / HTTP/1.", r)
- assert(/^text\/xml;/ =~ h["content-type"])
- end
-
- def test_basic_auth
- unless Object.const_defined?('HTTPAccess2')
- # soap4r + net/http + basic_auth is not supported.
- # use http-access2 instead.
- assert(true)
- return
- end
- str = ""
- @client.wiredump_dev = str
- @client.options["protocol.http.basic_auth"] << [@url, "foo", "bar"]
- assert_nil(@client.do_server_proc)
- r, h = parse_req_header(str)
- assert_equal("Basic Zm9vOmJhcg==", h["authorization"])
- end
-
- def test_proxy
- if Object.const_defined?('HTTPAccess2')
- backup = HTTPAccess2::Client::NO_PROXY_HOSTS.dup
- HTTPAccess2::Client::NO_PROXY_HOSTS.clear
- else
- backup = SOAP::NetHttpClient::NO_PROXY_HOSTS.dup
- SOAP::NetHttpClient::NO_PROXY_HOSTS.clear
- end
- setup_proxyserver
- str = ""
- @client.wiredump_dev = str
- @client.options["protocol.http.proxy"] = @proxyurl
- assert_nil(@client.do_server_proc)
- r, h = parse_req_header(str)
- assert_match(%r"POST http://localhost:17171/ HTTP/1.", r)
- # illegal proxy uri
- assert_raise(ArgumentError) do
- @client.options["protocol.http.proxy"] = 'ftp://foo:8080'
- end
- ensure
- if Object.const_defined?('HTTPAccess2')
- HTTPAccess2::Client::NO_PROXY_HOSTS.replace(backup)
- else
- SOAP::NetHttpClient::NO_PROXY_HOSTS.replace(backup)
- end
- end
-
- def test_charset
- str = ""
- @client.wiredump_dev = str
- @client.options["protocol.http.charset"] = "iso-8859-8"
- assert_nil(@client.do_server_proc)
- r, h = parse_req_header(str)
- assert_equal("text/xml; charset=iso-8859-8", h["content-type"])
- #
- str.replace("")
- @client.options["protocol.http.charset"] = "iso-8859-3"
- assert_nil(@client.do_server_proc)
- r, h = parse_req_header(str)
- assert_equal("text/xml; charset=iso-8859-3", h["content-type"])
- end
-end
-
-
-end
diff --git a/test/soap/test_styleuse.rb b/test/soap/test_styleuse.rb
deleted file mode 100644
index 4ea321848d..0000000000
--- a/test/soap/test_styleuse.rb
+++ /dev/null
@@ -1,333 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/httpserver'
-require 'soap/rpc/driver'
-
-
-module SOAP
-
-
-class TestStyleUse < Test::Unit::TestCase
- # rpc driver: obj in(Hash allowed for literal), obj out
- #
- # style: not visible from user
- # rpc: wrapped element
- # document: unwrappted element
- #
- # use:
- # encoding: a graph (SOAP Data Model)
- # literal: not a graph (SOAPElement)
- #
- # rpc stub: obj in, obj out(Hash is allowed for literal)
- #
- # style: not visible from user
- # rpc: wrapped element
- # document: unwrappted element
- #
- # use:
- # encoding: a graph (SOAP Data Model)
- # literal: not a graph (SOAPElement)
- #
- # document driver: SOAPElement in, SOAPElement out? [not implemented]
- #
- # style: ditto
- # use: ditto
- #
- #
- # document stub: SOAPElement in, SOAPElement out? [not implemented]
- #
- # style: ditto
- # use: ditto
- #
- class GenericServant
- # method name style: requeststyle_requestuse_responsestyle_responseuse
-
- # 2 params -> array
- def rpc_enc_rpc_enc(obj1, obj2)
- [obj1, [obj1, obj2]]
- end
-
- # 2 objs -> array
- def rpc_lit_rpc_enc(obj1, obj2)
- [obj2, obj1]
- end
-
- # 2 params -> 2 params
- def rpc_enc_rpc_lit(obj1, obj2)
- klass = [obj1.class.name, obj2.class.name]
- [obj2, obj1]
- end
-
- # 2 objs -> 2 objs
- def rpc_lit_rpc_lit(obj1, obj2)
- [obj1, obj2]
- end
-
- # 2 params -> array
- def doc_enc_doc_enc(obj1, obj2)
- [obj1, [obj1, obj2]]
- end
-
- # 2 objs -> array
- def doc_lit_doc_enc(obj1, obj2)
- [obj2, obj1]
- end
-
- # 2 params -> 2 hashes
- def doc_enc_doc_lit(obj1, obj2)
- klass = [obj1.class.name, obj2.class.name]
- return {'obj1' => {'klass' => klass}, 'misc' => 'hash does not have an order'},
- {'obj2' => {'klass' => klass}}
- end
-
- # 2 objs -> 2 objs
- def doc_lit_doc_lit(obj1, obj2)
- return obj1, obj2
- end
- end
-
- Namespace = "urn:styleuse"
-
- module Op
- def self.opt(request_style, request_use, response_style, response_use)
- {
- :request_style => request_style,
- :request_use => request_use,
- :response_style => response_style,
- :response_use => response_use
- }
- end
-
- Op_rpc_enc_rpc_enc = [
- XSD::QName.new(Namespace, 'rpc_enc_rpc_enc'),
- nil,
- 'rpc_enc_rpc_enc', [
- ['in', 'obj1', nil],
- ['in', 'obj2', nil],
- ['retval', 'return', nil]],
- opt(:rpc, :encoded, :rpc, :encoded)
- ]
-
- Op_rpc_lit_rpc_enc = [
- XSD::QName.new(Namespace, 'rpc_lit_rpc_enc'),
- nil,
- 'rpc_lit_rpc_enc', [
- ['in', 'obj1', nil],
- ['in', 'obj2', nil],
- ['retval', 'return', nil]],
- opt(:rpc, :literal, :rpc, :encoded)
- ]
-
- Op_rpc_enc_rpc_lit = [
- XSD::QName.new(Namespace, 'rpc_enc_rpc_lit'),
- nil,
- 'rpc_enc_rpc_lit', [
- ['in', 'obj1', nil],
- ['in', 'obj2', nil],
- ['retval', 'ret1', nil],
- ['out', 'ret2', nil]],
- opt(:rpc, :encoded, :rpc, :literal)
- ]
-
- Op_rpc_lit_rpc_lit = [
- XSD::QName.new(Namespace, 'rpc_lit_rpc_lit'),
- nil,
- 'rpc_lit_rpc_lit', [
- ['in', 'obj1', nil],
- ['in', 'obj2', nil],
- ['retval', 'ret1', nil],
- ['out', 'ret2', nil]],
- opt(:rpc, :literal, :rpc, :literal)
- ]
-
- Op_doc_enc_doc_enc = [
- Namespace + 'doc_enc_doc_enc',
- 'doc_enc_doc_enc', [
- ['in', 'obj1', [nil, Namespace, 'obj1']],
- ['in', 'obj2', [nil, Namespace, 'obj2']],
- ['out', 'ret1', [nil, Namespace, 'ret1']],
- ['out', 'ret2', [nil, Namespace, 'ret2']]],
- opt(:document, :encoded, :document, :encoded)
- ]
-
- Op_doc_lit_doc_enc = [
- Namespace + 'doc_lit_doc_enc',
- 'doc_lit_doc_enc', [
- ['in', 'obj1', [nil, Namespace, 'obj1']],
- ['in', 'obj2', [nil, Namespace, 'obj2']],
- ['out', 'ret1', [nil, Namespace, 'ret1']],
- ['out', 'ret2', [nil, Namespace, 'ret2']]],
- opt(:document, :literal, :document, :encoded)
- ]
-
- Op_doc_enc_doc_lit = [
- Namespace + 'doc_enc_doc_lit',
- 'doc_enc_doc_lit', [
- ['in', 'obj1', [nil, Namespace, 'obj1']],
- ['in', 'obj2', [nil, Namespace, 'obj2']],
- ['out', 'ret1', [nil, Namespace, 'ret1']],
- ['out', 'ret2', [nil, Namespace, 'ret2']]],
- opt(:document, :encoded, :document, :literal)
- ]
-
- Op_doc_lit_doc_lit = [
- Namespace + 'doc_lit_doc_lit',
- 'doc_lit_doc_lit', [
- ['in', 'obj1', [nil, Namespace, 'obj1']],
- ['in', 'obj2', [nil, Namespace, 'obj2']],
- ['out', 'ret1', [nil, Namespace, 'ret1']],
- ['out', 'ret2', [nil, Namespace, 'ret2']]],
- opt(:document, :literal, :document, :literal)
- ]
- end
-
- include Op
-
- class Server < ::SOAP::RPC::HTTPServer
- include Op
-
- def on_init
- @servant = GenericServant.new
- add_rpc_operation(@servant, *Op_rpc_enc_rpc_enc)
- add_rpc_operation(@servant, *Op_rpc_lit_rpc_enc)
- add_rpc_operation(@servant, *Op_rpc_enc_rpc_lit)
- add_rpc_operation(@servant, *Op_rpc_lit_rpc_lit)
- add_document_operation(@servant, *Op_doc_enc_doc_enc)
- add_document_operation(@servant, *Op_doc_lit_doc_enc)
- add_document_operation(@servant, *Op_doc_enc_doc_lit)
- add_document_operation(@servant, *Op_doc_lit_doc_lit)
- end
- end
-
- Port = 17171
-
- def setup
- setup_server
- setup_client
- end
-
- def setup_server
- @server = Server.new(
- :BindAddress => "0.0.0.0",
- :Port => Port,
- :AccessLog => [],
- :SOAPDefaultNamespace => Namespace
- )
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_client
- @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/", Namespace)
- @client.wiredump_dev = STDERR if $DEBUG
- @client.add_rpc_operation(*Op_rpc_enc_rpc_enc)
- @client.add_rpc_operation(*Op_rpc_lit_rpc_enc)
- @client.add_rpc_operation(*Op_rpc_enc_rpc_lit)
- @client.add_rpc_operation(*Op_rpc_lit_rpc_lit)
- @client.add_document_operation(*Op_doc_enc_doc_enc)
- @client.add_document_operation(*Op_doc_lit_doc_enc)
- @client.add_document_operation(*Op_doc_enc_doc_lit)
- @client.add_document_operation(*Op_doc_lit_doc_lit)
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def test_rpc_enc_rpc_enc
- o = "hello"
- obj1 = o
- obj2 = [1]
- ret = @client.rpc_enc_rpc_enc(obj1, obj2)
- # server returns [obj1, [obj1, obj2]]
- assert_equal([obj1, [obj1, obj2]], ret)
- assert_same(ret[0], ret[1][0])
- end
-
- S1 = ::Struct.new(:a)
- S2 = ::Struct.new(:c)
- def test_rpc_lit_rpc_enc
- ret1, ret2 = @client.rpc_lit_rpc_enc(S1.new('b'), S2.new('d'))
- assert_equal('d', ret1.c)
- assert_equal('b', ret2.a)
- # Hash is allowed for literal
- ret1, ret2 = @client.rpc_lit_rpc_enc({'a' => 'b'}, {'c' => 'd'})
- assert_equal('d', ret1.c)
- assert_equal('b', ret2.a)
- # simple value
- assert_equal(
- ['1', 'a'],
- @client.rpc_lit_rpc_enc('a', 1)
- )
- end
-
- def test_rpc_enc_rpc_lit
- assert_equal(
- ['1', 'a'],
- @client.rpc_enc_rpc_lit('a', '1')
- )
- end
-
- def test_rpc_lit_rpc_lit
- ret1, ret2 = @client.rpc_lit_rpc_lit({'a' => 'b'}, {'c' => 'd'})
- assert_equal('b', ret1["a"])
- assert_equal('d', ret2["c"])
- end
-
- def test_doc_enc_doc_enc
- o = "hello"
- obj1 = o
- obj2 = [1]
- ret = @client.rpc_enc_rpc_enc(obj1, obj2)
- # server returns [obj1, [obj1, obj2]]
- assert_equal([obj1, [obj1, obj2]], ret)
- assert_same(ret[0], ret[1][0])
- end
-
- def test_doc_lit_doc_enc
- ret1, ret2 = @client.doc_lit_doc_enc({'a' => 'b'}, {'c' => 'd'})
- assert_equal('d', ret1.c)
- assert_equal('b', ret2.a)
- assert_equal(
- ['a', '1'],
- @client.doc_lit_doc_enc(1, 'a')
- )
- end
-
- def test_doc_enc_doc_lit
- ret1, ret2 = @client.doc_enc_doc_lit('a', 1)
- # literal Array
- assert_equal(['String', 'Fixnum'], ret1['obj1']['klass'])
- # same value
- assert_equal(ret1['obj1']['klass'], ret2['obj2']['klass'])
- # not the same object (not encoded)
- assert_not_same(ret1['obj1']['klass'], ret2['obj2']['klass'])
- end
-
- def test_doc_lit_doc_lit
- ret1, ret2 = @client.doc_lit_doc_lit({'a' => 'b'}, {'c' => 'd'})
- assert_equal('b', ret1["a"])
- assert_equal('d', ret2["c"])
- end
-end
-
-
-end
diff --git a/test/soap/wsdlDriver/README.txt b/test/soap/wsdlDriver/README.txt
deleted file mode 100644
index b4d45a0486..0000000000
--- a/test/soap/wsdlDriver/README.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-echo_version.rb is generated by wsdl2ruby.rb;
-% wsdl2ruby.rb --wsdl simpletype.wsdl --classdef --force
diff --git a/test/soap/wsdlDriver/calc.wsdl b/test/soap/wsdlDriver/calc.wsdl
deleted file mode 100644
index 694a01e87e..0000000000
--- a/test/soap/wsdlDriver/calc.wsdl
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--generated by GLUE Standard 4.0.1 on Wed Mar 09 10:20:07 GMT-08:00
-2005-->
-<wsdl:definitions name='Calculator'
-targetNamespace='http://www.themindelectric.com/wsdl/Calculator/'
- xmlns:tns='http://www.themindelectric.com/wsdl/Calculator/'
- xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
- xmlns:http='http://schemas.xmlsoap.org/wsdl/http/'
- xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/'
- xmlns:xsd='http://www.w3.org/2001/XMLSchema'
- xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
- xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
- xmlns:tme='http://www.themindelectric.com/'>
- <wsdl:message name='add0In'>
- <wsdl:part name='x' type='xsd:float'/>
- <wsdl:part name='y' type='xsd:float'/>
- </wsdl:message>
- <wsdl:message name='add0Out'>
- <wsdl:part name='Result' type='xsd:float'/>
- </wsdl:message>
- <wsdl:message name='divide1In'>
- <wsdl:part name='numerator' type='xsd:float'/>
- <wsdl:part name='denominator' type='xsd:float'/>
- </wsdl:message>
- <wsdl:message name='divide1Out'>
- <wsdl:part name='Result' type='xsd:float'/>
- </wsdl:message>
- <wsdl:message name='multiply2In'>
- <wsdl:part name='x' type='xsd:float'/>
- <wsdl:part name='y' type='xsd:float'/>
- </wsdl:message>
- <wsdl:message name='multiply2Out'>
- <wsdl:part name='Result' type='xsd:float'/>
- </wsdl:message>
- <wsdl:message name='subtract3In'>
- <wsdl:part name='x' type='xsd:float'/>
- <wsdl:part name='y' type='xsd:float'/>
- </wsdl:message>
- <wsdl:message name='subtract3Out'>
- <wsdl:part name='Result' type='xsd:float'/>
- </wsdl:message>
- <wsdl:portType name='ICalculator'>
- <wsdl:operation name='add' parameterOrder='x y'>
- <wsdl:input name='add0In' message='tns:add0In'/>
- <wsdl:output name='add0Out' message='tns:add0Out'/>
- </wsdl:operation>
- <wsdl:operation name='divide' parameterOrder='numerator
-denominator'>
- <wsdl:input name='divide1In' message='tns:divide1In'/>
- <wsdl:output name='divide1Out' message='tns:divide1Out'/>
- </wsdl:operation>
- <wsdl:operation name='multiply' parameterOrder='x y'>
- <wsdl:input name='multiply2In' message='tns:multiply2In'/>
- <wsdl:output name='multiply2Out'
-message='tns:multiply2Out'/>
- </wsdl:operation>
- <wsdl:operation name='subtract' parameterOrder='x y'>
- <wsdl:input name='subtract3In' message='tns:subtract3In'/>
- <wsdl:output name='subtract3Out'
-message='tns:subtract3Out'/>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name='ICalculator' type='tns:ICalculator'>
- <soap:binding style='rpc'
-transport='http://schemas.xmlsoap.org/soap/http'/>
- <wsdl:operation name='add'>
- <soap:operation soapAction='add' style='rpc'/>
- <wsdl:input name='add0In'>
- <soap:body use='encoded'
-namespace='http://www.fred.com'
-encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
- </wsdl:input>
- <wsdl:output name='add0Out'>
- <soap:body use='encoded'
-namespace='http://www.fred.com'
-encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name='divide'>
- <soap:operation soapAction='divide' style='rpc'/>
- <wsdl:input name='divide1In'>
- <soap:body use='encoded'
-namespace='http://www.fred.com'
-encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
- </wsdl:input>
- <wsdl:output name='divide1Out'>
- <soap:body use='encoded'
-namespace='http://www.fred.com'
-encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name='multiply'>
- <soap:operation soapAction='multiply' style='rpc'/>
- <wsdl:input name='multiply2In'>
- <soap:body use='encoded'
-namespace='http://www.fred.com'
-encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
- </wsdl:input>
- <wsdl:output name='multiply2Out'>
- <soap:body use='encoded'
-namespace='http://www.fred.com'
-encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name='subtract'>
- <soap:operation soapAction='subtract' style='rpc'/>
- <wsdl:input name='subtract3In'>
- <soap:body use='encoded'
-namespace='http://www.fred.com'
-encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
- </wsdl:input>
- <wsdl:output name='subtract3Out'>
- <soap:body use='encoded'
-namespace='http://www.fred.com'
-encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name='Calculator'>
- <wsdl:documentation>calculator service</wsdl:documentation>
- <wsdl:port name='ICalculator' binding='tns:ICalculator'>
- <soap:address
-location='http://ukulele:8080/calcapp/services/calculator'/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/test/soap/wsdlDriver/document.wsdl b/test/soap/wsdlDriver/document.wsdl
deleted file mode 100644
index 5e9e74b9df..0000000000
--- a/test/soap/wsdlDriver/document.wsdl
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions name="submit_service"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="urn:example.com:document"
- targetNamespace="urn:example.com:document"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema targetNamespace="urn:example.com:document">
- <xsd:element name="ruby">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="myversion" type="tns:myversion"/>
- <xsd:element minOccurs="0" maxOccurs="1" name="date" type="xsd:dateTime"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:simpleType name="myversion">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="1.6"/>
- <xsd:enumeration value="1.8"/>
- <xsd:enumeration value="1.9"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:schema>
- </types>
-
- <message name="submit_msg">
- <part name="parameters" element="tns:ruby"/>
- </message>
-
- <portType name="submit_port_type">
- <operation name="submit">
- <input message="tns:submit_msg"/>
- <output message="tns:submit_msg"/>
- </operation>
- </portType>
-
- <binding name="submit_binding" type="tns:submit_port_type">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
- <operation name="submit">
- <soap:operation soapAction="urn:example.com:document#submit" style="document"/>
- <input><soap:body use="literal"/></input>
- <output><soap:body use="literal"/></output>
- </operation>
- </binding>
-
- <service name="submit_service">
- <port name="submit_port" binding="tns:submit_binding">
- <soap:address location="http://localhost:10080"/>
- </port>
- </service>
-</definitions>
diff --git a/test/soap/wsdlDriver/echo_version.rb b/test/soap/wsdlDriver/echo_version.rb
deleted file mode 100644
index 7d76fb7587..0000000000
--- a/test/soap/wsdlDriver/echo_version.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# urn:example.com:simpletype-rpc-type
-class Version_struct
- @@schema_type = "version_struct"
- @@schema_ns = "urn:example.com:simpletype-rpc-type"
-
- attr_accessor :version
- attr_accessor :msg
-
- def initialize(version = nil, msg = nil)
- @version = version
- @msg = msg
- end
-end
-
-# urn:example.com:simpletype-rpc-type
-module Versions
- C_16 = "1.6"
- C_18 = "1.8"
- C_19 = "1.9"
-end
diff --git a/test/soap/wsdlDriver/simpletype.wsdl b/test/soap/wsdlDriver/simpletype.wsdl
deleted file mode 100644
index 6781dda552..0000000000
--- a/test/soap/wsdlDriver/simpletype.wsdl
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions name="echo_version"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="urn:example.com:simpletype-rpc"
- xmlns:txd="urn:example.com:simpletype-rpc-type"
- targetNamespace="urn:example.com:simpletype-rpc"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema targetNamespace="urn:example.com:simpletype-rpc-type">
- <xsd:complexType name="version_struct">
- <xsd:all>
- <xsd:element name="myversion" type="txd:myversions" />
- <xsd:element name="msg" type="xsd:string" />
- </xsd:all>
- </xsd:complexType>
-
- <xsd:simpleType name="myversions">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="1.6"/>
- <xsd:enumeration value="1.8"/>
- <xsd:enumeration value="1.9"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:schema>
- </types>
-
- <message name="msg_version">
- <part name="myversion" type="txd:myversions"/>
- </message>
-
- <message name="msg_version_struct">
- <part name="return" type="txd:version_struct"/>
- </message>
-
- <portType name="echo_version_port_type">
- <operation name="echo_version">
- <input message="tns:msg_version"/>
- <output message="tns:msg_version_struct"/>
- </operation>
- </portType>
-
- <binding name="echo_version_binding" type="tns:echo_version_port_type">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
- <operation name="echo_version">
- <soap:operation soapAction="urn:example.com:simpletype-rpc"/>
- <input>
- <soap:body use="encoded" namespace="urn:example.com:simpletype-rpc"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="urn:example.com:simpletype-rpc"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- </binding>
-
- <service name="echo_version_service">
- <port name="echo_version_port" binding="tns:echo_version_binding">
- <soap:address location="http://localhost:10080"/>
- </port>
- </service>
-</definitions>
diff --git a/test/soap/wsdlDriver/test_calc.rb b/test/soap/wsdlDriver/test_calc.rb
deleted file mode 100644
index f1cc116a59..0000000000
--- a/test/soap/wsdlDriver/test_calc.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/httpserver'
-require 'soap/wsdlDriver'
-
-
-module SOAP
-
-
-class TestCalc < Test::Unit::TestCase
- class Server < ::SOAP::RPC::HTTPServer
- def on_init
- add_method(self, 'add', 'x', 'y')
- end
-
- def add(x, y)
- x.to_f + y.to_f
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
- Port = 17171
-
- def setup
- setup_server
- setup_client
- end
-
- def setup_server
- @server = Server.new(
- :BindAddress => "0.0.0.0",
- :Port => Port,
- :AccessLog => [],
- :SOAPDefaultNamespace => 'http://www.fred.com'
- )
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_client
- @wsdl = File.join(DIR, 'calc.wsdl')
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def teardown_client
- @client.reset_stream if @client
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def test_rpc_driver
- @client = ::SOAP::WSDLDriverFactory.new(@wsdl).create_rpc_driver
- @client.wiredump_dev = STDOUT if $DEBUG
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.generate_explicit_type = true
- assert_equal(0.3, @client.add(0.1, 0.2))
- @client.generate_explicit_type = false
- assert_equal(0.3, @client.add(0.1, 0.2))
- end
-
- def test_old_driver
- @client = ::SOAP::WSDLDriverFactory.new(@wsdl).create_driver
- @client.wiredump_dev = STDOUT if $DEBUG
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.generate_explicit_type = true
- assert_equal(0.3, @client.add(0.1, 0.2))
- @client.generate_explicit_type = false
- assert_equal(0.3, @client.add(0.1, 0.2))
- end
-end
-
-
-end
diff --git a/test/soap/wsdlDriver/test_document.rb b/test/soap/wsdlDriver/test_document.rb
deleted file mode 100644
index 634b827aae..0000000000
--- a/test/soap/wsdlDriver/test_document.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-
-
-module SOAP
-
-
-class TestDocument < Test::Unit::TestCase
- Namespace = 'urn:example.com:document'
-
- class Server < ::SOAP::RPC::StandaloneServer
- def on_init
- add_document_method(self, 'urn:example.com:document#submit', 'submit', XSD::QName.new(Namespace, 'ruby'), XSD::QName.new(Namespace, 'ruby'))
- end
-
- def submit(ruby)
- ruby
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
-
- Port = 17171
-
- def setup
- setup_server
- setup_client
- end
-
- def setup_server
- @server = Server.new('Test', Namespace, '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_client
- wsdl = File.join(DIR, 'document.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = STDOUT if $DEBUG
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def test_document
- msg = {'myversion' => "1.9", 'date' => "2004-01-01T00:00:00Z"}
- reply_msg = @client.submit(msg)
- assert_equal('1.9', reply_msg.myversion)
- assert_equal('1.9', reply_msg['myversion'])
- assert_equal('2004-01-01T00:00:00Z', reply_msg.date)
- assert_equal('2004-01-01T00:00:00Z', reply_msg['date'])
- end
-end
-
-
-end
diff --git a/test/soap/wsdlDriver/test_simpletype.rb b/test/soap/wsdlDriver/test_simpletype.rb
deleted file mode 100644
index 76b3a32df7..0000000000
--- a/test/soap/wsdlDriver/test_simpletype.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/httpserver'
-require 'soap/wsdlDriver'
-
-
-module SOAP
-
-
-class TestSimpleType < Test::Unit::TestCase
- class Server < ::SOAP::RPC::HTTPServer
- def on_init
- add_method(self, 'echo_version', 'version')
- end
-
- def echo_version(version)
- # "2.0" is out of range.
- Version_struct.new(version || "2.0", 'checked')
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
- require File.join(DIR, 'echo_version')
-
- Port = 17171
-
- def setup
- setup_server
- setup_client
- end
-
- def setup_server
- @server = Server.new(
- :BindAddress => "0.0.0.0",
- :Port => Port,
- :AccessLog => [],
- :SOAPDefaultNamespace => "urn:example.com:simpletype-rpc"
- )
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_client
- wsdl = File.join(DIR, 'simpletype.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.wiredump_dev = STDOUT if $DEBUG
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.generate_explicit_type = false
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def test_ping
- result = @client.echo_version("1.9")
- assert_equal("1.9", result.version)
- assert_equal("checked", result.msg)
- assert_raise(XSD::ValueSpaceError) do
- @client.echo_version("2.0")
- end
- assert_raise(XSD::ValueSpaceError) do
- @client.echo_version(nil) # nil => "2.0" => out of range
- end
- end
-end
-
-
-end
diff --git a/test/wsdl/any/any.wsdl b/test/wsdl/any/any.wsdl
deleted file mode 100644
index 4d1f73a8cd..0000000000
--- a/test/wsdl/any/any.wsdl
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions name="echo"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="urn:example.com:echo"
- xmlns:txd="urn:example.com:echo-type"
- targetNamespace="urn:example.com:echo"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema targetNamespace="urn:example.com:echo-type">
- <xsd:complexType name="foo.bar">
- <xsd:sequence>
- <xsd:any />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:schema>
- </types>
-
- <message name="msg_echoitem">
- <part name="echoitem" type="txd:foo.bar"/>
- </message>
-
- <portType name="echo_port_type">
- <operation name="echo">
- <input message="tns:msg_echoitem"/>
- <output message="tns:msg_echoitem"/>
- </operation>
- </portType>
-
- <binding name="echo_binding" type="tns:echo_port_type">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
- <operation name="echo">
- <soap:operation soapAction="urn:example.com:echo"/>
- <input>
- <soap:body use="encoded" namespace="urn:example.com:echo"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="urn:example.com:echo"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- </binding>
-
- <service name="echo_service">
- <port name="echo_port" binding="tns:echo_binding">
- <soap:address location="http://localhost:10080"/>
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/any/expectedDriver.rb b/test/wsdl/any/expectedDriver.rb
deleted file mode 100644
index 6d1827fb94..0000000000
--- a/test/wsdl/any/expectedDriver.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-require 'echo.rb'
-
-require 'soap/rpc/driver'
-
-class Echo_port_type < ::SOAP::RPC::Driver
- DefaultEndpointUrl = "http://localhost:10080"
- MappingRegistry = ::SOAP::Mapping::Registry.new
-
- MappingRegistry.set(
- FooBar,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("urn:example.com:echo-type", "foo.bar") }
- )
-
- Methods = [
- [ XSD::QName.new("urn:example.com:echo", "echo"),
- "urn:example.com:echo",
- "echo",
- [ ["in", "echoitem", ["FooBar", "urn:example.com:echo-type", "foo.bar"]],
- ["retval", "echoitem", ["FooBar", "urn:example.com:echo-type", "foo.bar"]] ],
- { :request_style => :rpc, :request_use => :encoded,
- :response_style => :rpc, :response_use => :encoded }
- ]
- ]
-
- def initialize(endpoint_url = nil)
- endpoint_url ||= DefaultEndpointUrl
- super(endpoint_url, nil)
- self.mapping_registry = MappingRegistry
- init_methods
- end
-
-private
-
- def init_methods
- Methods.each do |definitions|
- opt = definitions.last
- if opt[:request_style] == :document
- add_document_operation(*definitions)
- else
- add_rpc_operation(*definitions)
- qname = definitions[0]
- name = definitions[2]
- if qname.name != name and qname.name.capitalize == name.capitalize
- ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
- __send__(name, *arg)
- end
- end
- end
- end
- end
-end
-
diff --git a/test/wsdl/any/expectedEcho.rb b/test/wsdl/any/expectedEcho.rb
deleted file mode 100644
index 456950dfef..0000000000
--- a/test/wsdl/any/expectedEcho.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-require 'xsd/qname'
-
-# {urn:example.com:echo-type}foo.bar
-class FooBar
- @@schema_type = "foo.bar"
- @@schema_ns = "urn:example.com:echo-type"
- @@schema_element = [["any", [nil, XSD::QName.new(nil, "any")]]]
-
- attr_accessor :any
-
- def initialize(any = nil)
- @any = any
- end
-end
diff --git a/test/wsdl/any/expectedService.rb b/test/wsdl/any/expectedService.rb
deleted file mode 100644
index e3885e7c6c..0000000000
--- a/test/wsdl/any/expectedService.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env ruby
-require 'echoServant.rb'
-
-require 'soap/rpc/standaloneServer'
-require 'soap/mapping/registry'
-
-class Echo_port_type
- MappingRegistry = ::SOAP::Mapping::Registry.new
-
- MappingRegistry.set(
- FooBar,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("urn:example.com:echo-type", "foo.bar") }
- )
-
- Methods = [
- [ XSD::QName.new("urn:example.com:echo", "echo"),
- "urn:example.com:echo",
- "echo",
- [ ["in", "echoitem", ["FooBar", "urn:example.com:echo-type", "foo.bar"]],
- ["retval", "echoitem", ["FooBar", "urn:example.com:echo-type", "foo.bar"]] ],
- { :request_style => :rpc, :request_use => :encoded,
- :response_style => :rpc, :response_use => :encoded }
- ]
- ]
-end
-
-class Echo_port_typeApp < ::SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super(*arg)
- servant = Echo_port_type.new
- Echo_port_type::Methods.each do |definitions|
- opt = definitions.last
- if opt[:request_style] == :document
- @router.add_document_operation(servant, *definitions)
- else
- @router.add_rpc_operation(servant, *definitions)
- end
- end
- self.mapping_registry = Echo_port_type::MappingRegistry
- end
-end
-
-if $0 == __FILE__
- # Change listen port.
- server = Echo_port_typeApp.new('app', nil, '0.0.0.0', 10080)
- trap(:INT) do
- server.shutdown
- end
- server.start
-end
diff --git a/test/wsdl/any/test_any.rb b/test/wsdl/any/test_any.rb
deleted file mode 100644
index 7b0e480be9..0000000000
--- a/test/wsdl/any/test_any.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-require 'test/unit'
-require 'wsdl/parser'
-require 'wsdl/soap/wsdl2ruby'
-module WSDL; module Any
-
-
-class TestAny < Test::Unit::TestCase
- DIR = File.dirname(File.expand_path(__FILE__))
- def pathname(filename)
- File.join(DIR, filename)
- end
-
- def test_any
- gen = WSDL::SOAP::WSDL2Ruby.new
- gen.location = pathname("any.wsdl")
- gen.basedir = DIR
- gen.logger.level = Logger::FATAL
- gen.opt['classdef'] = nil
- gen.opt['driver'] = nil
- gen.opt['client_skelton'] = nil
- gen.opt['servant_skelton'] = nil
- gen.opt['standalone_server_stub'] = nil
- gen.opt['force'] = true
- gen.run
- compare("expectedDriver.rb", "echoDriver.rb")
- compare("expectedEcho.rb", "echo.rb")
- compare("expectedService.rb", "echo_service.rb")
-
- File.unlink(pathname("echo_service.rb"))
- File.unlink(pathname("echo.rb"))
- File.unlink(pathname("echo_serviceClient.rb"))
- File.unlink(pathname("echoDriver.rb"))
- File.unlink(pathname("echoServant.rb"))
- end
-
- def compare(expected, actual)
- assert_equal(loadfile(expected), loadfile(actual), actual)
- end
-
- def loadfile(file)
- File.open(pathname(file)) { |f| f.read }
- end
-end
-
-
-end; end
diff --git a/test/wsdl/axisArray/axisArray.wsdl b/test/wsdl/axisArray/axisArray.wsdl
deleted file mode 100644
index 3602edb748..0000000000
--- a/test/wsdl/axisArray/axisArray.wsdl
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions name = "itemList"
- targetNamespace="urn:jp.gr.jin.rrr.example.itemList"
- xmlns:tns="urn:jp.gr.jin.rrr.example.itemList"
- xmlns:typens="urn:jp.gr.jin.rrr.example.itemListType"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <schema targetNamespace="urn:jp.gr.jin.rrr.example.itemListType"
- xmlns="http://www.w3.org/2001/XMLSchema">
- <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
- <complexType name="Item">
- <sequence>
- <element name="name" type="xsd:string"/>
- </sequence>
- </complexType>
- <complexType name="ItemList">
- <sequence>
- <element maxOccurs="unbounded" minOccurs="0" name="Item" type="typens:Item"/>
- </sequence>
- </complexType>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="listItemRequest"/>
-
- <wsdl:message name="listItemResponse">
- <wsdl:part name="list" type="typens:ItemList"/>
- </wsdl:message>
-
- <wsdl:portType name="ItemListPortType">
- <wsdl:operation name="listItem">
- <wsdl:input message="tns:listItemRequest" name="listItemRequest"/>
- <wsdl:output message="tns:listItemResponse" name="listItemResponse"/>
- </wsdl:operation>
- </wsdl:portType>
-
- <wsdl:binding name="ItemListBinding" type="tns:ItemListPortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="listItem">
- <soap:operation soapAction=""/>
- <wsdl:input name="listItemRequest">
- <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:jp.gr.jin.rrr.example.itemList" use="encoded"/>
- </wsdl:input>
- <wsdl:output name="listItemResponse">
- <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:jp.gr.jin.rrr.example.itemList" use="encoded"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="ItemListService">
- <wsdl:port binding="tns:ItemListBinding" name="ItemListPort">
- <soap:address location="http://localhost:10080/"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/test/wsdl/axisArray/itemList.rb b/test/wsdl/axisArray/itemList.rb
deleted file mode 100644
index b81297ed37..0000000000
--- a/test/wsdl/axisArray/itemList.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# Generated by wsdl2ruby.rb with axisArray.wsdl.
-
-# urn:jp.gr.jin.rrr.example.itemListType
-class Item
- @@schema_type = "Item"
- @@schema_ns = "urn:jp.gr.jin.rrr.example.itemListType"
-
- def name
- @name
- end
-
- def name=(value)
- @name = value
- end
-
- def initialize(name = nil)
- @name = name
- end
-end
-
-# urn:jp.gr.jin.rrr.example.itemListType
-class ItemList < Array
- # Contents type should be dumped here...
- @@schema_type = "ItemList"
- @@schema_ns = "urn:jp.gr.jin.rrr.example.itemListType"
-end
-
diff --git a/test/wsdl/axisArray/test_axisarray.rb b/test/wsdl/axisArray/test_axisarray.rb
deleted file mode 100644
index 9f220bb48a..0000000000
--- a/test/wsdl/axisArray/test_axisarray.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require 'test/unit'
-require 'soap/processor'
-require 'soap/mapping'
-require 'soap/rpc/element'
-require 'wsdl/importer'
-require 'itemList.rb'
-
-
-module WSDL
-
-
-class TestAxisArray < Test::Unit::TestCase
- def setup
- @xml =<<__EOX__
-<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <ns1:listItemResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:jp.gr.jin.rrr.example.itemList">
- <list href="#id0"/>
- </ns1:listItemResponse>
- <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:ItemList" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:jp.gr.jin.rrr.example.itemListType">
- <Item href="#id1"/>
- <Item href="#id2"/>
- <Item href="#id3"/>
- </multiRef>
- <multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:Item" xmlns:ns3="urn:jp.gr.jin.rrr.example.itemListType" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
- <name xsi:type="xsd:string">name3</name>
- </multiRef>
- <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:Item" xmlns:ns4="urn:jp.gr.jin.rrr.example.itemListType" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
- <name xsi:type="xsd:string">name1</name>
- </multiRef>
- <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:Item" xmlns:ns5="urn:jp.gr.jin.rrr.example.itemListType" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
- <name xsi:type="xsd:string">name2</name>
- </multiRef>
- </soapenv:Body>
-</soapenv:Envelope>
-__EOX__
- end
-
- def test_by_stub
- header, body = ::SOAP::Processor.unmarshal(@xml)
- ary = ::SOAP::Mapping.soap2obj(body.response)
- assert_equal(3, ary.size)
- assert_equal("name1", ary[0].name)
- assert_equal("name2", ary[1].name)
- assert_equal("name3", ary[2].name)
- end
-
- def test_by_wsdl
- wsdlfile = File.join(File.dirname(File.expand_path(__FILE__)), 'axisArray.wsdl')
- wsdl = WSDL::Importer.import(wsdlfile)
- service = wsdl.services[0]
- port = service.ports[0]
- wsdl_types = wsdl.collect_complextypes
- rpc_decode_typemap = wsdl_types + wsdl.soap_rpc_complextypes(port.find_binding)
- opt = {}
- opt[:default_encodingstyle] = ::SOAP::EncodingNamespace
- opt[:decode_typemap] = rpc_decode_typemap
- header, body = ::SOAP::Processor.unmarshal(@xml, opt)
- ary = ::SOAP::Mapping.soap2obj(body.response)
- assert_equal(3, ary.size)
- assert_equal("name1", ary[0].name)
- assert_equal("name2", ary[1].name)
- assert_equal("name3", ary[2].name)
- end
-end
-
-
-end
diff --git a/test/wsdl/datetime/DatetimeService.rb b/test/wsdl/datetime/DatetimeService.rb
deleted file mode 100644
index 800e06d66f..0000000000
--- a/test/wsdl/datetime/DatetimeService.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env ruby
-require 'datetimeServant.rb'
-
-require 'soap/rpc/standaloneServer'
-require 'soap/mapping/registry'
-
-class DatetimePortType
- MappingRegistry = ::SOAP::Mapping::Registry.new
-
- Methods = [
- ["now", "now",
- [
- ["in", "now", [::SOAP::SOAPDateTime]],
- ["retval", "now", [::SOAP::SOAPDateTime]]
- ],
- "", "urn:jp.gr.jin.rrr.example.datetime", :rpc
- ]
- ]
-end
-
-class DatetimePortTypeApp < ::SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super(*arg)
- servant = DatetimePortType.new
- DatetimePortType::Methods.each do |name_as, name, param_def, soapaction, namespace, style|
- if style == :document
- @router.add_document_operation(servant, soapaction, name, param_def)
- else
- qname = XSD::QName.new(namespace, name_as)
- @router.add_rpc_operation(servant, qname, soapaction, name, param_def)
- end
- end
- self.mapping_registry = DatetimePortType::MappingRegistry
- end
-end
-
-if $0 == __FILE__
- # Change listen port.
- server = DatetimePortTypeApp.new('app', nil, '0.0.0.0', 10080)
- trap(:INT) do
- server.shutdown
- end
- server.start
-end
diff --git a/test/wsdl/datetime/datetime.rb b/test/wsdl/datetime/datetime.rb
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/wsdl/datetime/datetime.rb
+++ /dev/null
diff --git a/test/wsdl/datetime/datetime.wsdl b/test/wsdl/datetime/datetime.wsdl
deleted file mode 100644
index 4998dc48d6..0000000000
--- a/test/wsdl/datetime/datetime.wsdl
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions name = "datetime"
- targetNamespace="urn:jp.gr.jin.rrr.example.datetime"
- xmlns:tns="urn:jp.gr.jin.rrr.example.datetime"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <wsdl:message name="nowRequest">
- <wsdl:part name="now" type="xsd:dateTime"/>
- </wsdl:message>
-
- <wsdl:message name="nowResponse">
- <wsdl:part name="now" type="xsd:dateTime"/>
- </wsdl:message>
-
- <wsdl:portType name="DatetimePortType">
- <wsdl:operation name="now">
- <wsdl:input message="tns:nowRequest" name="nowRequest"/>
- <wsdl:output message="tns:nowResponse" name="nowResponse"/>
- </wsdl:operation>
- </wsdl:portType>
-
- <wsdl:binding name="DatetimeBinding" type="tns:DatetimePortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="now">
- <soap:operation soapAction=""/>
- <wsdl:input name="nowRequest">
- <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:jp.gr.jin.rrr.example.datetime" use="encoded"/>
- </wsdl:input>
- <wsdl:output name="nowResponse">
- <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:jp.gr.jin.rrr.example.datetime" use="encoded"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="DatetimeService">
- <wsdl:port binding="tns:DatetimeBinding" name="DatetimePort">
- <soap:address location="http://localhost:10080/"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/test/wsdl/datetime/datetimeServant.rb b/test/wsdl/datetime/datetimeServant.rb
deleted file mode 100644
index 14145c42e5..0000000000
--- a/test/wsdl/datetime/datetimeServant.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require 'datetime.rb'
-
-class DatetimePortType
- # SYNOPSIS
- # now(now)
- #
- # ARGS
- # now - {http://www.w3.org/2001/XMLSchema}dateTime
- #
- # RETURNS
- # now - {http://www.w3.org/2001/XMLSchema}dateTime
- #
- # RAISES
- # (undefined)
- #
- def now(now)
- #raise NotImplementedError.new
- now + 1
- end
-end
-
diff --git a/test/wsdl/datetime/test_datetime.rb b/test/wsdl/datetime/test_datetime.rb
deleted file mode 100644
index 7652318205..0000000000
--- a/test/wsdl/datetime/test_datetime.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-require 'test/unit'
-require 'soap/wsdlDriver'
-require 'DatetimeService.rb'
-
-
-module WSDL
-module Datetime
-
-
-class TestDatetime < Test::Unit::TestCase
- DIR = File.dirname(File.expand_path(__FILE__))
-
- Port = 17171
-
- def setup
- setup_server
- setup_client
- end
-
- def setup_server
- @server = DatetimePortTypeApp.new('Datetime server', nil, '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- Thread.current.abort_on_exception = true
- @server.start
- }
- end
-
- def setup_client
- wsdl = File.join(DIR, 'datetime.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.generate_explicit_type = true
- @client.wiredump_dev = STDOUT if $DEBUG
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @t.kill
- @t.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def test_datetime
- d = DateTime.now
- d1 = d + 1
- d2 = @client.now(d)
- assert_equal(d1.year, d2.year)
- assert_equal(d1.month, d2.month)
- assert_equal(d1.day, d2.day)
- assert_equal(d1.hour, d2.hour)
- assert_equal(d1.min, d2.min)
- assert_equal(d1.sec, d2.sec)
- assert_equal(d1.sec, d2.sec)
- end
-
- def test_time
- d = DateTime.now
- t = Time.gm(d.year, d.month, d.day, d.hour, d.min, d.sec)
- d1 = d + 1
- d2 = @client.now(t)
- assert_equal(d1.year, d2.year)
- assert_equal(d1.month, d2.month)
- assert_equal(d1.day, d2.day)
- assert_equal(d1.hour, d2.hour)
- assert_equal(d1.min, d2.min)
- assert_equal(d1.sec, d2.sec)
- assert_equal(d1.sec, d2.sec)
- end
-end
-
-
-end
-end
diff --git a/test/wsdl/document/document.wsdl b/test/wsdl/document/document.wsdl
deleted file mode 100644
index fbf03fae8b..0000000000
--- a/test/wsdl/document/document.wsdl
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions
- name="echo"
- targetNamespace="urn:docrpc"
- xmlns:tns="urn:docrpc"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema elementFormDefault="unqualified" targetNamespace="urn:docrpc">
- <xsd:complexType name="echo_struct">
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="1" name="m_string" type="xsd:string" />
- <xsd:element minOccurs="0" maxOccurs="1" name="m_datetime" type="xsd:dateTime" />
- </xsd:sequence>
- <xsd:attribute name="m_attr" type="xsd:string" />
- </xsd:complexType>
-
- <xsd:element name="echoele">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="1" name="struct1" type="tns:echo_struct" />
- <xsd:element minOccurs="0" maxOccurs="1" name="struct-2" type="tns:echo_struct" />
- </xsd:sequence>
- <xsd:attribute name="attr_string" type="xsd:string" />
- <xsd:attribute name="attr-int" type="xsd:int" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="echo_response">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="1" name="struct1" type="tns:echo_struct" />
- <xsd:element minOccurs="0" maxOccurs="1" name="struct-2" type="tns:echo_struct" />
- </xsd:sequence>
- <xsd:attribute name="attr_string" type="xsd:string" />
- <xsd:attribute name="attr-int" type="xsd:int" />
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- </types>
-
- <message name="echo_in">
- <part name="parameters" element="tns:echoele" />
- </message>
- <message name="echo_out">
- <part name="parameters" element="tns:echo_response" />
- </message>
-
- <portType name="docrpc_porttype">
- <operation name="echo">
- <input message="tns:echo_in" />
- <output message="tns:echo_out" />
- </operation>
- </portType>
-
- <binding name="docrpc_binding" type="tns:docrpc_porttype">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <operation name="echo">
- <soap:operation soapAction="urn:docrpc:echo" style="document" />
- <input>
- <soap:body use="literal" />
- </input>
- <output>
- <soap:body use="literal" />
- </output>
- </operation>
- </binding>
-
- <service name="docrpc_service">
- <port name="docprc_service_port" binding="tns:docrpc_binding">
- <soap:address location="http://localhost:17171/" />
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/document/number.wsdl b/test/wsdl/document/number.wsdl
deleted file mode 100644
index cc3dd8e9f0..0000000000
--- a/test/wsdl/document/number.wsdl
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions
- name="foo"
- targetNamespace="urn:foo"
- xmlns:tns="urn:foo"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema elementFormDefault="unqualified" targetNamespace="urn:foo">
- <xsd:element name="get_foo">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="1" name="number" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- </types>
-
- <message name="get_foo_in">
- <part name="parameters" element="tns:get_foo" />
- </message>
- <message name="get_foo_out">
- <part name="parameters" type="xsd:string" />
- </message>
-
- <portType name="foo_porttype">
- <operation name="get_foo">
- <input message="tns:get_foo_in" />
- <output message="tns:get_foo_out" />
- </operation>
- </portType>
-
- <binding name="foo_binding" type="tns:foo_porttype">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
- style="document" />
- <operation name="get_foo">
- <soap:operation soapAction="urn:foo:get_foo" style="document" />
- <input>
- <soap:body use="literal" />
- </input>
- <output>
- <soap:body use="literal" />
- </output>
- </operation>
- </binding>
-
- <service name="foo_service">
- <port name="foo_service_port" binding="tns:foo_binding">
- <soap:address location="http://localhost:17171/" />
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/document/ping_nosoapaction.wsdl b/test/wsdl/document/ping_nosoapaction.wsdl
deleted file mode 100644
index ab9529e456..0000000000
--- a/test/wsdl/document/ping_nosoapaction.wsdl
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions xmlns:tns="http://xmlsoap.org/Ping"
-xmlns="http://schemas.xmlsoap.org/wsdl/"
-xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
-targetNamespace="http://xmlsoap.org/Ping" name="Ping">
- <types>
- <schema targetNamespace="http://xmlsoap.org/Ping"
- xmlns="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified">
- <complexType name="ping">
- <sequence>
- <element name="scenario" type="xsd:string"
- nillable="true"/>
- <element name="origin" type="xsd:string"
- nillable="true"/>
- <element name="text" type="xsd:string"
- nillable="true"/>
- </sequence>
- </complexType>
- <complexType name="pingResponse">
- <sequence>
- <element name="scenario" type="xsd:string"
- nillable="true"/>
- <element name="origin" type="xsd:string"
- nillable="true"/>
- <element name="text" type="xsd:string"
- nillable="true"/>
- </sequence>
- </complexType>
- <element name="Ping" type="tns:ping"/>
- <element name="PingResponse" type="tns:pingResponse"/>
- </schema>
- </types>
- <message name="PingRequest">
- <part name="ping" element="tns:Ping"/>
- </message>
- <message name="PingResponse">
- <part name="pingResponse" element="tns:PingResponse"/>
- </message>
- <portType name="PingPort">
- <operation name="Ping">
- <input message="tns:PingRequest"/>
- <output message="tns:PingResponse"/>
- </operation>
- </portType>
- <binding name="PingBinding" type="tns:PingPort">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http"/>
- <operation name="Ping">
- <soap:operation/>
- <input>
- <soap:body use="literal"/>
- </input>
- <output>
- <soap:body use="literal"/>
- </output>
- </operation>
- </binding>
- <service name="PingService">
- <port name="PingPort" binding="tns:PingBinding">
- <soap:address
- location="http://127.0.0.1:8080/axis/services/PingPort"/>
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/document/test_nosoapaction.rb b/test/wsdl/document/test_nosoapaction.rb
deleted file mode 100644
index 77f642fe1b..0000000000
--- a/test/wsdl/document/test_nosoapaction.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-require 'test/unit'
-require 'wsdl/parser'
-require 'wsdl/soap/wsdl2ruby'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-require 'soap/rpc/driver'
-
-
-module WSDL; module Document
-
-
-class TestNoSOAPAction < Test::Unit::TestCase
- class Server < ::SOAP::RPC::StandaloneServer
- Namespace = 'http://xmlsoap.org/Ping'
-
- def on_init
- add_document_method(
- self,
- Namespace + '/ping',
- 'ping_with_soapaction',
- XSD::QName.new(Namespace, 'Ping'),
- XSD::QName.new(Namespace, 'PingResponse')
- )
-
- add_document_method(
- self,
- nil,
- 'ping',
- XSD::QName.new(Namespace, 'Ping'),
- XSD::QName.new(Namespace, 'PingResponse')
- )
-
- # When no SOAPAction given, latter method(ping) is called.
- end
-
- def ping(arg)
- arg.text = 'ping'
- arg
- end
-
- def ping_with_soapaction(arg)
- arg.text = 'ping_with_soapaction'
- arg
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
-
- Port = 17171
-
- def setup
- setup_server
- @client = nil
- end
-
- def teardown
- teardown_server
- @client.reset_stream if @client
- end
-
- def setup_server
- @server = Server.new('Test', Server::Namespace, '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def test_with_soapaction
- wsdl = File.join(DIR, 'ping_nosoapaction.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = STDOUT if $DEBUG
- rv = @client.ping(:scenario => 'scenario', :origin => 'origin',
- :text => 'text')
- assert_equal('scenario', rv.scenario)
- assert_equal('origin', rv.origin)
- assert_equal('ping', rv.text)
- end
-
- def test_without_soapaction
- @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/",
- Server::Namespace)
- @client.add_document_method('ping', Server::Namespace + '/ping',
- XSD::QName.new(Server::Namespace, 'Ping'),
- XSD::QName.new(Server::Namespace, 'PingResponse'))
- @client.wiredump_dev = STDOUT if $DEBUG
- rv = @client.ping(:scenario => 'scenario', :origin => 'origin',
- :text => 'text')
- assert_equal('scenario', rv.scenario)
- assert_equal('origin', rv.origin)
- assert_equal('ping_with_soapaction', rv.text)
- end
-end
-
-
-end; end
diff --git a/test/wsdl/document/test_number.rb b/test/wsdl/document/test_number.rb
deleted file mode 100644
index a640ef2a25..0000000000
--- a/test/wsdl/document/test_number.rb
+++ /dev/null
@@ -1,99 +0,0 @@
-require 'test/unit'
-require 'wsdl/parser'
-require 'wsdl/soap/wsdl2ruby'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-
-
-module WSDL; module Document
-
-
-class TestNumber < Test::Unit::TestCase
- class Server < ::SOAP::RPC::StandaloneServer
- Namespace = 'urn:foo'
-
- def on_init
- add_document_method(
- self,
- Namespace + ':get_foo',
- 'get_foo',
- XSD::QName.new(Namespace, 'get_foo'),
- XSD::QName.new(Namespace, 'get_foo_response')
- )
- end
-
- def get_foo(arg)
- arg.number
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
- Port = 17171
-
- def setup
- setup_server
- setup_classdef
- @client = nil
- end
-
- def teardown
- teardown_server
- File.unlink(pathname('foo.rb'))
- @client.reset_stream if @client
- end
-
- def setup_server
- @server = Server.new('Test', "urn:rpc", '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_classdef
- gen = WSDL::SOAP::WSDL2Ruby.new
- gen.location = pathname("number.wsdl")
- gen.basedir = DIR
- gen.logger.level = Logger::FATAL
- gen.opt['classdef'] = nil
- gen.opt['force'] = true
- gen.run
- require pathname('foo')
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def pathname(filename)
- File.join(DIR, filename)
- end
-
- def test_wsdl
- wsdl = File.join(DIR, 'number.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = STDOUT if $DEBUG
-
- # with the Struct defined in foo.rb, which is generated from WSDL
- assert_equal("12345", @client.get_foo(Get_foo.new("12345")))
-
- # with Hash
- assert_equal("12345", @client.get_foo({:number => "12345"}))
-
- # with Original struct
- get_foo_struct = Struct.new(:number)
- assert_equal("12345", @client.get_foo(get_foo_struct.new("12345")))
- end
-end
-
-
-end; end
diff --git a/test/wsdl/document/test_rpc.rb b/test/wsdl/document/test_rpc.rb
deleted file mode 100644
index 6c07a18ac2..0000000000
--- a/test/wsdl/document/test_rpc.rb
+++ /dev/null
@@ -1,177 +0,0 @@
-require 'test/unit'
-require 'wsdl/parser'
-require 'wsdl/soap/wsdl2ruby'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-
-
-module WSDL; module Document
-
-
-class TestRPC < Test::Unit::TestCase
- class Server < ::SOAP::RPC::StandaloneServer
- Namespace = 'urn:docrpc'
-
- def on_init
- add_document_method(
- self,
- Namespace + ':echo',
- 'echo',
- XSD::QName.new(Namespace, 'echo'),
- XSD::QName.new(Namespace, 'echo_response')
- )
- end
-
- def echo(arg)
- if arg.is_a?(Echoele)
- # swap args
- tmp = arg.struct1
- arg.struct1 = arg.struct_2
- arg.struct_2 = tmp
- arg
- else
- # swap args
- tmp = arg["struct1"]
- arg["struct1"] = arg["struct-2"]
- arg["struct-2"] = tmp
- arg
- end
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
-
- Port = 17171
-
- def setup
- setup_server
- setup_classdef
- @client = nil
- end
-
- def teardown
- teardown_server
- File.unlink(pathname('echo.rb'))
- @client.reset_stream if @client
- end
-
- def setup_server
- @server = Server.new('Test', "urn:rpc", '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_classdef
- gen = WSDL::SOAP::WSDL2Ruby.new
- gen.location = pathname("document.wsdl")
- gen.basedir = DIR
- gen.logger.level = Logger::FATAL
- gen.opt['classdef'] = nil
- gen.opt['force'] = true
- gen.run
- require pathname('echo')
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def pathname(filename)
- File.join(DIR, filename)
- end
-
- def test_wsdl
- wsdl = File.join(DIR, 'document.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = STDOUT if $DEBUG
-
- struct1 = Echo_struct.new("mystring1", now1 = Time.now)
- struct1.xmlattr_m_attr = 'myattr1'
- struct2 = Echo_struct.new("mystring2", now2 = Time.now)
- struct2.xmlattr_m_attr = 'myattr2'
- echo = Echoele.new(struct1, struct2)
- echo.xmlattr_attr_string = 'attr_string'
- echo.xmlattr_attr_int = 5
- ret = @client.echo(echo)
-
- # struct#m_datetime in a response is a DateTime even though
- # struct#m_datetime in a request is a Time.
- timeformat = "%Y-%m-%dT%H:%M:%S"
- assert_equal("mystring2", ret.struct1.m_string)
- assert_equal(now2.strftime(timeformat),
- date2time(ret.struct1.m_datetime).strftime(timeformat))
- assert_equal("mystring1", ret.struct_2.m_string)
- assert_equal(now1.strftime(timeformat),
- date2time(ret.struct_2.m_datetime).strftime(timeformat))
- assert_equal("attr_string", ret.xmlattr_attr_string)
- assert_equal(5, ret.xmlattr_attr_int)
- end
-
- def date2time(date)
- if date.respond_to?(:to_time)
- date.to_time
- else
- d = date.new_offset(0)
- d.instance_eval {
- Time.utc(year, mon, mday, hour, min, sec,
- (sec_fraction * 86400000000).to_i)
- }.getlocal
- end
- end
-
- include ::SOAP
- def test_naive
- @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/")
- @client.add_document_method('echo', 'urn:docrpc:echo',
- XSD::QName.new('urn:docrpc', 'echoele'),
- XSD::QName.new('urn:docrpc', 'echo_response'))
- @client.wiredump_dev = STDOUT if $DEBUG
-
- echo = SOAPElement.new('foo')
- echo.extraattr['attr_string'] = 'attr_string'
- echo.extraattr['attr-int'] = 5
- echo.add(struct1 = SOAPElement.new('struct1'))
- struct1.add(SOAPElement.new('m_string', 'mystring1'))
- struct1.add(SOAPElement.new('m_datetime', '2005-03-17T19:47:31+01:00'))
- struct1.extraattr['m_attr'] = 'myattr1'
- echo.add(struct2 = SOAPElement.new('struct-2'))
- struct2.add(SOAPElement.new('m_string', 'mystring2'))
- struct2.add(SOAPElement.new('m_datetime', '2005-03-17T19:47:32+02:00'))
- struct2.extraattr['m_attr'] = 'myattr2'
- ret = @client.echo(echo)
- timeformat = "%Y-%m-%dT%H:%M:%S"
- assert_equal('mystring2', ret.struct1.m_string)
- assert_equal('2005-03-17T19:47:32',
- ret.struct1.m_datetime.strftime(timeformat))
- assert_equal("mystring1", ret.struct_2.m_string)
- assert_equal('2005-03-17T19:47:31',
- ret.struct_2.m_datetime.strftime(timeformat))
- assert_equal('attr_string', ret.xmlattr_attr_string)
- assert_equal(5, ret.xmlattr_attr_int)
-
- echo = {'struct1' => {'m_string' => 'mystring1', 'm_datetime' => '2005-03-17T19:47:31+01:00'},
- 'struct-2' => {'m_string' => 'mystring2', 'm_datetime' => '2005-03-17T19:47:32+02:00'}}
- ret = @client.echo(echo)
- timeformat = "%Y-%m-%dT%H:%M:%S"
- assert_equal('mystring2', ret.struct1.m_string)
- assert_equal('2005-03-17T19:47:32',
- ret.struct1.m_datetime.strftime(timeformat))
- assert_equal("mystring1", ret.struct_2.m_string)
- assert_equal('2005-03-17T19:47:31',
- ret.struct_2.m_datetime.strftime(timeformat))
- end
-end
-
-
-end; end
diff --git a/test/wsdl/emptycomplextype.wsdl b/test/wsdl/emptycomplextype.wsdl
deleted file mode 100644
index 4f8dc4849c..0000000000
--- a/test/wsdl/emptycomplextype.wsdl
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions name = "emptycomplextype"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="urn:jp.gr.jin.rrr.example.emptycomplextype"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <xsd:schema elementFormDefault="qualified"
- targetNamespace="urn:jp.gr.jin.rrr.example.emptycomplextype">
- <xsd:element name="typeIn">
- <xsd:complexType />
- </xsd:element>
-
- <xsd:element name="typeOut">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="0" maxOccurs="1" name="str1" type="xsd:string" />
- <xsd:element minOccurs="0" maxOccurs="1" name="str2" type="xsd:string" />
- <xsd:element minOccurs="0" maxOccurs="1" name="seq">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:any />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- </types>
-</definitions>
diff --git a/test/wsdl/map/map.wsdl b/test/wsdl/map/map.wsdl
deleted file mode 100644
index e418a4cbbd..0000000000
--- a/test/wsdl/map/map.wsdl
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0"?>
-<definitions
- name="map"
- targetNamespace="urn:map"
- xmlns:tns="urn:map"
- xmlns:txd="urn:map"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:apachesoap="http://xml.apache.org/xml-soap">
-
- <types>
- <schema
- xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://xml.apache.org/xml-soap">
- <complexType name="Map">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="key" type="xsd:anyType" />
- <element name="value" type="xsd:anyType" />
- </sequence>
- </complexType>
- </element>
- </sequence>
- </complexType>
- </schema>
- </types>
-
- <message name="mapRequest"/>
- <message name="mapResponse">
- <part name="return" type="apachesoap:Map"/>
- </message>
-
- <message name="map2Request">
- <part name="arg" type="apachesoap:Map"/>
- </message>
- <message name="map2Response">
- <part name="return" type="apachesoap:Map"/>
- </message>
-
- <portType name="MapServicePortType">
- <operation name="map" parameterOrder="">
- <input message="tns:mapRequest"/>
- <output message="tns:mapResponse"/>
- </operation>
-
- <operation name="map2" parameterOrder="">
- <input message="tns:map2Request"/>
- <output message="tns:map2Response"/>
- </operation>
- </portType>
-
- <binding name="MapServicePortBinding" type="tns:MapServicePortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
- <operation name="map">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:map"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:map"/>
- </output>
- </operation>
-
- <operation name="map2">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:map"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:map"/>
- </output>
- </operation>
- </binding>
-
- <service name="MapService">
- <port name="MapServicePort" binding="tns:MapServicePortBinding">
- <soap:address location="http://raa.ruby-lang.org/soap/1.0.2/"/>
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/map/map.xml b/test/wsdl/map/map.xml
deleted file mode 100644
index 7106735ffc..0000000000
--- a/test/wsdl/map/map.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n2:mapResponse xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/" xmlns:n2="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <return xmlns:n3="http://xml.apache.org/xml-soap" xsi:type="n3:Map">
- <item>
- <key xsi:type="xsd:string">a</key>
- <value xsi:type="n3:Map">
- <item>
- <key xsi:type="xsd:string">a1</key>
- <value xsi:type="n1:Array" n1:arrayType="xsd:anyType[1]">
- <item xsi:type="xsd:string">a1</item>
- </value>
- </item>
- <item>
- <key xsi:type="xsd:string">a2</key>
- <value xsi:type="n1:Array" n1:arrayType="xsd:anyType[1]">
- <item xsi:type="xsd:string">a2</item>
- </value>
- </item>
- </value>
- </item>
- <item>
- <key xsi:type="xsd:string">b</key>
- <value xsi:type="n3:Map">
- <item>
- <key xsi:type="xsd:string">b1</key>
- <value xsi:type="n1:Array" n1:arrayType="xsd:anyType[1]">
- <item xsi:type="xsd:string">b1</item>
- </value>
- </item>
- <item>
- <key xsi:type="xsd:string">b2</key>
- <value xsi:type="n1:Array" n1:arrayType="xsd:anyType[1]">
- <item xsi:type="xsd:string">b2</item>
- </value>
- </item>
- </value>
- </item>
- </return>
- </n2:mapResponse>
- </env:Body>
-</env:Envelope>
diff --git a/test/wsdl/map/test_map.rb b/test/wsdl/map/test_map.rb
deleted file mode 100644
index 68f7d76e05..0000000000
--- a/test/wsdl/map/test_map.rb
+++ /dev/null
@@ -1,99 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/httpserver'
-require 'soap/wsdlDriver'
-
-
-module WSDL
-
-
-class TestMap < Test::Unit::TestCase
- Port = 17171
- DIR = File.dirname(File.expand_path(__FILE__))
-
- class Server < ::SOAP::RPC::HTTPServer
- def on_init
- add_method(self, 'map')
- add_method(self, 'map2', 'arg')
- end
-
- def map
- {1 => "a", 2 => "b"}
- end
-
- def map2(arg)
- arg
- end
- end
-
- def setup
- setup_server
- setup_client
- end
-
- def setup_server
- @server = Server.new(
- :BindAddress => "0.0.0.0",
- :Port => Port,
- :AccessLog => [],
- :SOAPDefaultNamespace => "urn:map"
- )
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- Thread.current.abort_on_exception = true
- @server.start
- }
- end
-
- def setup_client
- wsdl = File.join(DIR, 'map.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.generate_explicit_type = true
- @client.wiredump_dev = STDOUT if $DEBUG
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @t.kill
- @t.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def test_by_wsdl
- dir = File.dirname(File.expand_path(__FILE__))
- wsdlfile = File.join(dir, 'map.wsdl')
- xml = File.open(File.join(dir, 'map.xml')) { |f| f.read }
- wsdl = WSDL::Importer.import(wsdlfile)
- service = wsdl.services[0]
- port = service.ports[0]
- wsdl_types = wsdl.collect_complextypes
- rpc_decode_typemap = wsdl_types + wsdl.soap_rpc_complextypes(port.find_binding)
- opt = {}
- opt[:default_encodingstyle] = ::SOAP::EncodingNamespace
- opt[:decode_typemap] = rpc_decode_typemap
- header, body = ::SOAP::Processor.unmarshal(xml, opt)
- map = ::SOAP::Mapping.soap2obj(body.response)
- assert_equal(["a1"], map["a"]["a1"])
- assert_equal(["a2"], map["a"]["a2"])
- assert_equal(["b1"], map["b"]["b1"])
- assert_equal(["b2"], map["b"]["b2"])
- end
-
- def test_wsdldriver
- assert_equal({1 => "a", 2 => "b"}, @client.map)
- assert_equal({1 => 2}, @client.map2({1 => 2}))
- assert_equal({1 => {2 => 3}}, @client.map2({1 => {2 => 3}}))
- assert_equal({["a", 2] => {2 => 3}}, @client.map2({["a", 2] => {2 => 3}}))
- end
-end
-
-
-end
diff --git a/test/wsdl/marshal/person.wsdl b/test/wsdl/marshal/person.wsdl
deleted file mode 100644
index 6ea8a04825..0000000000
--- a/test/wsdl/marshal/person.wsdl
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<definitions name="Person"
- targetNamespace="http://www.jin.gr.jp/~nahi/xmlns/sample/Person"
- xmlns:tns="http://www.jin.gr.jp/~nahi/xmlns/sample/Person"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.jin.gr.jp/~nahi/xmlns/sample/Person">
- <complexType name="Person">
- <all>
- <element name="familyname" type="xsd:string"/>
- <element name="givenname" type="xsd:string"/>
- <element name="var1" type="xsd:int"/>
- <element name="var2" type="xsd:double"/>
- <element name="var3" type="xsd:string"/>
- </all>
- </complexType>
- </xsd:schema>
- </types>
-</definitions>
diff --git a/test/wsdl/marshal/person_org.rb b/test/wsdl/marshal/person_org.rb
deleted file mode 100644
index f8c0e0db76..0000000000
--- a/test/wsdl/marshal/person_org.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'xsd/qname'
-
-# {http://www.jin.gr.jp/~nahi/xmlns/sample/Person}Person
-class Person
- @@schema_type = "Person"
- @@schema_ns = "http://www.jin.gr.jp/~nahi/xmlns/sample/Person"
- @@schema_element = [["familyname", ["SOAP::SOAPString", XSD::QName.new(nil, "familyname")]], ["givenname", ["SOAP::SOAPString", XSD::QName.new(nil, "givenname")]], ["var1", ["SOAP::SOAPInt", XSD::QName.new(nil, "var1")]], ["var2", ["SOAP::SOAPDouble", XSD::QName.new(nil, "var2")]], ["var3", ["SOAP::SOAPString", XSD::QName.new(nil, "var3")]]]
-
- attr_accessor :familyname
- attr_accessor :givenname
- attr_accessor :var1
- attr_accessor :var2
- attr_accessor :var3
-
- def initialize(familyname = nil, givenname = nil, var1 = nil, var2 = nil, var3 = nil)
- @familyname = familyname
- @givenname = givenname
- @var1 = var1
- @var2 = var2
- @var3 = var3
- end
-end
diff --git a/test/wsdl/marshal/test_wsdlmarshal.rb b/test/wsdl/marshal/test_wsdlmarshal.rb
deleted file mode 100644
index cd2bdb198a..0000000000
--- a/test/wsdl/marshal/test_wsdlmarshal.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-require 'test/unit'
-require 'wsdl/parser'
-require 'soap/mapping/wsdlencodedregistry'
-require 'soap/marshal'
-require 'wsdl/soap/wsdl2ruby'
-
-class WSDLMarshaller
- include SOAP
-
- def initialize(wsdlfile)
- wsdl = WSDL::Parser.new.parse(File.open(wsdlfile) { |f| f.read })
- types = wsdl.collect_complextypes
- @opt = {
- :decode_typemap => types,
- :generate_explicit_type => false,
- :pretty => true
- }
- @mapping_registry = Mapping::WSDLEncodedRegistry.new(types)
- end
-
- def dump(obj, io = nil)
- type = Mapping.class2element(obj.class)
- ele = Mapping.obj2soap(obj, @mapping_registry, type)
- ele.elename = ele.type
- Processor.marshal(SOAPEnvelope.new(nil, SOAPBody.new(ele)), @opt, io)
- end
-
- def load(io)
- header, body = Processor.unmarshal(io, @opt)
- Mapping.soap2obj(body.root_node)
- end
-end
-
-
-require File.join(File.dirname(__FILE__), 'person_org')
-
-class Person
- def ==(rhs)
- @familyname == rhs.familyname and @givenname == rhs.givenname and
- @var1 == rhs.var1 and @var2 == rhs.var2 and @var3 == rhs.var3
- end
-end
-
-
-class TestWSDLMarshal < Test::Unit::TestCase
- DIR = File.dirname(File.expand_path(__FILE__))
-
- def test_marshal
- marshaller = WSDLMarshaller.new(pathname('person.wsdl'))
- obj = Person.new("NAKAMURA", "Hiroshi", 1, 1.0, "1")
- str = marshaller.dump(obj)
- obj2 = marshaller.load(str)
- assert_equal(obj, obj2)
- assert_equal(str, marshaller.dump(obj2))
- end
-
- def test_classdef
- gen = WSDL::SOAP::WSDL2Ruby.new
- gen.location = pathname("person.wsdl")
- gen.basedir = DIR
- gen.logger.level = Logger::FATAL
- gen.opt['classdef'] = nil
- gen.opt['force'] = true
- gen.run
- compare("person_org.rb", "Person.rb")
- File.unlink(pathname('Person.rb'))
- end
-
- def compare(expected, actual)
- assert_equal(loadfile(expected), loadfile(actual), actual)
- end
-
- def loadfile(file)
- File.open(pathname(file)) { |f| f.read }
- end
-
- def pathname(filename)
- File.join(DIR, filename)
- end
-end
diff --git a/test/wsdl/multiplefault.wsdl b/test/wsdl/multiplefault.wsdl
deleted file mode 100644
index 2d928b60b0..0000000000
--- a/test/wsdl/multiplefault.wsdl
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<definitions name="MultipleFaultTest"
- targetNamespace="urn:jp.gr.jin.rrr.example.ele"
- xmlns:tns="urn:jp.gr.jin.rrr.example.ele"
- xmlns:typens="urn:jp.gr.jin.rrr.example.datatypes"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="urn:jp.gr.jin.rrr.example.datatypes">
- <xsd:complexType name="AuthenticationError">
- <all>
- <element name="message" type="xsd:string" />
- <element name="backtrace" type="xoapenc:Array" />
- </all>
- </xsd:complexType>
- <xsd:complexType name="AuthorizationError">
- <all>
- <element name="message" type="xsd:string" />
- <element name="backtrace" type="xoapenc:Array" />
- </all>
- </xsd:complexType>
- </xsd:schema>
- </types>
-
- <message name="inputmsg"/>
- <message name="outputmsg"/>
- <message name="faultmsg1" >
- <part name="exception" type="typens:AuthenticationError" />
- </message>
- <message name="faultmsg2" >
- <part name="exception" type="typens:AuthorizationError" />
- </message>
-
- <portType name="MultipleFaultPortType">
- <operation name="myoperation">
- <input message="tns:inputmsg"/>
- <output message="tns:outputmsg"/>
- <fault message="tns:faultmsg1"/>
- <fault message="tns:faultmsg2"/>
- </operation>
- </portType>
-
- <binding name="MultipleFaultBinding" type="tns:MultipleFaultPortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
- <operation name="myoperation">
- <soap:operation soapAction="urn:jp.gr.jin.rrr.example.ele"/>
- <input>
- <soap:body use="encoded" namespace="urn:jp.gr.jin.rrr.example.ele"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="urn:jp.gr.jin.rrr.example.ele"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- </binding>
-
- <service name="MultipleFaultService">
- <port name="MultipleFaultPortType" binding="tns:MultipleFaultBinding">
- <soap:address location="http://localhost:17171/"/>
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/qualified/lp.wsdl b/test/wsdl/qualified/lp.wsdl
deleted file mode 100644
index b107b7b392..0000000000
--- a/test/wsdl/qualified/lp.wsdl
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions
- name="lp"
- targetNamespace="urn:lp"
- xmlns:tns="urn:lp"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema">
- <import namespace="urn:lp" schemaLocation="lp.xsd"/>
- </schema>
- </types>
-
- <message name="login_in">
- <part name="parameters" element="tns:login" />
- </message>
- <message name="login_out">
- <part name="parameters" element="tns:loginResponse" />
- </message>
-
- <portType name="lp_porttype">
- <operation name="login">
- <input message="tns:login_in" />
- <output message="tns:login_out" />
- </operation>
- </portType>
-
- <binding name="lp_binding" type="tns:lp_porttype">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <operation name="login">
- <soap:operation soapAction="urn:lp:login" style="document" />
- <input>
- <soap:body use="literal" />
- </input>
- <output>
- <soap:body use="literal" />
- </output>
- </operation>
- </binding>
-
- <service name="lp_service">
- <port name="lp_service_port" binding="tns:lp_binding">
- <soap:address location="http://localhost:17171/" />
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/qualified/lp.xsd b/test/wsdl/qualified/lp.xsd
deleted file mode 100644
index 12bcbd8cef..0000000000
--- a/test/wsdl/qualified/lp.xsd
+++ /dev/null
@@ -1,26 +0,0 @@
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:lp="urn:lp" targetNamespace="urn:lp" elementFormDefault="unqualified">
-
- <xs:complexType name="login">
- <xs:sequence>
- <xs:element name="username" type="xs:string"/>
- <xs:element name="password" type="xs:string"/>
- <xs:element name="timezone" type="xs:string" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:element name="login" type="lp:login"/>
-
- <xs:complexType name="loginResponse">
- <xs:sequence>
- <xs:element name="loginResult">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="sessionID" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
-
- <xs:element name="loginResponse" type="lp:loginResponse"/>
-</xs:schema>
diff --git a/test/wsdl/qualified/np.wsdl b/test/wsdl/qualified/np.wsdl
deleted file mode 100644
index e2b7253d0e..0000000000
--- a/test/wsdl/qualified/np.wsdl
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www50.brinkster.com/vbfacileinpt/np" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www50.brinkster.com/vbfacileinpt/np" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified" targetNamespace="http://www50.brinkster.com/vbfacileinpt/np">
- <s:element name="GetPrimeNumbers">
- <s:complexType>
- <s:sequence>
- <s:element minOccurs="0" maxOccurs="1" name="Max" type="s:string" />
- </s:sequence>
- </s:complexType>
- </s:element>
- <s:element name="GetPrimeNumbersResponse">
- <s:complexType>
- <s:sequence>
- <s:element minOccurs="0" maxOccurs="1" name="GetPrimeNumbersResult" type="s:string" />
- </s:sequence>
- </s:complexType>
- </s:element>
- </s:schema>
- </wsdl:types>
- <wsdl:message name="GetPrimeNumbersSoapIn">
- <wsdl:part name="parameters" element="tns:GetPrimeNumbers" />
- </wsdl:message>
- <wsdl:message name="GetPrimeNumbersSoapOut">
- <wsdl:part name="parameters" element="tns:GetPrimeNumbersResponse" />
- </wsdl:message>
- <wsdl:portType name="pnumSoap">
- <wsdl:operation name="GetPrimeNumbers">
- <wsdl:input message="tns:GetPrimeNumbersSoapIn" />
- <wsdl:output message="tns:GetPrimeNumbersSoapOut" />
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="pnumSoap" type="tns:pnumSoap">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdl:operation name="GetPrimeNumbers">
- <soap:operation soapAction="http://www50.brinkster.com/vbfacileinpt/np/GetPrimeNumbers" style="document" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="pnum">
- <wsdl:port name="pnumSoap" binding="tns:pnumSoap">
- <soap:address location="http://www50.brinkster.com/vbfacileinpt/np.asmx" />
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions> \ No newline at end of file
diff --git a/test/wsdl/qualified/test_qualified.rb b/test/wsdl/qualified/test_qualified.rb
deleted file mode 100644
index d6c1159a87..0000000000
--- a/test/wsdl/qualified/test_qualified.rb
+++ /dev/null
@@ -1,154 +0,0 @@
-require 'test/unit'
-require 'wsdl/soap/wsdl2ruby'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-
-if defined?(HTTPAccess2)
-
-module WSDL
-
-
-class TestQualified < Test::Unit::TestCase
- class Server < ::SOAP::RPC::StandaloneServer
- Namespace = 'http://www50.brinkster.com/vbfacileinpt/np'
-
- def on_init
- add_document_method(
- self,
- Namespace + '/GetPrimeNumbers',
- 'GetPrimeNumbers',
- XSD::QName.new(Namespace, 'GetPrimeNumbers'),
- XSD::QName.new(Namespace, 'GetPrimeNumbersResponse')
- )
- end
-
- def GetPrimeNumbers(arg)
- nil
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
- Port = 17171
-
- def setup
- setup_server
- setup_clientdef
- @client = nil
- end
-
- def teardown
- teardown_server
- unless $DEBUG
- File.unlink(pathname('default.rb'))
- File.unlink(pathname('defaultDriver.rb'))
- end
- @client.reset_stream if @client
- end
-
- def setup_server
- @server = Server.new('Test', "urn:lp", '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_clientdef
- backupdir = Dir.pwd
- begin
- Dir.chdir(DIR)
- gen = WSDL::SOAP::WSDL2Ruby.new
- gen.location = pathname("np.wsdl")
- gen.basedir = DIR
- gen.logger.level = Logger::FATAL
- gen.opt['classdef'] = nil
- gen.opt['driver'] = nil
- gen.opt['force'] = true
- gen.run
- require pathname('default.rb')
- ensure
- Dir.chdir(backupdir)
- end
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def pathname(filename)
- File.join(DIR, filename)
- end
-
- LOGIN_REQUEST_QUALIFIED_NS =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:GetPrimeNumbers xmlns:n1="http://www50.brinkster.com/vbfacileinpt/np">
- <n1:Max>10</n1:Max>
- </n1:GetPrimeNumbers>
- </env:Body>
-</env:Envelope>]
-
- LOGIN_REQUEST_QUALIFIED =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <GetPrimeNumbers xmlns="http://www50.brinkster.com/vbfacileinpt/np">
- <Max>10</Max>
- </GetPrimeNumbers>
- </env:Body>
-</env:Envelope>]
-
- def test_wsdl
- wsdl = File.join(DIR, 'np.wsdl')
- @client = nil
- backupdir = Dir.pwd
- begin
- Dir.chdir(DIR)
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- ensure
- Dir.chdir(backupdir)
- end
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = str = ''
- @client.GetPrimeNumbers(:Max => 10)
- assert_equal(LOGIN_REQUEST_QUALIFIED_NS, parse_requestxml(str))
- end
-
- include ::SOAP
- def test_naive
- backupdir = Dir.pwd
- begin
- Dir.chdir(DIR)
- require pathname('defaultDriver')
- ensure
- Dir.chdir(backupdir)
- end
- @client = PnumSoap.new("http://localhost:#{Port}/")
-
- @client.wiredump_dev = str = ''
- @client.getPrimeNumbers(GetPrimeNumbers.new(10))
- assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str))
- end
-
- def parse_requestxml(str)
- str.split(/\r?\n\r?\n/)[3]
- end
-end
-
-
-end
-
-end
diff --git a/test/wsdl/qualified/test_unqualified.rb b/test/wsdl/qualified/test_unqualified.rb
deleted file mode 100644
index bcfed73e58..0000000000
--- a/test/wsdl/qualified/test_unqualified.rb
+++ /dev/null
@@ -1,143 +0,0 @@
-require 'test/unit'
-require 'wsdl/soap/wsdl2ruby'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-
-if defined?(HTTPAccess2)
-
-module WSDL
-
-
-class TestUnqualified < Test::Unit::TestCase
- class Server < ::SOAP::RPC::StandaloneServer
- Namespace = 'urn:lp'
-
- def on_init
- add_document_method(
- self,
- Namespace + ':login',
- 'login',
- XSD::QName.new(Namespace, 'login'),
- XSD::QName.new(Namespace, 'loginResponse')
- )
- end
-
- def login(arg)
- nil
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
- Port = 17171
-
- def setup
- setup_server
- setup_clientdef
- @client = nil
- end
-
- def teardown
- teardown_server
- File.unlink(pathname('lp.rb'))
- File.unlink(pathname('lpDriver.rb'))
- @client.reset_stream if @client
- end
-
- def setup_server
- @server = Server.new('Test', "urn:lp", '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_clientdef
- backupdir = Dir.pwd
- begin
- Dir.chdir(DIR)
- gen = WSDL::SOAP::WSDL2Ruby.new
- gen.location = pathname("lp.wsdl")
- gen.basedir = DIR
- gen.logger.level = Logger::FATAL
- gen.opt['classdef'] = nil
- gen.opt['driver'] = nil
- gen.opt['force'] = true
- gen.run
- require pathname('lp')
- ensure
- Dir.chdir(backupdir)
- end
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def pathname(filename)
- File.join(DIR, filename)
- end
-
- LOGIN_REQUEST_QUALIFIED =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:login xmlns:n1="urn:lp">
- <username>NaHi</username>
- <password>passwd</password>
- <timezone>JST</timezone>
- </n1:login>
- </env:Body>
-</env:Envelope>]
-
- def test_wsdl
- wsdl = File.join(DIR, 'lp.wsdl')
- @client = nil
- backupdir = Dir.pwd
- begin
- Dir.chdir(DIR)
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- ensure
- Dir.chdir(backupdir)
- end
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = str = ''
- @client.login(:timezone => 'JST', :password => 'passwd',
- :username => 'NaHi')
- assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str))
- end
-
- include ::SOAP
- def test_naive
- backupdir = Dir.pwd
- begin
- Dir.chdir(DIR)
- require pathname('lpDriver')
- ensure
- Dir.chdir(backupdir)
- end
- @client = Lp_porttype.new("http://localhost:#{Port}/")
-
- @client.wiredump_dev = str = ''
- @client.login(Login.new('NaHi', 'passwd', 'JST'))
- assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str))
- end
-
- def parse_requestxml(str)
- str.split(/\r?\n\r?\n/)[3]
- end
-end
-
-
-end
-
-end
diff --git a/test/wsdl/raa/RAA.rb b/test/wsdl/raa/RAA.rb
deleted file mode 100644
index aff0525480..0000000000
--- a/test/wsdl/raa/RAA.rb
+++ /dev/null
@@ -1,243 +0,0 @@
-# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/
-class Category
- @@schema_type = "Category"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
-
- def major
- @major
- end
-
- def major=(value)
- @major = value
- end
-
- def minor
- @minor
- end
-
- def minor=(value)
- @minor = value
- end
-
- def initialize(major = nil,
- minor = nil)
- @major = major
- @minor = minor
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/
-class Product
- @@schema_type = "Product"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
-
- def id
- @id
- end
-
- def id=(value)
- @id = value
- end
-
- def name
- @name
- end
-
- def name=(value)
- @name = value
- end
-
- def short_description
- @short_description
- end
-
- def short_description=(value)
- @short_description = value
- end
-
- def version
- @version
- end
-
- def version=(value)
- @version = value
- end
-
- def status
- @status
- end
-
- def status=(value)
- @status = value
- end
-
- def homepage
- @homepage
- end
-
- def homepage=(value)
- @homepage = value
- end
-
- def download
- @download
- end
-
- def download=(value)
- @download = value
- end
-
- def license
- @license
- end
-
- def license=(value)
- @license = value
- end
-
- def description
- @description
- end
-
- def description=(value)
- @description = value
- end
-
- def initialize(id = nil,
- name = nil,
- short_description = nil,
- version = nil,
- status = nil,
- homepage = nil,
- download = nil,
- license = nil,
- description = nil)
- @id = id
- @name = name
- @short_description = short_description
- @version = version
- @status = status
- @homepage = homepage
- @download = download
- @license = license
- @description = description
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/
-class Owner
- @@schema_type = "Owner"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
-
- def id
- @id
- end
-
- def id=(value)
- @id = value
- end
-
- def email
- @email
- end
-
- def email=(value)
- @email = value
- end
-
- def name
- @name
- end
-
- def name=(value)
- @name = value
- end
-
- def initialize(id = nil,
- email = nil,
- name = nil)
- @id = id
- @email = email
- @name = name
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/
-class Info
- @@schema_type = "Info"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
-
- def category
- @category
- end
-
- def category=(value)
- @category = value
- end
-
- def product
- @product
- end
-
- def product=(value)
- @product = value
- end
-
- def owner
- @owner
- end
-
- def owner=(value)
- @owner = value
- end
-
- def created
- @created
- end
-
- def created=(value)
- @created = value
- end
-
- def updated
- @updated
- end
-
- def updated=(value)
- @updated = value
- end
-
- def initialize(category = nil,
- product = nil,
- owner = nil,
- created = nil,
- updated = nil)
- @category = category
- @product = product
- @owner = owner
- @created = created
- @updated = updated
- end
-end
-
-# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/
-class InfoArray < Array
- # Contents type should be dumped here...
- @@schema_type = "InfoArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
-end
-
-# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/
-class StringArray < Array
- # Contents type should be dumped here...
- @@schema_type = "StringArray"
- @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
-end
-
-# http://xml.apache.org/xml-soap
-class Map < Array
- # Contents type should be dumped here...
- @@schema_type = "Map"
- @@schema_ns = "http://xml.apache.org/xml-soap"
-end
-
diff --git a/test/wsdl/raa/RAAServant.rb b/test/wsdl/raa/RAAServant.rb
deleted file mode 100644
index 68380f8e48..0000000000
--- a/test/wsdl/raa/RAAServant.rb
+++ /dev/null
@@ -1,99 +0,0 @@
-class RAABaseServicePortType
- # SYNOPSIS
- # getAllListings
- #
- # ARGS
- # N/A
- #
- # RETURNS
- # return StringArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}StringArray
- #
- # RAISES
- # (undefined)
- #
- def getAllListings
- #raise NotImplementedError.new
- ["ruby", "soap4r"]
- end
-
- # SYNOPSIS
- # getProductTree
- #
- # ARGS
- # N/A
- #
- # RETURNS
- # return Map - {http://xml.apache.org/xml-soap}Map
- #
- # RAISES
- # (undefined)
- #
- def getProductTree
- raise NotImplementedError.new
- end
-
- # SYNOPSIS
- # getInfoFromCategory(category)
- #
- # ARGS
- # category Category - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}Category
- #
- # RETURNS
- # return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray
- #
- # RAISES
- # (undefined)
- #
- def getInfoFromCategory(category)
- raise NotImplementedError.new
- end
-
- # SYNOPSIS
- # getModifiedInfoSince(timeInstant)
- #
- # ARGS
- # timeInstant - {http://www.w3.org/2001/XMLSchema}dateTime
- #
- # RETURNS
- # return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray
- #
- # RAISES
- # (undefined)
- #
- def getModifiedInfoSince(timeInstant)
- raise NotImplementedError.new
- end
-
- # SYNOPSIS
- # getInfoFromName(productName)
- #
- # ARGS
- # productName - {http://www.w3.org/2001/XMLSchema}string
- #
- # RETURNS
- # return Info - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}Info
- #
- # RAISES
- # (undefined)
- #
- def getInfoFromName(productName)
- raise NotImplementedError.new
- end
-
- # SYNOPSIS
- # getInfoFromOwnerId(ownerId)
- #
- # ARGS
- # ownerId - {http://www.w3.org/2001/XMLSchema}int
- #
- # RETURNS
- # return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray
- #
- # RAISES
- # (undefined)
- #
- def getInfoFromOwnerId(ownerId)
- raise NotImplementedError.new
- end
-end
-
diff --git a/test/wsdl/raa/RAAService.rb b/test/wsdl/raa/RAAService.rb
deleted file mode 100644
index 9d0813304c..0000000000
--- a/test/wsdl/raa/RAAService.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env ruby
-require 'RAAServant.rb'
-
-require 'soap/rpc/standaloneServer'
-
-class RAABaseServicePortType
- MappingRegistry = SOAP::Mapping::Registry.new
-
- MappingRegistry.set(
- StringArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") }
- )
- MappingRegistry.set(
- Map,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "anyType") }
- )
- MappingRegistry.set(
- Category,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category") }
- )
- MappingRegistry.set(
- InfoArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") }
- )
- MappingRegistry.set(
- Info,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") }
- )
- MappingRegistry.set(
- Product,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Product") }
- )
- MappingRegistry.set(
- Owner,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Owner") }
- )
-
-
- Methods = [
- ["getAllListings", "getAllListings", [
- ["retval", "return",
- [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
- ["getProductTree", "getProductTree", [
- ["retval", "return",
- [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "anyType"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
- ["getInfoFromCategory", "getInfoFromCategory", [
- ["in", "category",
- [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category"]],
- ["retval", "return",
- [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
- ["getModifiedInfoSince", "getModifiedInfoSince", [
- ["in", "timeInstant",
- [SOAP::SOAPDateTime]],
- ["retval", "return",
- [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
- ["getInfoFromName", "getInfoFromName", [
- ["in", "productName",
- [SOAP::SOAPString]],
- ["retval", "return",
- [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
- ["getInfoFromOwnerId", "getInfoFromOwnerId", [
- ["in", "ownerId",
- [SOAP::SOAPInt]],
- ["retval", "return",
- [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"]
- ]
-end
-
-class App < SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super
-
- servant = RAABaseServicePortType.new
- RAABaseServicePortType::Methods.each do |name_as, name, params, soapaction, namespace|
- qname = XSD::QName.new(namespace, name_as)
- @router.add_method(servant, qname, soapaction, name, params)
- end
-
- self.mapping_registry = RAABaseServicePortType::MappingRegistry
- end
-end
-
-# Change listen port.
-if $0 == __FILE__
- App.new('app', nil, '0.0.0.0', 10080).start
-end
diff --git a/test/wsdl/raa/README.txt b/test/wsdl/raa/README.txt
deleted file mode 100644
index efbaf9d87c..0000000000
--- a/test/wsdl/raa/README.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-RAAServant.rb: based on the file which is generated with the following command;
- bin/wsdl2ruby.rb --wsdl raa.wsdl --servant_skelton --force
-
-RAAService.rb: generated with the following command;
- bin/wsdl2ruby.rb --wsdl raa.wsdl --standalone_server_stub --force
-
-RAA.rb: generated with the following command;
- bin/wsdl2ruby.rb --wsdl raa.wsdl --classdef --force
diff --git a/test/wsdl/raa/raa.wsdl b/test/wsdl/raa/raa.wsdl
deleted file mode 100644
index 78376893dd..0000000000
--- a/test/wsdl/raa/raa.wsdl
+++ /dev/null
@@ -1,264 +0,0 @@
-<?xml version="1.0"?>
-<definitions
- name="RAA"
- targetNamespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
- xmlns:tns="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
- xmlns:txd="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:apachesoap="http://xml.apache.org/xml-soap">
-
- <types>
- <schema
- xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/">
-
- <complexType name="Category">
- <all>
- <element name="major" type="string"/>
- <element name="minor" type="string"/>
- </all>
- </complexType>
-
- <complexType name="Product">
- <all>
- <element name="id" type="int"/>
- <element name="name" type="string"/>
- <element name="short_description" type="string"/>
- <element name="version" type="string"/>
- <element name="status" type="string"/>
- <element name="homepage" type="anyURI"/>
- <element name="download" type="anyURI"/>
- <element name="license" type="string"/>
- <element name="description" type="string"/>
- </all>
- </complexType>
-
- <complexType name="Owner">
- <all>
- <element name="id" type="int"/>
- <element name="email" type="anyURI"/>
- <element name="name" type="string"/>
- </all>
- </complexType>
-
- <complexType name="Info">
- <all>
- <element name="category" type="txd:Category"/>
- <element name="product" type="txd:Product"/>
- <element name="owner" type="txd:Owner"/>
- <element name="created" type="xsd:dateTime"/>
- <element name="updated" type="xsd:dateTime"/>
- </all>
- </complexType>
-
- <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
- <complexType name="InfoArray">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="txd:Info[]"/>
- </restriction>
- </complexContent>
- </complexType>
-
- <complexType name="StringArray">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
- </restriction>
- </complexContent>
- </complexType>
- </schema>
-
- <!-- type definition for ApacheSOAP's Map -->
- <schema
- xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://xml.apache.org/xml-soap">
- <complexType name="Map">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="key" type="anyType" />
- <element name="value" type="anyType" />
- </sequence>
- </complexType>
- </element>
- </sequence>
- </complexType>
- </schema>
- </types>
-
- <message name="getAllListingsRequest"/>
- <message name="getAllListingsResponse">
- <part name="return" type="txd:StringArray"/>
- </message>
-
- <message name="getProductTreeRequest"/>
- <message name="getProductTreeResponse">
- <part name="return" type="apachesoap:Map"/>
- </message>
-
- <message name="getInfoFromCategoryRequest">
- <part name="category" type="txd:Category"/>
- </message>
- <message name="getInfoFromCategoryResponse">
- <part name="return" type="txd:InfoArray"/>
- </message>
-
- <message name="getModifiedInfoSinceRequest">
- <part name="timeInstant" type="xsd:dateTime"/>
- </message>
- <message name="getModifiedInfoSinceResponse">
- <part name="return" type="txd:InfoArray"/>
- </message>
-
- <message name="getInfoFromNameRequest">
- <part name="productName" type="xsd:string"/>
- </message>
- <message name="getInfoFromNameResponse">
- <part name="return" type="txd:Info"/>
- </message>
-
- <message name="getInfoFromOwnerIdRequest">
- <part name="ownerId" type="xsd:int"/>
- </message>
- <message name="getInfoFromOwnerIdResponse">
- <part name="return" type="txd:InfoArray"/>
- </message>
-
- <portType name="RAABaseServicePortType">
- <operation name="getAllListings"
- parameterOrder="">
- <input message="tns:getAllListingsRequest"/>
- <output message="tns:getAllListingsResponse"/>
- </operation>
-
- <operation name="getProductTree"
- parameterOrder="">
- <input message="tns:getProductTreeRequest"/>
- <output message="tns:getProductTreeResponse"/>
- </operation>
-
- <operation name="getInfoFromCategory"
- parameterOrder="category">
- <input message="tns:getInfoFromCategoryRequest"/>
- <output message="tns:getInfoFromCategoryResponse"/>
- </operation>
-
- <operation name="getModifiedInfoSince"
- parameterOrder="timeInstant">
- <input message="tns:getModifiedInfoSinceRequest"/>
- <output message="tns:getModifiedInfoSinceResponse"/>
- </operation>
-
- <operation name="getInfoFromName"
- parameterOrder="productName">
- <input message="tns:getInfoFromNameRequest"/>
- <output message="tns:getInfoFromNameResponse"/>
- </operation>
-
- <operation name="getInfoFromOwnerId"
- parameterOrder="ownerId">
- <input message="tns:getInfoFromOwnerIdRequest"/>
- <output message="tns:getInfoFromOwnerIdResponse"/>
- </operation>
- </portType>
-
- <binding name="RAABaseServicePortBinding" type="tns:RAABaseServicePortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <operation name="getAllListings">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
-
- <operation name="getProductTree">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
-
- <operation name="getInfoFromCategory">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
-
- <operation name="getModifiedInfoSince">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
-
- <operation name="getInfoFromName">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
-
- <operation name="getInfoFromOwnerId">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
- </output>
- </operation>
- </binding>
-
- <service name="RAAService">
- <port name="RAABaseServicePort" binding="tns:RAABaseServicePortBinding">
- <soap:address location="http://raa.ruby-lang.org/soap/1.0.2/"/>
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/raa/server.rb b/test/wsdl/raa/server.rb
deleted file mode 100644
index 87bbc6f569..0000000000
--- a/test/wsdl/raa/server.rb
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/bin/env ruby
-require 'soap/rpc/standaloneServer'
-require 'RAA.rb'
-
-class RAABaseServicePortType
- MappingRegistry = SOAP::Mapping::Registry.new
-
- MappingRegistry.set(
- StringArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") }
- )
- MappingRegistry.set(
- Map,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://xml.apache.org/xml-soap", "Map") }
- )
- MappingRegistry.set(
- Category,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category") }
- )
- MappingRegistry.set(
- InfoArray,
- ::SOAP::SOAPArray,
- ::SOAP::Mapping::Registry::TypedArrayFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") }
- )
- MappingRegistry.set(
- Info,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") }
- )
- MappingRegistry.set(
- Product,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Product") }
- )
- MappingRegistry.set(
- Owner,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Owner") }
- )
-
- Methods = [
- ["getAllListings", "getAllListings", [
- ["retval", "return",
- [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
- ["getProductTree", "getProductTree", [
- ["retval", "return",
- [::SOAP::SOAPStruct, "http://xml.apache.org/xml-soap", "Map"]]],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
- ["getInfoFromCategory", "getInfoFromCategory", [
- ["in", "category",
- [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category"]],
- ["retval", "return",
- [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
- ["getModifiedInfoSince", "getModifiedInfoSince", [
- ["in", "timeInstant",
- [SOAP::SOAPDateTime]],
- ["retval", "return",
- [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
- ["getInfoFromName", "getInfoFromName", [
- ["in", "productName",
- [SOAP::SOAPString]],
- ["retval", "return",
- [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"],
- ["getInfoFromOwnerId", "getInfoFromOwnerId", [
- ["in", "ownerId",
- [SOAP::SOAPInt]],
- ["retval", "return",
- [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]],
- "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"]
- ]
-
- def getAllListings
- ["ruby", "soap4r"]
- end
-end
-
-class RAABaseServiceServer < SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super
-
- servant = RAABaseServicePortType.new
- RAABaseServicePortType::Methods.each do |name_as, name, params, soapaction, namespace|
- qname = XSD::QName.new(namespace, name_as)
- @router.add_method(servant, qname, soapaction, name, params)
- end
-
- self.mapping_registry = RAABaseServicePortType::MappingRegistry
- end
-end
diff --git a/test/wsdl/raa/test_raa.rb b/test/wsdl/raa/test_raa.rb
deleted file mode 100644
index 0b00042ffb..0000000000
--- a/test/wsdl/raa/test_raa.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-require 'test/unit'
-require 'soap/wsdlDriver'
-require 'RAA.rb'
-require 'RAAServant.rb'
-require 'RAAService.rb'
-
-
-module WSDL
-module RAA
-
-
-class TestRAA < Test::Unit::TestCase
- DIR = File.dirname(File.expand_path(__FILE__))
-
- Port = 17171
-
- def setup
- setup_server
- setup_client
- end
-
- def setup_server
- @server = App.new('RAA server', nil, '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- Thread.current.abort_on_exception = true
- @server.start
- }
- end
-
- def setup_client
- wsdl = File.join(DIR, 'raa.wsdl')
- @raa = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @raa.endpoint_url = "http://localhost:#{Port}/"
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @t.kill
- @t.join
- end
-
- def teardown_client
- @raa.reset_stream
- end
-
- def test_raa
- assert_equal(["ruby", "soap4r"], @raa.getAllListings)
- end
-
- def foo
- p @raa.getProductTree()
- p @raa.getInfoFromCategory(Category.new("Library", "XML"))
- t = Time.at(Time.now.to_i - 24 * 3600)
- p @raa.getModifiedInfoSince(t)
- p @raa.getModifiedInfoSince(DateTime.new(t.year, t.mon, t.mday, t.hour, t.min, t.sec))
- o = @raa.getInfoFromName("SOAP4R")
- p o.type
- p o.owner.name
- p o
- end
-end
-
-
-end
-end
diff --git a/test/wsdl/ref/expectedProduct.rb b/test/wsdl/ref/expectedProduct.rb
deleted file mode 100644
index 91c6e4c566..0000000000
--- a/test/wsdl/ref/expectedProduct.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-require 'xsd/qname'
-
-# {urn:product}Rating
-module Rating
- C_0 = "0"
- C_1 = "+1"
- C_1_2 = "-1"
-end
-
-# {urn:product}Product-Bag
-class ProductBag
- @@schema_type = "Product-Bag"
- @@schema_ns = "urn:product"
- @@schema_attribute = {XSD::QName.new("urn:product", "version") => "SOAP::SOAPString", XSD::QName.new("urn:product", "yesno") => "SOAP::SOAPString"}
- @@schema_element = [["bag", ["Product[]", XSD::QName.new(nil, "bag")]], ["rating", ["SOAP::SOAPString[]", XSD::QName.new("urn:product", "Rating")]], ["product_Bag", [nil, XSD::QName.new("urn:product", "Product-Bag")]], ["comment_1", [nil, XSD::QName.new(nil, "comment_1")]], ["comment_2", ["Comment[]", XSD::QName.new(nil, "comment-2")]]]
-
- attr_accessor :bag
- attr_accessor :product_Bag
- attr_accessor :comment_1
- attr_accessor :comment_2
-
- def Rating
- @rating
- end
-
- def Rating=(value)
- @rating = value
- end
-
- def xmlattr_version
- (@__xmlattr ||= {})[XSD::QName.new("urn:product", "version")]
- end
-
- def xmlattr_version=(value)
- (@__xmlattr ||= {})[XSD::QName.new("urn:product", "version")] = value
- end
-
- def xmlattr_yesno
- (@__xmlattr ||= {})[XSD::QName.new("urn:product", "yesno")]
- end
-
- def xmlattr_yesno=(value)
- (@__xmlattr ||= {})[XSD::QName.new("urn:product", "yesno")] = value
- end
-
- def initialize(bag = [], rating = [], product_Bag = nil, comment_1 = [], comment_2 = [])
- @bag = bag
- @rating = rating
- @product_Bag = product_Bag
- @comment_1 = comment_1
- @comment_2 = comment_2
- @__xmlattr = {}
- end
-end
-
-# {urn:product}Creator
-class Creator
- @@schema_type = "Creator"
- @@schema_ns = "urn:product"
- @@schema_element = []
-
- def initialize
- end
-end
-
-# {urn:product}Product
-class Product
- @@schema_type = "Product"
- @@schema_ns = "urn:product"
- @@schema_element = [["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], ["rating", ["SOAP::SOAPString", XSD::QName.new("urn:product", "Rating")]]]
-
- attr_accessor :name
-
- def Rating
- @rating
- end
-
- def Rating=(value)
- @rating = value
- end
-
- def initialize(name = nil, rating = nil)
- @name = name
- @rating = rating
- end
-end
-
-# {urn:product}Comment
-class Comment < String
-end
diff --git a/test/wsdl/ref/product.wsdl b/test/wsdl/ref/product.wsdl
deleted file mode 100644
index 993fe217aa..0000000000
--- a/test/wsdl/ref/product.wsdl
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<definitions name="product"
- targetNamespace="urn:product"
- xmlns:tns="urn:product"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="urn:product">
- <simpleType name="non-empty-string">
- <restriction base="xsd:string">
- <minLength value="1"/>
- </restriction>
- </simpleType>
-
- <complexType name="Product">
- <all>
- <element name="name" type="xsd:string"/>
- <element ref="tns:Rating"/>
- </all>
- </complexType>
-
- <complexType name="Comment">
- <simpleContent>
- <extension base="xsd:string">
- <attribute name="msgid" type="xsd:string" use="required"/>
- </extension>
- </simpleContent>
- </complexType>
-
- <attribute name="version" type="tns:non-empty-string"/>
-
- <attribute default="Y" name="yesno">
- <simpleType>
- <restriction base="xsd:string">
- <enumeration value="Y"/>
- <enumeration value="N"/>
- </restriction>
- </simpleType>
- </attribute>
-
- <element name="Rating">
- <simpleType>
- <restriction base="xsd:string">
- <enumeration value="+1"/>
- <enumeration value="0"/>
- <enumeration value="-1"/>
- </restriction>
- </simpleType>
- </element>
-
- <element name="Product-Bag">
- <complexType>
- <sequence>
- <element name="bag" type="tns:Product" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:Rating" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="tns:Product-Bag"/>
- <element name="comment_1" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <simpleContent>
- <extension base="xsd:string">
- <attribute name="msgid" type="xsd:string" use="required"/>
- </extension>
- </simpleContent>
- </complexType>
- </element>
- <element name="comment-2" type="tns:Comment" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute ref="tns:version"/>
- <attribute ref="tns:yesno"/>
- </complexType>
- </element>
-
- <element name="Creator" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <simpleContent>
- <extension base="xsd:string">
- <attribute name="Role" type="xs:string" use="required"/>
- </extension>
- </simpleContent>
- </complexType>
- </element>
- </xsd:schema>
- </types>
-</definitions>
diff --git a/test/wsdl/ref/test_ref.rb b/test/wsdl/ref/test_ref.rb
deleted file mode 100644
index 165a8643e9..0000000000
--- a/test/wsdl/ref/test_ref.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-require 'wsdl/soap/wsdl2ruby'
-
-
-module WSDL
-module Ref
-
-
-class TestRef < Test::Unit::TestCase
- DIR = File.dirname(File.expand_path(__FILE__))
- Port = 17171
-
- def test_classdef
- gen = WSDL::SOAP::WSDL2Ruby.new
- gen.location = pathname("product.wsdl")
- gen.basedir = DIR
- gen.logger.level = Logger::FATAL
- gen.opt['classdef'] = nil
- gen.opt['force'] = true
- gen.run
- compare("expectedProduct.rb", "product.rb")
- File.unlink(pathname('product.rb'))
- end
-
- def compare(expected, actual)
- assert_equal(loadfile(expected), loadfile(actual), actual)
- end
-
- def loadfile(file)
- File.open(pathname(file)) { |f| f.read }
- end
-
- def pathname(filename)
- File.join(DIR, filename)
- end
-end
-
-
-end
-end
diff --git a/test/wsdl/rpc/rpc.wsdl b/test/wsdl/rpc/rpc.wsdl
deleted file mode 100644
index b0ee5c5e56..0000000000
--- a/test/wsdl/rpc/rpc.wsdl
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions name="echo"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="urn:rpc"
- xmlns:txd="urn:rpc-type"
- targetNamespace="urn:rpc"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema targetNamespace="urn:rpc-type">
- <xsd:complexType name="person">
- <xsd:all>
- <xsd:element name="family-name" type="xsd:string" />
- <xsd:element name="given_name" type="xsd:string" />
- <xsd:element name="age" type="xsd:int" />
- <xsd:element name="link" type="txd:person" />
- </xsd:all>
- </xsd:complexType>
- </xsd:schema>
- </types>
-
- <message name="echo_in">
- <part name="arg1" type="txd:person"/>
- <part name="arg2" type="txd:person"/>
- </message>
-
- <message name="echo_out">
- <part name="return" type="txd:person"/>
- </message>
-
- <portType name="echo_port_type">
- <operation name="echo">
- <input message="tns:echo_in"/>
- <output message="tns:echo_out"/>
- </operation>
-
- <operation name="echo_err">
- <input message="tns:echo_in"/>
- <output message="tns:echo_out"/>
- </operation>
- </portType>
-
- <binding name="echo_binding" type="tns:echo_port_type">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
- <operation name="echo">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded" namespace="urn:rpc"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="urn:rpc"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
-
- <operation name="echo_err">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded" namespace="urn:rpc"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="urn:rpc"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- </binding>
-
- <service name="echo_service">
- <port name="echo_port" binding="tns:echo_binding">
- <soap:address location="http://localhost:10080"/>
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/rpc/test-rpc-lit.wsdl b/test/wsdl/rpc/test-rpc-lit.wsdl
deleted file mode 100644
index 72de747e36..0000000000
--- a/test/wsdl/rpc/test-rpc-lit.wsdl
+++ /dev/null
@@ -1,364 +0,0 @@
-<?xml version="1.0"?>
-
-<definitions name="RPC-Literal-TestDefinitions"
- targetNamespace="http://whitemesa.net/wsdl/rpc-lit-test"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="http://whitemesa.net/wsdl/rpc-lit-test"
- xmlns:types="http://soapbuilders.org/rpc-lit-test/types"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://soapbuilders.org/rpc-lit-test/types">
-
- <element name="stringItem" type="xsd:string" />
- <complexType name="ArrayOfstring">
- <sequence>
- <element ref="types:stringItem" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-
- <complexType name="ArrayOfstringInline">
- <sequence>
- <element name="stringItem" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-
- <complexType name="ArrayOfint">
- <sequence>
- <element name="integer" type="xsd:int" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-
- <element name="structItem" type="types:SOAPStruct" />
- <complexType name="SOAPStruct">
- <all>
- <element name="varString" type="xsd:string"/>
- <element name="varInt" type="xsd:int"/>
- <element name="varFloat" type="xsd:float"/>
- </all>
- </complexType>
-
- <complexType name="ArrayOfSOAPStruct">
- <sequence>
- <element ref="types:structItem" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-
- <complexType name="SOAPStructStruct">
- <all>
- <element name="varString" type="xsd:string"/>
- <element name="varInt" type="xsd:int"/>
- <element name="varFloat" type="xsd:float"/>
- <element ref="types:structItem" />
- </all>
- </complexType>
-
- <complexType name="SOAPArrayStruct">
- <all>
- <element name="varString" type="xsd:string"/>
- <element name="varInt" type="xsd:int"/>
- <element name="varFloat" type="xsd:float"/>
- <element name="varArray" type="types:ArrayOfstring"/>
- </all>
- </complexType>
-
- </schema>
-
- </types>
-
- <!-- echoStruct rpc operation -->
- <message name="echoStructRequest">
- <part name="inputStruct" type="types:SOAPStruct"/>
- </message>
- <message name="echoStructResponse">
- <part name="return" type="types:SOAPStruct"/>
- </message>
-
- <!-- echoStructArray rpc operation -->
- <message name="echoStructArrayRequest">
- <part name="inputStructArray" type="types:ArrayOfSOAPStruct"/>
- </message>
- <message name="echoStructArrayResponse">
- <part name="return" type="types:ArrayOfSOAPStruct"/>
- </message>
-
- <!-- echoStructAsSimpleTypes rpc operation -->
- <message name="echoStructAsSimpleTypesRequest">
- <part name="inputStruct" type="types:SOAPStruct"/>
- </message>
- <message name="echoStructAsSimpleTypesResponse">
- <part name="outputString" type="xsd:string"/>
- <part name="outputInteger" type="xsd:int"/>
- <part name="outputFloat" type="xsd:float"/>
- </message>
-
- <!-- echoSimpleTypesAsStruct rpc operation -->
- <message name="echoSimpleTypesAsStructRequest">
- <part name="inputString" type="xsd:string"/>
- <part name="inputInteger" type="xsd:int"/>
- <part name="inputFloat" type="xsd:float"/>
- </message>
- <message name="echoSimpleTypesAsStructResponse">
- <part name="return" type="types:SOAPStruct"/>
- </message>
-
- <!-- echoNestedStruct rpc operation -->
- <message name="echoNestedStructRequest">
- <part name="inputStruct" type="types:SOAPStructStruct"/>
- </message>
- <message name="echoNestedStructResponse">
- <part name="return" type="types:SOAPStructStruct"/>
- </message>
-
- <!-- echoNestedArray rpc operation -->
- <message name="echoNestedArrayRequest">
- <part name="inputStruct" type="types:SOAPArrayStruct"/>
- </message>
- <message name="echoNestedArrayResponse">
- <part name="return" type="types:SOAPArrayStruct"/>
- </message>
-
- <!-- echoStringArray rpc operation -->
- <message name="echoStringArrayRequest">
- <part name="inputStringArray" type="types:ArrayOfstring"/>
- </message>
- <message name="echoStringArrayResponse">
- <part name="return" type="types:ArrayOfstring"/>
- </message>
-
- <message name="echoStringArrayInlineRequest">
- <part name="inputStringArray" type="types:ArrayOfstringInline"/>
- </message>
- <message name="echoStringArrayInlineResponse">
- <part name="return" type="types:ArrayOfstringInline"/>
- </message>
-
- <!-- echoIntegerArray rpc operation -->
- <message name="echoIntegerArrayRequest">
- <part name="inputIntegerArray" type="types:ArrayOfint"/>
- </message>
- <message name="echoIntegerArrayResponse">
- <part name="return" type="types:ArrayOfint"/>
- </message>
-
- <!-- echoBoolean rpc operation -->
- <message name="echoBooleanRequest">
- <part name="inputBoolean" type="xsd:boolean"/>
- </message>
- <message name="echoBooleanResponse">
- <part name="return" type="xsd:boolean"/>
- </message>
-
- <!-- echoString rpc operation -->
- <message name="echoStringRequest">
- <part name="inputString" type="xsd:string"/>
- </message>
- <message name="echoStringResponse">
- <part name="return" type="xsd:string"/>
- </message>
-
-
- <portType name="SoapTestPortTypeRpc">
-
- <!-- echoStruct rpc operation -->
- <operation name="echoStruct" parameterOrder="inputStruct">
- <input message="tns:echoStructRequest"/>
- <output message="tns:echoStructResponse"/>
- </operation>
-
- <!-- echoStructArray rpc operation -->
- <operation name="echoStructArray" parameterOrder="inputStructArray">
- <input message="tns:echoStructArrayRequest"/>
- <output message="tns:echoStructArrayResponse"/>
- </operation>
-
- <!-- echoStructAsSimpleTypes rpc operation -->
- <operation name="echoStructAsSimpleTypes" parameterOrder="inputStruct outputString outputInteger outputFloat">
- <input message="tns:echoStructAsSimpleTypesRequest"/>
- <output message="tns:echoStructAsSimpleTypesResponse"/>
- </operation>
-
- <!-- echoSimpleTypesAsStruct rpc operation -->
- <operation name="echoSimpleTypesAsStruct" parameterOrder="inputString inputInteger inputFloat">
- <input message="tns:echoSimpleTypesAsStructRequest"/>
- <output message="tns:echoSimpleTypesAsStructResponse"/>
- </operation>
-
- <!-- echoNestedStruct rpc operation -->
- <operation name="echoNestedStruct" parameterOrder="inputStruct">
- <input message="tns:echoNestedStructRequest"/>
- <output message="tns:echoNestedStructResponse"/>
- </operation>
-
- <!-- echoNestedArray rpc operation -->
- <operation name="echoNestedArray" parameterOrder="inputStruct">
- <input message="tns:echoNestedArrayRequest"/>
- <output message="tns:echoNestedArrayResponse"/>
- </operation>
-
- <!-- echoStringArray rpc operation -->
- <operation name="echoStringArray" parameterOrder="inputStringArray">
- <input message="tns:echoStringArrayRequest"/>
- <output message="tns:echoStringArrayResponse"/>
- </operation>
-
- <operation name="echoStringArrayInline" parameterOrder="inputStringArray">
- <input message="tns:echoStringArrayInlineRequest"/>
- <output message="tns:echoStringArrayInlineResponse"/>
- </operation>
-
- <!-- echoIntegerArray rpc operation -->
- <operation name="echoIntegerArray" parameterOrder="inputIntegerArray">
- <input message="tns:echoIntegerArrayRequest"/>
- <output message="tns:echoIntegerArrayResponse"/>
- </operation>
-
- <!-- echoBoolean rpc operation -->
- <operation name="echoBoolean" parameterOrder="inputBoolean">
- <input message="tns:echoBooleanRequest"/>
- <output message="tns:echoBooleanResponse"/>
- </operation>
-
- <!-- echoString rpc operation -->
- <operation name="echoString" parameterOrder="inputString">
- <input message="tns:echoStringRequest"/>
- <output message="tns:echoStringResponse"/>
- </operation>
-
- </portType>
-
- <binding name="Soap11TestRpcLitBinding" type="tns:SoapTestPortTypeRpc">
- <soap11:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <!-- echoStruct rpc operation -->
- <operation name="echoStruct">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoStructArray rpc operation -->
- <operation name="echoStructArray">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoStructAsSimpleTypes rpc operation -->
- <operation name="echoStructAsSimpleTypes">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoSimpleTypesAsStruct rpc operation -->
- <operation name="echoSimpleTypesAsStruct">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoNestedStruct rpc operation -->
- <operation name="echoNestedStruct">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoNestedArray rpc operation -->
- <operation name="echoNestedArray">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoStringArray rpc operation -->
- <operation name="echoStringArray">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <operation name="echoStringArrayInline">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoIntegerArray rpc operation -->
- <operation name="echoIntegerArray">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoBoolean rpc operation -->
- <operation name="echoBoolean">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoString rpc operation -->
- <operation name="echoString">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- </binding>
-
- <service name="WhiteMesaSoapRpcLitTestSvc">
-
- <port name="Soap11TestRpcLitPort" binding="tns:Soap11TestRpcLitBinding">
- <soap11:address location="http://www.whitemesa.net/test-rpc-lit"/>
- </port>
-
- </service>
-
-</definitions>
diff --git a/test/wsdl/rpc/test-rpc-lit12.wsdl b/test/wsdl/rpc/test-rpc-lit12.wsdl
deleted file mode 100644
index 901cde6f9c..0000000000
--- a/test/wsdl/rpc/test-rpc-lit12.wsdl
+++ /dev/null
@@ -1,455 +0,0 @@
-<?xml version="1.0"?>
-
-<definitions name="RPC-Literal-TestDefinitions"
- targetNamespace="http://whitemesa.net/wsdl/rpc-lit-test"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
- xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="http://whitemesa.net/wsdl/rpc-lit-test"
- xmlns:types="http://soapbuilders.org/rpc-lit-test/types"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://soapbuilders.org/rpc-lit-test/types">
-
- <element name="stringItem" type="xsd:string" />
- <complexType name="ArrayOfstring">
- <sequence>
- <element ref="types:stringItem" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-
- <complexType name="ArrayOfint">
- <sequence>
- <element name="integer" type="xsd:int" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-
- <element name="structItem" type="types:SOAPStruct" />
- <complexType name="SOAPStruct">
- <all>
- <element name="varString" type="xsd:string"/>
- <element name="varInt" type="xsd:int"/>
- <element name="varFloat" type="xsd:float"/>
- </all>
- </complexType>
-
- <complexType name="ArrayOfSOAPStruct">
- <sequence>
- <element ref="types:structItem" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-
- <complexType name="SOAPStructStruct">
- <all>
- <element name="varString" type="xsd:string"/>
- <element name="varInt" type="xsd:int"/>
- <element name="varFloat" type="xsd:float"/>
- <element ref="types:structItem" />
- </all>
- </complexType>
-
- <complexType name="SOAPArrayStruct">
- <all>
- <element name="varString" type="xsd:string"/>
- <element name="varInt" type="xsd:int"/>
- <element name="varFloat" type="xsd:float"/>
- <element name="varArray" type="types:ArrayOfstring"/>
- </all>
- </complexType>
-
- </schema>
-
- </types>
-
- <!-- echoStruct rpc operation -->
- <message name="echoStructRequest">
- <part name="inputStruct" type="types:SOAPStruct"/>
- </message>
- <message name="echoStructResponse">
- <part name="return" type="types:SOAPStruct"/>
- </message>
-
- <!-- echoStructArray rpc operation -->
- <message name="echoStructArrayRequest">
- <part name="inputStructArray" type="types:ArrayOfSOAPStruct"/>
- </message>
- <message name="echoStructArrayResponse">
- <part name="return" type="types:ArrayOfSOAPStruct"/>
- </message>
-
- <!-- echoStructAsSimpleTypes rpc operation -->
- <message name="echoStructAsSimpleTypesRequest">
- <part name="inputStruct" type="types:SOAPStruct"/>
- </message>
- <message name="echoStructAsSimpleTypesResponse">
- <part name="outputString" type="xsd:string"/>
- <part name="outputInteger" type="xsd:int"/>
- <part name="outputFloat" type="xsd:float"/>
- </message>
-
- <!-- echoSimpleTypesAsStruct rpc operation -->
- <message name="echoSimpleTypesAsStructRequest">
- <part name="inputString" type="xsd:string"/>
- <part name="inputInteger" type="xsd:int"/>
- <part name="inputFloat" type="xsd:float"/>
- </message>
- <message name="echoSimpleTypesAsStructResponse">
- <part name="return" type="types:SOAPStruct"/>
- </message>
-
- <!-- echoNestedStruct rpc operation -->
- <message name="echoNestedStructRequest">
- <part name="inputStruct" type="types:SOAPStructStruct"/>
- </message>
- <message name="echoNestedStructResponse">
- <part name="return" type="types:SOAPStructStruct"/>
- </message>
-
- <!-- echoNestedArray rpc operation -->
- <message name="echoNestedArrayRequest">
- <part name="inputStruct" type="types:SOAPArrayStruct"/>
- </message>
- <message name="echoNestedArrayResponse">
- <part name="return" type="types:SOAPArrayStruct"/>
- </message>
-
- <!-- echoStringArray rpc operation -->
- <message name="echoStringArrayRequest">
- <part name="inputStringArray" type="types:ArrayOfstring"/>
- </message>
- <message name="echoStringArrayResponse">
- <part name="return" type="types:ArrayOfstring"/>
- </message>
-
- <!-- echoIntegerArray rpc operation -->
- <message name="echoIntegerArrayRequest">
- <part name="inputIntegerArray" type="types:ArrayOfint"/>
- </message>
- <message name="echoIntegerArrayResponse">
- <part name="return" type="types:ArrayOfint"/>
- </message>
-
- <!-- echoBoolean rpc operation -->
- <message name="echoBooleanRequest">
- <part name="inputBoolean" type="xsd:boolean"/>
- </message>
- <message name="echoBooleanResponse">
- <part name="return" type="xsd:boolean"/>
- </message>
-
- <!-- echoString rpc operation -->
- <message name="echoStringRequest">
- <part name="inputString" type="xsd:string"/>
- </message>
- <message name="echoStringResponse">
- <part name="return" type="xsd:string"/>
- </message>
-
-
- <portType name="SoapTestPortTypeRpc">
-
- <!-- echoStruct rpc operation -->
- <operation name="echoStruct" parameterOrder="inputStruct">
- <input message="tns:echoStructRequest"/>
- <output message="tns:echoStructResponse"/>
- </operation>
-
- <!-- echoStructArray rpc operation -->
- <operation name="echoStructArray" parameterOrder="inputStructArray">
- <input message="tns:echoStructArrayRequest"/>
- <output message="tns:echoStructArrayResponse"/>
- </operation>
-
- <!-- echoStructAsSimpleTypes rpc operation -->
- <operation name="echoStructAsSimpleTypes" parameterOrder="inputStruct outputString outputInteger outputFloat">
- <input message="tns:echoStructAsSimpleTypesRequest"/>
- <output message="tns:echoStructAsSimpleTypesResponse"/>
- </operation>
-
- <!-- echoSimpleTypesAsStruct rpc operation -->
- <operation name="echoSimpleTypesAsStruct" parameterOrder="inputString inputInteger inputFloat">
- <input message="tns:echoSimpleTypesAsStructRequest"/>
- <output message="tns:echoSimpleTypesAsStructResponse"/>
- </operation>
-
- <!-- echoNestedStruct rpc operation -->
- <operation name="echoNestedStruct" parameterOrder="inputStruct">
- <input message="tns:echoNestedStructRequest"/>
- <output message="tns:echoNestedStructResponse"/>
- </operation>
-
- <!-- echoNestedArray rpc operation -->
- <operation name="echoNestedArray" parameterOrder="inputStruct">
- <input message="tns:echoNestedArrayRequest"/>
- <output message="tns:echoNestedArrayResponse"/>
- </operation>
-
- <!-- echoStringArray rpc operation -->
- <operation name="echoStringArray" parameterOrder="inputStringArray">
- <input message="tns:echoStringArrayRequest"/>
- <output message="tns:echoStringArrayResponse"/>
- </operation>
-
- <!-- echoIntegerArray rpc operation -->
- <operation name="echoIntegerArray" parameterOrder="inputIntegerArray">
- <input message="tns:echoIntegerArrayRequest"/>
- <output message="tns:echoIntegerArrayResponse"/>
- </operation>
-
- <!-- echoBoolean rpc operation -->
- <operation name="echoBoolean" parameterOrder="inputBoolean">
- <input message="tns:echoBooleanRequest"/>
- <output message="tns:echoBooleanResponse"/>
- </operation>
-
- <!-- echoString rpc operation -->
- <operation name="echoString" parameterOrder="inputString">
- <input message="tns:echoStringRequest"/>
- <output message="tns:echoStringResponse"/>
- </operation>
-
- </portType>
-
- <binding name="Soap11TestRpcLitBinding" type="tns:SoapTestPortTypeRpc">
- <soap11:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <!-- echoStruct rpc operation -->
- <operation name="echoStruct">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoStructArray rpc operation -->
- <operation name="echoStructArray">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoStructAsSimpleTypes rpc operation -->
- <operation name="echoStructAsSimpleTypes">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoSimpleTypesAsStruct rpc operation -->
- <operation name="echoSimpleTypesAsStruct">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoNestedStruct rpc operation -->
- <operation name="echoNestedStruct">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoNestedArray rpc operation -->
- <operation name="echoNestedArray">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoStringArray rpc operation -->
- <operation name="echoStringArray">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoIntegerArray rpc operation -->
- <operation name="echoIntegerArray">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoBoolean rpc operation -->
- <operation name="echoBoolean">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoString rpc operation -->
- <operation name="echoString">
- <soap11:operation soapAction="http://soapinterop.org/"/>
- <input>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- </binding>
-
- <binding name="Soap12TestRpcLitBinding" type="tns:SoapTestPortTypeRpc">
- <soap12:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <!-- echoStruct rpc operation -->
- <operation name="echoStruct">
- <soap12:operation/>
- <input>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoStructArray rpc operation -->
- <operation name="echoStructArray">
- <soap12:operation/>
- <input>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoStructAsSimpleTypes rpc operation -->
- <operation name="echoStructAsSimpleTypes">
- <soap12:operation/>
- <input>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoSimpleTypesAsStruct rpc operation -->
- <operation name="echoSimpleTypesAsStruct">
- <soap12:operation/>
- <input>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoNestedStruct rpc operation -->
- <operation name="echoNestedStruct">
- <soap12:operation/>
- <input>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoNestedArray rpc operation -->
- <operation name="echoNestedArray">
- <soap12:operation/>
- <input>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoStringArray rpc operation -->
- <operation name="echoStringArray">
- <soap12:operation/>
- <input>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoIntegerArray rpc operation -->
- <operation name="echoIntegerArray">
- <soap12:operation/>
- <input>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoBoolean rpc operation -->
- <operation name="echoBoolean">
- <soap12:operation/>
- <input>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- <!-- echoString rpc operation -->
- <operation name="echoString">
- <soap12:operation/>
- <input>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </input>
- <output>
- <soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
- </output>
- </operation>
-
- </binding>
-
- <service name="WhiteMesaSoapRpcLitTestSvc">
-
- <port name="Soap12TestRpcLitPort" binding="tns:Soap12TestRpcLitBinding">
- <soap12:address location="http://www.whitemesa.net/soap12/test-rpc-lit"/>
- </port>
- <port name="Soap11TestRpcLitPort" binding="tns:Soap11TestRpcLitBinding">
- <soap11:address location="http://www.whitemesa.net/test-rpc-lit"/>
- </port>
-
- </service>
-
-</definitions>
diff --git a/test/wsdl/rpc/test_rpc.rb b/test/wsdl/rpc/test_rpc.rb
deleted file mode 100644
index 7c4c3a7ad6..0000000000
--- a/test/wsdl/rpc/test_rpc.rb
+++ /dev/null
@@ -1,118 +0,0 @@
-require 'test/unit'
-require 'wsdl/parser'
-require 'wsdl/soap/wsdl2ruby'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-
-
-module WSDL; module RPC
-
-
-class TestRPC < Test::Unit::TestCase
- class Server < ::SOAP::RPC::StandaloneServer
- def on_init
- self.generate_explicit_type = false
- add_rpc_method(self, 'echo', 'arg1', 'arg2')
- add_rpc_method(self, 'echo_err', 'arg1', 'arg2')
- end
-
- DummyPerson = Struct.new("family-name".intern, :given_name)
- def echo(arg1, arg2)
- case arg1.family_name
- when 'normal'
- arg1.family_name = arg2.family_name
- arg1.given_name = arg2.given_name
- arg1.age = arg2.age
- arg1
- when 'dummy'
- DummyPerson.new("family-name", "given_name")
- else
- raise
- end
- end
-
- ErrPerson = Struct.new(:given_name, :no_such_element)
- def echo_err(arg1, arg2)
- ErrPerson.new(58, Time.now)
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
-
- Port = 17171
-
- def setup
- setup_server
- setup_classdef
- @client = nil
- end
-
- def teardown
- teardown_server
- File.unlink(pathname('echo.rb'))
- @client.reset_stream if @client
- end
-
- def setup_server
- @server = Server.new('Test', "urn:rpc", '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_classdef
- gen = WSDL::SOAP::WSDL2Ruby.new
- gen.location = pathname("rpc.wsdl")
- gen.basedir = DIR
- gen.logger.level = Logger::FATAL
- gen.opt['classdef'] = nil
- gen.opt['force'] = true
- gen.run
- require pathname('echo')
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def pathname(filename)
- File.join(DIR, filename)
- end
-
- def test_wsdl
- wsdl = File.join(DIR, 'rpc.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = STDOUT if $DEBUG
-
- ret = @client.echo(Person.new("normal", "", 12), Person.new("Hi", "Na", 21))
- assert_equal(Person, ret.class)
- assert_equal("Hi", ret.family_name)
- assert_equal("Na", ret.given_name)
- assert_equal(21, ret.age)
-
- ret = @client.echo(Person.new("dummy", "", 12), Person.new("Hi", "Na", 21))
- assert_equal(Person, ret.class)
- assert_equal("family-name", ret.family_name)
- assert_equal("given_name", ret.given_name)
- assert_equal(nil, ret.age)
-
- ret = @client.echo_err(Person.new("Na", "Hi"), Person.new("Hi", "Na"))
- assert_equal(Person, ret.class)
- assert_equal("58", ret.given_name)
- assert_equal(nil, ret.family_name)
- assert_equal(nil, ret.age)
- end
-end
-
-
-end; end
diff --git a/test/wsdl/rpc/test_rpc_lit.rb b/test/wsdl/rpc/test_rpc_lit.rb
deleted file mode 100644
index 080dbb82cf..0000000000
--- a/test/wsdl/rpc/test_rpc_lit.rb
+++ /dev/null
@@ -1,399 +0,0 @@
-require 'test/unit'
-require 'wsdl/soap/wsdl2ruby'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-
-if defined?(HTTPAccess2) and defined?(OpenSSL)
-
-module WSDL; module RPC
-
-
-class TestRPCLIT < Test::Unit::TestCase
- class Server < ::SOAP::RPC::StandaloneServer
- Namespace = "http://soapbuilders.org/rpc-lit-test"
-
- def on_init
- self.generate_explicit_type = false
- add_rpc_operation(self,
- XSD::QName.new(Namespace, 'echoStringArray'),
- nil,
- 'echoStringArray', [
- ['in', 'inputStringArray', nil],
- ['retval', 'return', nil]
- ],
- {
- :request_style => :rpc,
- :request_use => :literal,
- :response_style => :rpc,
- :response_use => :literal
- }
- )
- add_rpc_operation(self,
- XSD::QName.new(Namespace, 'echoStringArrayInline'),
- nil,
- 'echoStringArrayInline', [
- ['in', 'inputStringArray', nil],
- ['retval', 'return', nil]
- ],
- {
- :request_style => :rpc,
- :request_use => :literal,
- :response_style => :rpc,
- :response_use => :literal
- }
- )
- add_rpc_operation(self,
- XSD::QName.new(Namespace, 'echoNestedStruct'),
- nil,
- 'echoNestedStruct', [
- ['in', 'inputNestedStruct', nil],
- ['retval', 'return', nil]
- ],
- {
- :request_style => :rpc,
- :request_use => :literal,
- :response_style => :rpc,
- :response_use => :literal
- }
- )
- add_rpc_operation(self,
- XSD::QName.new(Namespace, 'echoStructArray'),
- nil,
- 'echoStructArray', [
- ['in', 'inputStructArray', nil],
- ['retval', 'return', nil]
- ],
- {
- :request_style => :rpc,
- :request_use => :literal,
- :response_style => :rpc,
- :response_use => :literal
- }
- )
- end
-
- def echoStringArray(strings)
- # strings.stringItem => Array
- ArrayOfstring[*strings.stringItem]
- end
-
- def echoStringArrayInline(strings)
- ArrayOfstringInline[*strings.stringItem]
- end
-
- def echoNestedStruct(struct)
- struct
- end
-
- def echoStructArray(ary)
- ary
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
-
- Port = 17171
-
- def setup
- setup_server
- setup_classdef
- @client = nil
- end
-
- def teardown
- teardown_server
- unless $DEBUG
- File.unlink(pathname('RPC-Literal-TestDefinitions.rb'))
- File.unlink(pathname('RPC-Literal-TestDefinitionsDriver.rb'))
- end
- @client.reset_stream if @client
- end
-
- def setup_server
- @server = Server.new('Test', Server::Namespace, '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_classdef
- gen = WSDL::SOAP::WSDL2Ruby.new
- gen.location = pathname("test-rpc-lit.wsdl")
- gen.basedir = DIR
- gen.logger.level = Logger::FATAL
- gen.opt['classdef'] = nil
- gen.opt['driver'] = nil
- gen.opt['force'] = true
- gen.run
- backupdir = Dir.pwd
- begin
- Dir.chdir(DIR)
- require pathname('RPC-Literal-TestDefinitions.rb')
- require pathname('RPC-Literal-TestDefinitionsDriver.rb')
- ensure
- Dir.chdir(backupdir)
- end
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def pathname(filename)
- File.join(DIR, filename)
- end
-
- def test_wsdl_echoStringArray
- wsdl = pathname('test-rpc-lit.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = STDOUT if $DEBUG
- # response contains only 1 part.
- result = @client.echoStringArray(ArrayOfstring["a", "b", "c"])[0]
- assert_equal(["a", "b", "c"], result.stringItem)
- end
-
- ECHO_STRING_ARRAY_REQUEST =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:echoStringArray xmlns:n1="http://soapbuilders.org/rpc-lit-test">
- <inputStringArray xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
- <n2:stringItem>a</n2:stringItem>
- <n2:stringItem>b</n2:stringItem>
- <n2:stringItem>c</n2:stringItem>
- </inputStringArray>
- </n1:echoStringArray>
- </env:Body>
-</env:Envelope>]
-
- ECHO_STRING_ARRAY_RESPONSE =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:echoStringArrayResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test">
- <return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
- <n2:stringItem>a</n2:stringItem>
- <n2:stringItem>b</n2:stringItem>
- <n2:stringItem>c</n2:stringItem>
- </return>
- </n1:echoStringArrayResponse>
- </env:Body>
-</env:Envelope>]
-
- def test_stub_echoStringArray
- drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/")
- drv.wiredump_dev = str = ''
- # response contains only 1 part.
- result = drv.echoStringArray(ArrayOfstring["a", "b", "c"])[0]
- assert_equal(["a", "b", "c"], result.stringItem)
- assert_equal(ECHO_STRING_ARRAY_REQUEST, parse_requestxml(str))
- assert_equal(ECHO_STRING_ARRAY_RESPONSE, parse_responsexml(str))
- end
-
- ECHO_STRING_ARRAY_INLINE_REQUEST =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:echoStringArrayInline xmlns:n1="http://soapbuilders.org/rpc-lit-test">
- <inputStringArray>
- <stringItem>a</stringItem>
- <stringItem>b</stringItem>
- <stringItem>c</stringItem>
- </inputStringArray>
- </n1:echoStringArrayInline>
- </env:Body>
-</env:Envelope>]
-
- ECHO_STRING_ARRAY_INLINE_RESPONSE =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:echoStringArrayInlineResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test">
- <return>
- <stringItem>a</stringItem>
- <stringItem>b</stringItem>
- <stringItem>c</stringItem>
- </return>
- </n1:echoStringArrayInlineResponse>
- </env:Body>
-</env:Envelope>]
-
- def test_stub_echoStringArrayInline
- drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/")
- drv.wiredump_dev = str = ''
- # response contains only 1 part.
- result = drv.echoStringArrayInline(ArrayOfstringInline["a", "b", "c"])[0]
- assert_equal(["a", "b", "c"], result.stringItem)
- assert_equal(ECHO_STRING_ARRAY_INLINE_REQUEST, parse_requestxml(str))
- assert_equal(ECHO_STRING_ARRAY_INLINE_RESPONSE, parse_responsexml(str))
- end
-
- ECHO_NESTED_STRUCT_REQUEST =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:echoNestedStruct xmlns:n1="http://soapbuilders.org/rpc-lit-test">
- <inputStruct xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
- <varString>str</varString>
- <varInt>1</varInt>
- <varFloat>+1</varFloat>
- <n2:structItem>
- <varString>str</varString>
- <varInt>1</varInt>
- <varFloat>+1</varFloat>
- </n2:structItem>
- </inputStruct>
- </n1:echoNestedStruct>
- </env:Body>
-</env:Envelope>]
-
- ECHO_NESTED_STRUCT_RESPONSE =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:echoNestedStructResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test">
- <return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
- <varString>str</varString>
- <varInt>1</varInt>
- <varFloat>+1</varFloat>
- <n2:structItem>
- <varString>str</varString>
- <varInt>1</varInt>
- <varFloat>+1</varFloat>
- </n2:structItem>
- </return>
- </n1:echoNestedStructResponse>
- </env:Body>
-</env:Envelope>]
-
- def test_wsdl_echoNestedStruct
- wsdl = pathname('test-rpc-lit.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = str = ''
- # response contains only 1 part.
- result = @client.echoNestedStruct(SOAPStructStruct.new("str", 1, 1.0, SOAPStruct.new("str", 1, 1.0)))[0]
- assert_equal('str', result.varString)
- assert_equal('1', result.varInt)
- assert_equal('+1', result.varFloat)
- assert_equal('str', result.structItem.varString)
- assert_equal('1', result.structItem.varInt)
- assert_equal('+1', result.structItem.varFloat)
- assert_equal(ECHO_NESTED_STRUCT_REQUEST, parse_requestxml(str))
- assert_equal(ECHO_NESTED_STRUCT_RESPONSE, parse_responsexml(str))
- end
-
- def test_stub_echoNestedStruct
- drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/")
- drv.wiredump_dev = str = ''
- # response contains only 1 part.
- result = drv.echoNestedStruct(SOAPStructStruct.new("str", 1, 1.0, SOAPStruct.new("str", 1, 1.0)))[0]
- assert_equal('str', result.varString)
- assert_equal('1', result.varInt)
- assert_equal('+1', result.varFloat)
- assert_equal('str', result.structItem.varString)
- assert_equal('1', result.structItem.varInt)
- assert_equal('+1', result.structItem.varFloat)
- assert_equal(ECHO_NESTED_STRUCT_REQUEST, parse_requestxml(str))
- assert_equal(ECHO_NESTED_STRUCT_RESPONSE, parse_responsexml(str))
- end
-
- ECHO_STRUCT_ARRAY_REQUEST =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:echoStructArray xmlns:n1="http://soapbuilders.org/rpc-lit-test">
- <inputStructArray xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
- <n2:structItem>
- <varString>str</varString>
- <varInt>2</varInt>
- <varFloat>+2.1</varFloat>
- </n2:structItem>
- <n2:structItem>
- <varString>str</varString>
- <varInt>2</varInt>
- <varFloat>+2.1</varFloat>
- </n2:structItem>
- </inputStructArray>
- </n1:echoStructArray>
- </env:Body>
-</env:Envelope>]
-
- ECHO_STRUCT_ARRAY_RESPONSE =
-%q[<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <n1:echoStructArrayResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test">
- <return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
- <n2:structItem>
- <varString>str</varString>
- <varInt>2</varInt>
- <varFloat>+2.1</varFloat>
- </n2:structItem>
- <n2:structItem>
- <varString>str</varString>
- <varInt>2</varInt>
- <varFloat>+2.1</varFloat>
- </n2:structItem>
- </return>
- </n1:echoStructArrayResponse>
- </env:Body>
-</env:Envelope>]
-
- def test_wsdl_echoStructArray
- wsdl = pathname('test-rpc-lit.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = str = ''
- # response contains only 1 part.
- e = SOAPStruct.new("str", 2, 2.1)
- result = @client.echoStructArray(ArrayOfSOAPStruct[e, e])
- assert_equal(ECHO_STRUCT_ARRAY_REQUEST, parse_requestxml(str))
- assert_equal(ECHO_STRUCT_ARRAY_RESPONSE, parse_responsexml(str))
- end
-
- def test_stub_echoStructArray
- drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/")
- drv.wiredump_dev = str = ''
- # response contains only 1 part.
- e = SOAPStruct.new("str", 2, 2.1)
- result = drv.echoStructArray(ArrayOfSOAPStruct[e, e])
- assert_equal(ECHO_STRUCT_ARRAY_REQUEST, parse_requestxml(str))
- assert_equal(ECHO_STRUCT_ARRAY_RESPONSE, parse_responsexml(str))
- end
-
- def parse_requestxml(str)
- str.split(/\r?\n\r?\n/)[3]
- end
-
- def parse_responsexml(str)
- str.split(/\r?\n\r?\n/)[6]
- end
-end
-
-
-end; end
-
-end
diff --git a/test/wsdl/simpletype/rpc/expectedClient.rb b/test/wsdl/simpletype/rpc/expectedClient.rb
deleted file mode 100644
index 55eb58c3dd..0000000000
--- a/test/wsdl/simpletype/rpc/expectedClient.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env ruby
-require 'echo_versionDriver.rb'
-
-endpoint_url = ARGV.shift
-obj = Echo_version_port_type.new(endpoint_url)
-
-# run ruby with -d to see SOAP wiredumps.
-obj.wiredump_dev = STDERR if $DEBUG
-
-# SYNOPSIS
-# echo_version(version)
-#
-# ARGS
-# version Version - {urn:example.com:simpletype-rpc-type}version
-#
-# RETURNS
-# version_struct Version_struct - {urn:example.com:simpletype-rpc-type}version_struct
-#
-version = nil
-puts obj.echo_version(version)
-
-# SYNOPSIS
-# echo_version_r(version_struct)
-#
-# ARGS
-# version_struct Version_struct - {urn:example.com:simpletype-rpc-type}version_struct
-#
-# RETURNS
-# version Version - {urn:example.com:simpletype-rpc-type}version
-#
-version_struct = nil
-puts obj.echo_version_r(version_struct)
-
-
diff --git a/test/wsdl/simpletype/rpc/expectedDriver.rb b/test/wsdl/simpletype/rpc/expectedDriver.rb
deleted file mode 100644
index 81c72d1acf..0000000000
--- a/test/wsdl/simpletype/rpc/expectedDriver.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-require 'echo_version.rb'
-
-require 'soap/rpc/driver'
-
-class Echo_version_port_type < ::SOAP::RPC::Driver
- DefaultEndpointUrl = "http://localhost:10080"
- MappingRegistry = ::SOAP::Mapping::Registry.new
-
- MappingRegistry.set(
- Version_struct,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("urn:example.com:simpletype-rpc-type", "version_struct") }
- )
-
- Methods = [
- [ XSD::QName.new("urn:example.com:simpletype-rpc", "echo_version"),
- "urn:example.com:simpletype-rpc",
- "echo_version",
- [ ["in", "version", ["::SOAP::SOAPString"]],
- ["retval", "version_struct", ["Version_struct", "urn:example.com:simpletype-rpc-type", "version_struct"]] ],
- { :request_style => :rpc, :request_use => :encoded,
- :response_style => :rpc, :response_use => :encoded }
- ],
- [ XSD::QName.new("urn:example.com:simpletype-rpc", "echo_version_r"),
- "urn:example.com:simpletype-rpc",
- "echo_version_r",
- [ ["in", "version_struct", ["Version_struct", "urn:example.com:simpletype-rpc-type", "version_struct"]],
- ["retval", "version", ["::SOAP::SOAPString"]] ],
- { :request_style => :rpc, :request_use => :encoded,
- :response_style => :rpc, :response_use => :encoded }
- ]
- ]
-
- def initialize(endpoint_url = nil)
- endpoint_url ||= DefaultEndpointUrl
- super(endpoint_url, nil)
- self.mapping_registry = MappingRegistry
- init_methods
- end
-
-private
-
- def init_methods
- Methods.each do |definitions|
- opt = definitions.last
- if opt[:request_style] == :document
- add_document_operation(*definitions)
- else
- add_rpc_operation(*definitions)
- qname = definitions[0]
- name = definitions[2]
- if qname.name != name and qname.name.capitalize == name.capitalize
- ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
- __send__(name, *arg)
- end
- end
- end
- end
- end
-end
-
diff --git a/test/wsdl/simpletype/rpc/expectedEchoVersion.rb b/test/wsdl/simpletype/rpc/expectedEchoVersion.rb
deleted file mode 100644
index 806ece1626..0000000000
--- a/test/wsdl/simpletype/rpc/expectedEchoVersion.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'xsd/qname'
-
-# {urn:example.com:simpletype-rpc-type}version_struct
-class Version_struct
- @@schema_type = "version_struct"
- @@schema_ns = "urn:example.com:simpletype-rpc-type"
- @@schema_element = [["version", ["SOAP::SOAPString", XSD::QName.new(nil, "version")]], ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]]]
-
- attr_accessor :version
- attr_accessor :msg
-
- def initialize(version = nil, msg = nil)
- @version = version
- @msg = msg
- end
-end
-
-# {urn:example.com:simpletype-rpc-type}version
-module Version
- C_16 = "1.6"
- C_18 = "1.8"
- C_19 = "1.9"
-end
diff --git a/test/wsdl/simpletype/rpc/expectedServant.rb b/test/wsdl/simpletype/rpc/expectedServant.rb
deleted file mode 100644
index 81cf50218e..0000000000
--- a/test/wsdl/simpletype/rpc/expectedServant.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-require 'echo_version.rb'
-
-class Echo_version_port_type
- # SYNOPSIS
- # echo_version(version)
- #
- # ARGS
- # version Version - {urn:example.com:simpletype-rpc-type}version
- #
- # RETURNS
- # version_struct Version_struct - {urn:example.com:simpletype-rpc-type}version_struct
- #
- def echo_version(version)
- p [version]
- raise NotImplementedError.new
- end
-
- # SYNOPSIS
- # echo_version_r(version_struct)
- #
- # ARGS
- # version_struct Version_struct - {urn:example.com:simpletype-rpc-type}version_struct
- #
- # RETURNS
- # version Version - {urn:example.com:simpletype-rpc-type}version
- #
- def echo_version_r(version_struct)
- p [version_struct]
- raise NotImplementedError.new
- end
-end
-
diff --git a/test/wsdl/simpletype/rpc/expectedService.rb b/test/wsdl/simpletype/rpc/expectedService.rb
deleted file mode 100644
index be6f996562..0000000000
--- a/test/wsdl/simpletype/rpc/expectedService.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env ruby
-require 'echo_versionServant.rb'
-
-require 'soap/rpc/standaloneServer'
-require 'soap/mapping/registry'
-
-class Echo_version_port_type
- MappingRegistry = ::SOAP::Mapping::Registry.new
-
- MappingRegistry.set(
- Version_struct,
- ::SOAP::SOAPStruct,
- ::SOAP::Mapping::Registry::TypedStructFactory,
- { :type => XSD::QName.new("urn:example.com:simpletype-rpc-type", "version_struct") }
- )
-
- Methods = [
- [ XSD::QName.new("urn:example.com:simpletype-rpc", "echo_version"),
- "urn:example.com:simpletype-rpc",
- "echo_version",
- [ ["in", "version", ["::SOAP::SOAPString"]],
- ["retval", "version_struct", ["Version_struct", "urn:example.com:simpletype-rpc-type", "version_struct"]] ],
- { :request_style => :rpc, :request_use => :encoded,
- :response_style => :rpc, :response_use => :encoded }
- ],
- [ XSD::QName.new("urn:example.com:simpletype-rpc", "echo_version_r"),
- "urn:example.com:simpletype-rpc",
- "echo_version_r",
- [ ["in", "version_struct", ["Version_struct", "urn:example.com:simpletype-rpc-type", "version_struct"]],
- ["retval", "version", ["::SOAP::SOAPString"]] ],
- { :request_style => :rpc, :request_use => :encoded,
- :response_style => :rpc, :response_use => :encoded }
- ]
- ]
-end
-
-class Echo_version_port_typeApp < ::SOAP::RPC::StandaloneServer
- def initialize(*arg)
- super(*arg)
- servant = Echo_version_port_type.new
- Echo_version_port_type::Methods.each do |definitions|
- opt = definitions.last
- if opt[:request_style] == :document
- @router.add_document_operation(servant, *definitions)
- else
- @router.add_rpc_operation(servant, *definitions)
- end
- end
- self.mapping_registry = Echo_version_port_type::MappingRegistry
- end
-end
-
-if $0 == __FILE__
- # Change listen port.
- server = Echo_version_port_typeApp.new('app', nil, '0.0.0.0', 10080)
- trap(:INT) do
- server.shutdown
- end
- server.start
-end
diff --git a/test/wsdl/simpletype/rpc/rpc.wsdl b/test/wsdl/simpletype/rpc/rpc.wsdl
deleted file mode 100644
index 91f71a8831..0000000000
--- a/test/wsdl/simpletype/rpc/rpc.wsdl
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions name="echo_version"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="urn:example.com:simpletype-rpc"
- xmlns:txd="urn:example.com:simpletype-rpc-type"
- targetNamespace="urn:example.com:simpletype-rpc"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema targetNamespace="urn:example.com:simpletype-rpc-type">
- <xsd:complexType name="version_struct">
- <xsd:all>
- <xsd:element name="version" type="txd:version" />
- <xsd:element name="msg" type="xsd:string" />
- </xsd:all>
- </xsd:complexType>
-
- <xsd:simpleType name="version">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="1.6"/>
- <xsd:enumeration value="1.8"/>
- <xsd:enumeration value="1.9"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:schema>
- </types>
-
- <message name="msg_version">
- <part name="version" type="txd:version"/>
- </message>
-
- <message name="msg_version_struct">
- <part name="version_struct" type="txd:version_struct"/>
- </message>
-
- <portType name="echo_version_port_type">
- <operation name="echo_version">
- <input message="tns:msg_version"/>
- <output message="tns:msg_version_struct"/>
- </operation>
-
- <operation name="echo_version_r">
- <input message="tns:msg_version_struct"/>
- <output message="tns:msg_version"/>
- </operation>
- </portType>
-
- <binding name="echo_version_binding" type="tns:echo_version_port_type">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
- <operation name="echo_version">
- <soap:operation soapAction="urn:example.com:simpletype-rpc"/>
- <input>
- <soap:body use="encoded" namespace="urn:example.com:simpletype-rpc"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="urn:example.com:simpletype-rpc"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
-
- <operation name="echo_version_r">
- <soap:operation soapAction="urn:example.com:simpletype-rpc"/>
- <input>
- <soap:body use="encoded" namespace="urn:example.com:simpletype-rpc"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- <output>
- <soap:body use="encoded" namespace="urn:example.com:simpletype-rpc"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </output>
- </operation>
- </binding>
-
- <service name="echo_version_service">
- <port name="echo_version_port" binding="tns:echo_version_binding">
- <soap:address location="http://localhost:10080"/>
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/simpletype/rpc/test_rpc.rb b/test/wsdl/simpletype/rpc/test_rpc.rb
deleted file mode 100644
index 1d6a3eb4bc..0000000000
--- a/test/wsdl/simpletype/rpc/test_rpc.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-require 'test/unit'
-require 'wsdl/parser'
-require 'wsdl/soap/wsdl2ruby'
-
-
-module WSDL; module SimpleType
-
-
-class TestRPC < Test::Unit::TestCase
- DIR = File.dirname(File.expand_path(__FILE__))
- def pathname(filename)
- File.join(DIR, filename)
- end
-
- def test_rpc
- gen = WSDL::SOAP::WSDL2Ruby.new
- gen.location = pathname("rpc.wsdl")
- gen.basedir = DIR
- gen.logger.level = Logger::FATAL
- gen.opt['classdef'] = nil
- gen.opt['driver'] = nil
- gen.opt['client_skelton'] = nil
- gen.opt['servant_skelton'] = nil
- gen.opt['standalone_server_stub'] = nil
- gen.opt['force'] = true
- gen.run
- compare("expectedEchoVersion.rb", "echo_version.rb")
- compare("expectedDriver.rb", "echo_versionDriver.rb")
- compare("expectedService.rb", "echo_version_service.rb")
- compare("expectedClient.rb", "echo_version_serviceClient.rb")
- compare("expectedServant.rb", "echo_versionServant.rb")
-
- File.unlink(pathname("echo_version.rb"))
- File.unlink(pathname("echo_versionDriver.rb"))
- File.unlink(pathname("echo_version_service.rb"))
- File.unlink(pathname("echo_version_serviceClient.rb"))
- File.unlink(pathname("echo_versionServant.rb"))
- end
-
- def compare(expected, actual)
- assert_equal(loadfile(expected), loadfile(actual), actual)
- end
-
- def loadfile(file)
- File.open(pathname(file)) { |f| f.read }
- end
-end
-
-
-end; end
diff --git a/test/wsdl/simpletype/simpletype.wsdl b/test/wsdl/simpletype/simpletype.wsdl
deleted file mode 100644
index 623969c794..0000000000
--- a/test/wsdl/simpletype/simpletype.wsdl
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<definitions name="ping_service"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="urn:example.com:simpletype"
- targetNamespace="urn:example.com:simpletype"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema targetNamespace="urn:example.com:simpletype">
- <xsd:element name="ruby">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" name="myversion" type="tns:myversion"/>
- <xsd:element minOccurs="0" maxOccurs="1" name="date" type="xsd:dateTime"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:simpleType name="myversion">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="1.6"/>
- <xsd:enumeration value="1.8"/>
- <xsd:enumeration value="1.9"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:element name="myid" type="tns:ID"/>
-
- <xsd:simpleType name="ID">
- <xsd:restriction base="xsd:string">
- <xsd:length value="18"/>
- <xsd:pattern value='[a-zA-Z0-9]{18}'/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:schema>
- </types>
-
- <message name="ping_in">
- <part name="parameters" element="tns:ruby"/>
- </message>
-
- <message name="ping_out">
- <part name="parameters" type="xsd:string"/>
- </message>
-
- <message name="ping_id_in">
- <part name="parameters" element="tns:myid"/>
- </message>
-
- <message name="ping_id_out">
- <part name="parameters" element="tns:myid"/>
- </message>
-
- <message name="versionmsg">
- <part name="myversion" element="tns:myversion"/>
- </message>
-
- <portType name="ping_port_type">
- <operation name="ping">
- <input message="tns:ping_in"/>
- <output message="tns:ping_out"/>
- </operation>
-
- <operation name="ping_id">
- <input message="tns:ping_id_in"/>
- <output message="tns:ping_id_out"/>
- </operation>
-
- <operation name="echo_version">
- <input message="tns:versionmsg"/>
- <output message="tns:versionmsg"/>
- </operation>
- </portType>
-
- <binding name="ping_binding" type="tns:ping_port_type">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
- <operation name="ping">
- <soap:operation soapAction="urn:example.com:simpletype:ping" style="document"/>
- <input><soap:body use="literal"/></input>
- <output><soap:body use="literal"/></output>
- </operation>
-
- <operation name="ping_id">
- <soap:operation soapAction="urn:example.com:simpletype:ping_id" style="document"/>
- <input><soap:body use="literal"/></input>
- <output><soap:body use="literal"/></output>
- </operation>
- </binding>
-
- <service name="ping_service">
- <port name="ping_port" binding="tns:ping_binding">
- <soap:address location="http://localhost:10080"/>
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/simpletype/test_simpletype.rb b/test/wsdl/simpletype/test_simpletype.rb
deleted file mode 100644
index 7e644c3042..0000000000
--- a/test/wsdl/simpletype/test_simpletype.rb
+++ /dev/null
@@ -1,99 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-
-
-module WSDL
-module SimpleType
-
-
-class TestSimpleType < Test::Unit::TestCase
- class Server < ::SOAP::RPC::StandaloneServer
- def on_init
- add_document_method(self, 'urn:example.com:simpletype:ping', 'ping',
- XSD::QName.new('urn:example.com:simpletype', 'ruby'),
- XSD::QName.new('http://www.w3.org/2001/XMLSchema', 'string'))
- add_document_method(self, 'urn:example.com:simpletype:ping_id', 'ping_id',
- XSD::QName.new('urn:example.com:simpletype', 'myid'),
- XSD::QName.new('urn:example.com:simpletype', 'myid'))
- end
-
- def ping(ruby)
- version = ruby["myversion"]
- date = ruby["date"]
- "#{version} (#{date})"
- end
-
- def ping_id(id)
- id
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
-
- Port = 17171
-
- def setup
- setup_server
- setup_client
- end
-
- def setup_server
- @server = Server.new('Test', "urn:example.com:simpletype", '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @server_thread = start_server_thread(@server)
- end
-
- def setup_client
- wsdl = File.join(DIR, 'simpletype.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.generate_explicit_type = false
- @client.wiredump_dev = STDOUT if $DEBUG
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @server_thread.kill
- @server_thread.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def start_server_thread(server)
- t = Thread.new {
- Thread.current.abort_on_exception = true
- server.start
- }
- t
- end
-
- def test_ping
- ret = @client.ping({:myversion => "1.9", :date => "2004-01-01T00:00:00Z"})
- assert_equal("1.9 (2004-01-01T00:00:00Z)", ret)
- end
-
- def test_ping_id
- ret = @client.ping_id("012345678901234567")
- assert_equal("012345678901234567", ret)
- # length
- assert_raise(XSD::ValueSpaceError) do
- @client.ping_id("0123456789012345678")
- end
- # pattern
- assert_raise(XSD::ValueSpaceError) do
- @client.ping_id("01234567890123456;")
- end
- end
-end
-
-
-end
-end
diff --git a/test/wsdl/soap/soapbodyparts.wsdl b/test/wsdl/soap/soapbodyparts.wsdl
deleted file mode 100644
index 0e6da0ebee..0000000000
--- a/test/wsdl/soap/soapbodyparts.wsdl
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0"?>
-<definitions
- name="soapbodyparts"
- targetNamespace="urn:www.example.com:soapbodyparts:v1"
- xmlns:tns="urn:www.example.com:soapbodyparts:v1"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
-
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="urn:www.example.com:soapbodyparts:v1">
- <import namespace = "http://schemas.xmlsoap.org/soap/encoding/"/>
- <complexType name="StringArray">
- <complexContent>
- <restriction base="soapenc:Array">
- <attribute ref="soapenc:arrayType" wsdl:arrayType="string[]"/>
- </restriction>
- </complexContent>
- </complexType>
- </schema>
- </types>
-
- <message name="fooRequest">
- <part name="param1" type="xsd:string"/>
- <part name="param2" type="xsd:string"/>
- <part name="param3" type="xsd:string"/>
- </message>
-
- <message name="fooResponse">
- <part name="return" type="tns:StringArray"/>
- </message>
-
- <portType name="FooServicePortType">
- <operation name="foo"
- parameterOrder="param3 param2 param1">
- <input message="tns:fooRequest"/>
- <output message="tns:fooResponse"/>
- </operation>
- <operation name="bar"
- parameterOrder="param1 param2 param3">
- <input message="tns:fooRequest"/>
- <output message="tns:fooResponse"/>
- </operation>
- <operation name="baz">
- <input message="tns:fooRequest"/>
- <output message="tns:fooResponse"/>
- </operation>
- </portType>
-
- <binding name="FooServicePortBinding" type="tns:FooServicePortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
- <operation name="foo">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- parts="param1 param3"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:www.example.com:soapbodyparts:v1"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:www.example.com:soapbodyparts:v1"/>
- </output>
- </operation>
- <operation name="bar">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- parts="param3 param2"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:www.example.com:soapbodyparts:v1"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:www.example.com:soapbodyparts:v1"/>
- </output>
- </operation>
- <operation name="baz">
- <soap:operation soapAction=""/>
- <input>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:www.example.com:soapbodyparts:v1"/>
- </input>
- <output>
- <soap:body use="encoded"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="urn:www.example.com:soapbodyparts:v1"/>
- </output>
- </operation>
- </binding>
-
- <service name="FooService">
- <port name="FooServicePort" binding="tns:FooServicePortBinding">
- <soap:address location="http://raa.ruby-lang.org/soap/1.0.2/"/>
- </port>
- </service>
-</definitions>
diff --git a/test/wsdl/soap/test_soapbodyparts.rb b/test/wsdl/soap/test_soapbodyparts.rb
deleted file mode 100644
index 291319aedf..0000000000
--- a/test/wsdl/soap/test_soapbodyparts.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-require 'test/unit'
-require 'soap/rpc/standaloneServer'
-require 'soap/wsdlDriver'
-
-
-module WSDL
-module SOAP
-
-
-class TestSOAPBodyParts < Test::Unit::TestCase
- class Server < ::SOAP::RPC::StandaloneServer
- def on_init
- add_method(self, 'foo', 'p1', 'p2', 'p3')
- add_method(self, 'bar', 'p1', 'p2', 'p3')
- add_method(self, 'baz', 'p1', 'p2', 'p3')
- end
-
- def foo(p1, p2, p3)
- [p1, p2, p3]
- end
-
- alias bar foo
-
- def baz(p1, p2, p3)
- [p3, p2, p1]
- end
- end
-
- DIR = File.dirname(File.expand_path(__FILE__))
-
- Port = 17171
-
- def setup
- setup_server
- setup_client
- end
-
- def setup_server
- @server = Server.new('Test', "urn:www.example.com:soapbodyparts:v1", '0.0.0.0', Port)
- @server.level = Logger::Severity::ERROR
- @t = Thread.new {
- Thread.current.abort_on_exception = true
- @server.start
- }
- end
-
- def setup_client
- wsdl = File.join(DIR, 'soapbodyparts.wsdl')
- @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
- @client.endpoint_url = "http://localhost:#{Port}/"
- @client.wiredump_dev = STDERR if $DEBUG
- end
-
- def teardown
- teardown_server
- teardown_client
- end
-
- def teardown_server
- @server.shutdown
- @t.kill
- @t.join
- end
-
- def teardown_client
- @client.reset_stream
- end
-
- def test_soapbodyparts
- assert_equal(["1", "2", "3"], @client.foo("1", "2", "3"))
- assert_equal(["3", "2", "1"], @client.foo("3", "2", "1"))
- assert_equal(["1", "2", "3"], @client.bar("1", "2", "3"))
- assert_equal(["3", "2", "1"], @client.baz("1", "2", "3"))
- end
-end
-
-
-end
-end
diff --git a/test/wsdl/test_emptycomplextype.rb b/test/wsdl/test_emptycomplextype.rb
deleted file mode 100644
index 71d1b8641d..0000000000
--- a/test/wsdl/test_emptycomplextype.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require 'test/unit'
-require 'wsdl/parser'
-
-
-module WSDL
-
-
-class TestWSDL < Test::Unit::TestCase
- def setup
- @file = File.join(File.dirname(File.expand_path(__FILE__)), 'emptycomplextype.wsdl')
- end
-
- def test_wsdl
- @wsdl = WSDL::Parser.new.parse(File.open(@file) { |f| f.read })
- assert(/\{urn:jp.gr.jin.rrr.example.emptycomplextype\}emptycomplextype/ =~ @wsdl.inspect)
- end
-end
-
-
-
-end
diff --git a/test/wsdl/test_fault.rb b/test/wsdl/test_fault.rb
deleted file mode 100644
index ec414528ee..0000000000
--- a/test/wsdl/test_fault.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-require 'test/unit'
-require 'soap/processor'
-require 'soap/mapping'
-require 'soap/rpc/element'
-require 'wsdl/parser'
-
-
-module WSDL
-
-
-class TestFault < Test::Unit::TestCase
- def setup
- @xml =<<__EOX__
-<?xml version="1.0" encoding="utf-8" ?>
-<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <env:Body>
- <env:Fault xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/"
- env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <faultcode xsi:type="xsd:string">Server</faultcode>
- <faultstring xsi:type="xsd:string">faultstring</faultstring>
- <faultactor xsi:type="xsd:string">faultactor</faultactor>
- <detail xmlns:n2="http://www.ruby-lang.org/xmlns/ruby/type/custom"
- xsi:type="n2:SOAPException">
- <excn_type_name xsi:type="xsd:string">type</excn_type_name>
- <cause href="#id123"/>
- </detail>
- </env:Fault>
- <cause id="id123" xsi:type="xsd:int">5</cause>
- </env:Body>
-</env:Envelope>
-__EOX__
- end
-
- def test_by_wsdl
- rpc_decode_typemap = WSDL::Definitions.soap_rpc_complextypes
- opt = {}
- opt[:default_encodingstyle] = ::SOAP::EncodingNamespace
- opt[:decode_typemap] = rpc_decode_typemap
- header, body = ::SOAP::Processor.unmarshal(@xml, opt)
- fault = ::SOAP::Mapping.soap2obj(body.response)
- assert_equal("Server", fault.faultcode)
- assert_equal("faultstring", fault.faultstring)
- assert_equal(URI.parse("faultactor"), fault.faultactor)
- assert_equal(5, fault.detail.cause)
- end
-end
-
-
-end
diff --git a/test/wsdl/test_multiplefault.rb b/test/wsdl/test_multiplefault.rb
deleted file mode 100644
index 7004297dc9..0000000000
--- a/test/wsdl/test_multiplefault.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-require 'test/unit'
-require 'wsdl/parser'
-require 'wsdl/soap/classDefCreator'
-
-
-module WSDL
-
-
-class TestMultipleFault < Test::Unit::TestCase
- def self.setup(filename)
- @@filename = filename
- end
-
- def test_multiplefault
- @wsdl = WSDL::Parser.new.parse(File.open(@@filename) { |f| f.read })
- classdefstr = WSDL::SOAP::ClassDefCreator.new(@wsdl).dump
- yield_eval_binding(classdefstr) do |b|
- assert_equal(
- WSDL::TestMultipleFault::AuthenticationError,
- eval("AuthenticationError", b)
- )
- assert_equal(
- WSDL::TestMultipleFault::AuthorizationError,
- eval("AuthorizationError", b)
- )
- end
- end
-
- def yield_eval_binding(evaled)
- b = binding
- eval(evaled, b)
- yield(b)
- end
-end
-
-TestMultipleFault.setup(File.join(File.dirname(__FILE__), 'multiplefault.wsdl'))
-
-
-end
diff --git a/test/xsd/codegen/test_classdef.rb b/test/xsd/codegen/test_classdef.rb
deleted file mode 100644
index 64c4771918..0000000000
--- a/test/xsd/codegen/test_classdef.rb
+++ /dev/null
@@ -1,214 +0,0 @@
-require 'test/unit'
-require 'xsd/codegen/classdef'
-
-
-module XSD; module CodeGen
-
-
-class TestClassDefCreator < Test::Unit::TestCase
- include XSD::CodeGen
- include GenSupport
-
- def test_classdef_simple
- c = ClassDef.new("Foo")
- assert_equal(format(<<-EOD), c.dump)
- class Foo
- end
- EOD
- end
-
- def test_classdef_complex
- c = ClassDef.new("Foo::Bar::Baz", String)
- assert_equal(format(<<-EOD), c.dump)
- module Foo; module Bar
-
- class Baz < String
- end
-
- end; end
- EOD
- end
-
- def test_require
- c = ClassDef.new("Foo")
- c.def_require("foo/bar")
- assert_equal(format(<<-EOD), c.dump)
- require 'foo/bar'
-
- class Foo
- end
- EOD
- end
-
- def test_comment
- c = ClassDef.new("Foo")
- c.def_require("foo/bar")
- c.comment = <<-EOD
- foo
- EOD
- assert_equal(format(<<-EOD), c.dump)
- require 'foo/bar'
-
- # foo
- class Foo
- end
- EOD
- c.comment = <<-EOD
- foo
-
- bar
- baz
-
- EOD
- assert_equal(format(<<-EOD), c.dump)
- require 'foo/bar'
-
- # foo
- #
- # bar
- # baz
- #
- class Foo
- end
- EOD
- end
-
- def test_emptymethod
- c = ClassDef.new("Foo")
- c.def_method('foo') do
- end
- c.def_method('bar') do
- ''
- end
- assert_equal(format(<<-EOD), c.dump)
- class Foo
- def foo
- end
-
- def bar
- end
- end
- EOD
- end
-
- def test_full
- c = ClassDef.new("Foo::Bar::HobbitName", String)
- c.def_require("foo/bar")
- c.comment = <<-EOD
- foo
- bar
- baz
- EOD
- c.def_const("FOO", 1)
- c.def_classvar("@@foo", "var".dump)
- c.def_classvar("baz", "1".dump)
- c.def_attr("Foo", true, "foo")
- c.def_attr("bar")
- c.def_attr("baz", true)
- c.def_attr("Foo2", true, "foo2")
- c.def_attr("foo3", false, "foo3")
- c.def_method("foo") do
- <<-EOD
- foo.bar = 1
-\tbaz.each do |ele|
-\t ele
- end
- EOD
- end
- c.def_method("baz", "qux") do
- <<-EOD
- [1, 2, 3].each do |i|
- p i
- end
- EOD
- end
-
- m = MethodDef.new("qux", "quxx", "quxxx") do
- <<-EOD
- p quxx + quxxx
- EOD
- end
- m.comment = "hello world\n123"
- c.add_method(m)
- c.def_code <<-EOD
- Foo.new
- Bar.z
- EOD
- c.def_code <<-EOD
- Foo.new
- Bar.z
- EOD
- c.def_privatemethod("foo", "baz", "*arg", "&block")
-
- assert_equal(format(<<-EOD), c.dump)
- require 'foo/bar'
-
- module Foo; module Bar
-
- # foo
- # bar
- # baz
- class HobbitName < String
- @@foo = "var"
- @@baz = "1"
-
- FOO = 1
-
- Foo.new
- Bar.z
-
- Foo.new
- Bar.z
-
- attr_accessor :bar
- attr_accessor :baz
- attr_reader :foo3
-
- def Foo
- @foo
- end
-
- def Foo=(value)
- @foo = value
- end
-
- def Foo2
- @foo2
- end
-
- def Foo2=(value)
- @foo2 = value
- end
-
- def foo
- foo.bar = 1
- baz.each do |ele|
- ele
- end
- end
-
- def baz(qux)
- [1, 2, 3].each do |i|
- p i
- end
- end
-
- # hello world
- # 123
- def qux(quxx, quxxx)
- p quxx + quxxx
- end
-
- private
-
- def foo(baz, *arg, &block)
- end
- end
-
- end; end
- EOD
- end
-end
-
-
-end; end
diff --git a/test/xsd/noencoding.xml b/test/xsd/noencoding.xml
deleted file mode 100644
index 614ffa34ad..0000000000
--- a/test/xsd/noencoding.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="euc-jp"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema">
- <!-- ¤¢¤¤¤¦ -->
-</schema>
diff --git a/test/xsd/test_noencoding.rb b/test/xsd/test_noencoding.rb
deleted file mode 100644
index 48119ec1f7..0000000000
--- a/test/xsd/test_noencoding.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-require 'test/unit'
-require 'wsdl/xmlSchema/parser'
-
-
-module XSD
-
-
-class TestEmptyCharset < Test::Unit::TestCase
- def setup
- @file = File.join(File.dirname(File.expand_path(__FILE__)), 'noencoding.xml')
- end
-
- def test_wsdl
- begin
- xml = WSDL::XMLSchema::Parser.new.parse(File.open(@file) { |f| f.read })
- rescue RuntimeError
- if XSD::XMLParser.const_defined?("REXMLParser")
- STDERR.puts("rexml cannot handle euc-jp without iconv/uconv.")
- return
- end
- raise
- rescue Errno::EINVAL
- # unsupported encoding
- return
- end
- assert_equal(WSDL::XMLSchema::Schema, xml.class)
- assert_equal(0, xml.collect_elements.size)
- end
-end
-
-
-end
diff --git a/test/xsd/test_xmlschemaparser.rb b/test/xsd/test_xmlschemaparser.rb
deleted file mode 100644
index 10dff43e61..0000000000
--- a/test/xsd/test_xmlschemaparser.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'test/unit'
-require 'wsdl/xmlSchema/parser'
-
-
-module XSD
-
-
-class TestXMLSchemaParser < Test::Unit::TestCase
- def setup
- @file = File.join(File.dirname(File.expand_path(__FILE__)), 'xmlschema.xml')
- end
-
- def test_wsdl
- @wsdl = WSDL::XMLSchema::Parser.new.parse(File.open(@file) { |f| f.read })
- assert_equal(WSDL::XMLSchema::Schema, @wsdl.class)
- assert_equal(1, @wsdl.collect_elements.size)
- end
-end
-
-
-
-end
diff --git a/test/xsd/test_xsd.rb b/test/xsd/test_xsd.rb
deleted file mode 100644
index 6302f3128b..0000000000
--- a/test/xsd/test_xsd.rb
+++ /dev/null
@@ -1,1511 +0,0 @@
-require 'test/unit'
-require 'xsd/datatypes'
-
-
-module XSD
-
-
-class TestXSD < Test::Unit::TestCase
- NegativeZero = (-1.0 / (1.0 / 0.0))
-
- def setup
- end
-
- def teardown
- end
-
- def assert_parsed_result(klass, str)
- o = klass.new(str)
- assert_equal(str, o.to_s)
- end
-
- def test_NSDBase
- o = XSD::NSDBase.new
- assert_equal(nil, o.type)
- end
-
- def test_XSDBase
- o = XSD::XSDAnySimpleType.new
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
- assert_equal('', o.to_s)
- end
-
- def test_XSDNil
- o = XSD::XSDNil.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::NilLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- o = XSD::XSDNil.new(nil)
- assert_equal(true, o.is_nil)
- assert_equal(nil, o.data)
- assert_equal("", o.to_s)
- o = XSD::XSDNil.new('var')
- assert_equal(false, o.is_nil)
- assert_equal('var', o.data)
- assert_equal('var', o.to_s)
- end
-
- def test_XSDString_UTF8
- o = XSD::XSDString.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::StringLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- str = "abc"
- assert_equal(str, XSD::XSDString.new(str).data)
- assert_equal(str, XSD::XSDString.new(str).to_s)
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDString.new("\0")
- end
- assert_raises(XSD::ValueSpaceError) do
- p XSD::XSDString.new("\xC0\xC0").to_s
- end
- end
-
- def test_XSDString_NONE
- XSD::Charset.module_eval { @encoding_backup = @encoding; @encoding = "NONE" }
- begin
- o = XSD::XSDString.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::StringLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- str = "abc"
- assert_equal(str, XSD::XSDString.new(str).data)
- assert_equal(str, XSD::XSDString.new(str).to_s)
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDString.new("\0")
- end
- assert_raises(XSD::ValueSpaceError) do
- p XSD::XSDString.new("\xC0\xC0").to_s
- end
- ensure
- XSD::Charset.module_eval { @encoding = @encoding_backup }
- end
- end
-
- def test_XSDBoolean
- o = XSD::XSDBoolean.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::BooleanLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- ["true", true],
- ["1", true],
- ["false", false],
- ["0", false],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDBoolean.new(data).data)
- assert_equal(expected.to_s, XSD::XSDBoolean.new(data).to_s)
- end
-
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDBoolean.new("nil").to_s
- end
- end
-
- def test_XSDDecimal
- o = XSD::XSDDecimal.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::DecimalLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 1000000000,
- -9999999999,
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
- -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
- ]
- targets.each do |dec|
- assert_equal(dec.to_s, XSD::XSDDecimal.new(dec).data)
- end
-
- targets = [
- "0",
- "0.00000001",
- "1000000000",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123.45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDDecimal.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["0.0", "0"],
- ["-0.0", "0"],
- ["+0.0", "0"],
- ["0.", "0"],
- [".0", "0"],
- [
- "+0.12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "0.1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- ],
- [
- ".0000012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "0.000001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- ],
- [
- "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.",
- "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
- ],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDDecimal.new(data).to_s)
- end
-
- targets = [
- "0.000000000000a",
- "00a.0000000000001",
- "+-5",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDDecimal.new(d)
- end
- end
- end
-
- def test_XSDFloat
- o = XSD::XSDFloat.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::FloatLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 3.14159265358979,
- 12.34e36,
- 1.402e-45,
- -1.402e-45,
- ]
- targets.each do |f|
- assert_equal(f, XSD::XSDFloat.new(f).data)
- end
-
- targets = [
- "+3.141592654",
- "+1.234e+37",
- "+1.402e-45",
- "-1.402e-45",
- ]
- targets.each do |f|
- assert_equal(f, XSD::XSDFloat.new(f).to_s)
- end
-
- targets = [
- [3, "+3"], # should be 3.0?
- [-2, "-2"], # ditto
- [3.14159265358979, "+3.141592654"],
- [12.34e36, "+1.234e+37"],
- [1.402e-45, "+1.402e-45"],
- [-1.402e-45, "-1.402e-45"],
- ["1.402e", "+1.402"],
- ["12.34E36", "+1.234e+37"],
- ["1.402E-45", "+1.402e-45"],
- ["-1.402E-45", "-1.402e-45"],
- ["1.402E", "+1.402"],
- ]
- targets.each do |f, str|
- assert_equal(str, XSD::XSDFloat.new(f).to_s)
- end
-
- assert_equal("+0", XSD::XSDFloat.new(+0.0).to_s)
- assert_equal("-0", XSD::XSDFloat.new(NegativeZero).to_s)
- assert(XSD::XSDFloat.new(0.0/0.0).data.nan?)
- assert_equal("INF", XSD::XSDFloat.new(1.0/0.0).to_s)
- assert_equal(1, XSD::XSDFloat.new(1.0/0.0).data.infinite?)
- assert_equal("-INF", XSD::XSDFloat.new(-1.0/0.0).to_s)
- assert_equal(-1, XSD::XSDFloat.new(-1.0/0.0).data.infinite?)
-
- targets = [
- "0.000000000000a",
- "00a.0000000000001",
- "+-5",
- "5_0",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDFloat.new(d)
- end
- end
- end
-
- def test_XSDDouble
- o = XSD::XSDDouble.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::DoubleLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 3.14159265358979,
- 12.34e36,
- 1.402e-45,
- -1.402e-45,
- ]
- targets.each do |f|
- assert_equal(f, XSD::XSDDouble.new(f).data)
- end
-
- targets = [
- "+3.14159265358979",
- "+1.234e+37",
- "+1.402e-45",
- "-1.402e-45",
- ]
- targets.each do |f|
- assert_equal(f, XSD::XSDDouble.new(f).to_s)
- end
-
- targets = [
- [3, "+3"], # should be 3.0?
- [-2, "-2"], # ditto.
- [3.14159265358979, "+3.14159265358979"],
- [12.34e36, "+1.234e+37"],
- [1.402e-45, "+1.402e-45"],
- [-1.402e-45, "-1.402e-45"],
- ["1.402e", "+1.402"],
- ["12.34E36", "+1.234e+37"],
- ["1.402E-45", "+1.402e-45"],
- ["-1.402E-45", "-1.402e-45"],
- ["1.402E", "+1.402"],
- ]
- targets.each do |f, str|
- assert_equal(str, XSD::XSDDouble.new(f).to_s)
- end
-
- assert_equal("+0", XSD::XSDFloat.new(+0.0).to_s)
- assert_equal("-0", XSD::XSDFloat.new(NegativeZero).to_s)
- assert_equal("NaN", XSD::XSDDouble.new(0.0/0.0).to_s)
- assert(XSD::XSDDouble.new(0.0/0.0).data.nan?)
- assert_equal("INF", XSD::XSDDouble.new(1.0/0.0).to_s)
- assert_equal(1, XSD::XSDDouble.new(1.0/0.0).data.infinite?)
- assert_equal("-INF", XSD::XSDDouble.new(-1.0/0.0).to_s)
- assert_equal(-1, XSD::XSDDouble.new(-1.0/0.0).data.infinite?)
-
- targets = [
- "0.000000000000a",
- "00a.0000000000001",
- "+-5",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDDouble.new(d)
- end
- end
- end
-
- def test_XSDDuration
- o = XSD::XSDDuration.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::DurationLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "P1Y2M3DT4H5M6S",
- "P1234Y5678M9012DT3456H7890M1234.5678S",
- "P0DT3456H7890M1234.5678S",
- "P1234Y5678M9012D",
- "-P1234Y5678M9012DT3456H7890M1234.5678S",
- "P5678M9012DT3456H7890M1234.5678S",
- "-P1234Y9012DT3456H7890M1234.5678S",
- "+P1234Y5678MT3456H7890M1234.5678S",
- "P1234Y5678M9012DT7890M1234.5678S",
- "-P1234Y5678M9012DT3456H1234.5678S",
- "+P1234Y5678M9012DT3456H7890M",
- "P123400000000000Y",
- "-P567800000000000M",
- "+P901200000000000D",
- "P0DT345600000000000H",
- "-P0DT789000000000000M",
- "+P0DT123400000000000.000000000005678S",
- "P1234YT1234.5678S",
- "-P5678MT7890M",
- "+P9012DT3456H",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDDuration, str)
- end
-
- targets = [
- ["P0Y0M0DT0H0M0S",
- "P0D"],
- ["-P0DT0S",
- "-P0D"],
- ["P01234Y5678M9012DT3456H7890M1234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ["P1234Y005678M9012DT3456H7890M1234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ["P1234Y5678M0009012DT3456H7890M1234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ["P1234Y5678M9012DT00003456H7890M1234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ["P1234Y5678M9012DT3456H000007890M1234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ["P1234Y5678M9012DT3456H7890M0000001234.5678S",
- "P1234Y5678M9012DT3456H7890M1234.5678S"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDDuration.new(data).to_s)
- end
- end
-
- def test_XSDDateTime
- o = XSD::XSDDateTime.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::DateTimeLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "2002-05-18T16:52:20Z",
- "0001-01-01T00:00:00Z",
- "9999-12-31T23:59:59Z",
- "19999-12-31T23:59:59Z",
- "2002-12-31T23:59:59.999Z",
- "2002-12-31T23:59:59.001Z",
- "2002-12-31T23:59:59.99999999999999999999Z",
- "2002-12-31T23:59:59.00000000000000000001Z",
- "2002-12-31T23:59:59+09:00",
- "2002-12-31T23:59:59+00:01",
- "2002-12-31T23:59:59-00:01",
- "2002-12-31T23:59:59-23:59",
- "2002-12-31T23:59:59.00000000000000000001+13:30",
- "2002-12-31T23:59:59.5137Z",
- "2002-12-31T23:59:59.51375Z", # 411/800
- "2002-12-31T23:59:59.51375+12:34",
- "-2002-05-18T16:52:20Z",
- "-4713-01-01T12:00:00Z",
- "-2002-12-31T23:59:59+00:01",
- "-0001-12-31T23:59:59.00000000000000000001+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDDateTime, str)
- end
-
- targets = [
- ["2002-12-31T23:59:59.00",
- "2002-12-31T23:59:59Z"],
- ["2002-12-31T23:59:59+00:00",
- "2002-12-31T23:59:59Z"],
- ["2002-12-31T23:59:59-00:00",
- "2002-12-31T23:59:59Z"],
- ["-2002-12-31T23:59:59.00",
- "-2002-12-31T23:59:59Z"],
- ["-2002-12-31T23:59:59+00:00",
- "-2002-12-31T23:59:59Z"],
- ["-2002-12-31T23:59:59-00:00",
- "-2002-12-31T23:59:59Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDDateTime.new(data).to_s)
- d = DateTime.parse(data)
- d >>= 12 if d.year < 0 # XSDDateTime.year(-1) == DateTime.year(0)
- assert_equal(expected, XSD::XSDDateTime.new(d).to_s)
- end
-
- targets = [
- "0000-05-18T16:52:20Z",
- "05-18T16:52:20Z",
- "2002-05T16:52:20Z",
- "2002-05-18T16:52Z",
- "",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError, d.to_s) do
- XSD::XSDDateTime.new(d)
- end
- end
- end
-
- def test_XSDTime
- o = XSD::XSDTime.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::TimeLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "16:52:20Z",
- "00:00:00Z",
- "23:59:59Z",
- "23:59:59.999Z",
- "23:59:59.001Z",
- "23:59:59.99999999999999999999Z",
- "23:59:59.00000000000000000001Z",
- "23:59:59+09:00",
- "23:59:59+00:01",
- "23:59:59-00:01",
- "23:59:59-23:59",
- "23:59:59.00000000000000000001+13:30",
- "23:59:59.51345Z",
- "23:59:59.51345+12:34",
- "23:59:59+00:01",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDTime, str)
- end
-
- targets = [
- ["23:59:59.00",
- "23:59:59Z"],
- ["23:59:59+00:00",
- "23:59:59Z"],
- ["23:59:59-00:00",
- "23:59:59Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDTime.new(data).to_s)
- end
- end
-
- def test_XSDDate
- o = XSD::XSDDate.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::DateLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "2002-05-18Z",
- "0001-01-01Z",
- "9999-12-31Z",
- "19999-12-31Z",
- "2002-12-31+09:00",
- "2002-12-31+00:01",
- "2002-12-31-00:01",
- "2002-12-31-23:59",
- "2002-12-31+13:30",
- "-2002-05-18Z",
- "-19999-12-31Z",
- "-2002-12-31+00:01",
- "-0001-12-31+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDDate, str)
- end
-
- targets = [
- ["2002-12-31",
- "2002-12-31Z"],
- ["2002-12-31+00:00",
- "2002-12-31Z"],
- ["2002-12-31-00:00",
- "2002-12-31Z"],
- ["-2002-12-31",
- "-2002-12-31Z"],
- ["-2002-12-31+00:00",
- "-2002-12-31Z"],
- ["-2002-12-31-00:00",
- "-2002-12-31Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDDate.new(data).to_s)
- d = Date.parse(data)
- d >>= 12 if d.year < 0 # XSDDate.year(-1) == Date.year(0)
- assert_equal(expected, XSD::XSDDate.new(d).to_s)
- end
- end
-end
-
-class TestXSD2 < Test::Unit::TestCase
- def setup
- # Nothing to do.
- end
-
- def teardown
- # Nothing to do.
- end
-
- def assert_parsed_result(klass, str)
- o = klass.new(str)
- assert_equal(str, o.to_s)
- end
-
- def test_XSDGYearMonth
- o = XSD::XSDGYearMonth.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::GYearMonthLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "2002-05Z",
- "0001-01Z",
- "9999-12Z",
- "19999-12Z",
- "2002-12+09:00",
- "2002-12+00:01",
- "2002-12-00:01",
- "2002-12-23:59",
- "2002-12+13:30",
- "-2002-05Z",
- "-19999-12Z",
- "-2002-12+00:01",
- "-0001-12+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDGYearMonth, str)
- end
-
- targets = [
- ["2002-12",
- "2002-12Z"],
- ["2002-12+00:00",
- "2002-12Z"],
- ["2002-12-00:00",
- "2002-12Z"],
- ["-2002-12",
- "-2002-12Z"],
- ["-2002-12+00:00",
- "-2002-12Z"],
- ["-2002-12-00:00",
- "-2002-12Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDGYearMonth.new(data).to_s)
- end
- end
-
- def test_XSDGYear
- o = XSD::XSDGYear.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::GYearLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "2002Z",
- "0001Z",
- "9999Z",
- "19999Z",
- "2002+09:00",
- "2002+00:01",
- "2002-00:01",
- "2002-23:59",
- "2002+13:30",
- "-2002Z",
- "-19999Z",
- "-2002+00:01",
- "-0001+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDGYear, str)
- end
-
- targets = [
- ["2002",
- "2002Z"],
- ["2002+00:00",
- "2002Z"],
- ["2002-00:00",
- "2002Z"],
- ["-2002",
- "-2002Z"],
- ["-2002+00:00",
- "-2002Z"],
- ["-2002-00:00",
- "-2002Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDGYear.new(data).to_s)
- end
- end
-
- def test_XSDGMonthDay
- o = XSD::XSDGMonthDay.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::GMonthDayLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "05-18Z",
- "01-01Z",
- "12-31Z",
- "12-31+09:00",
- "12-31+00:01",
- "12-31-00:01",
- "12-31-23:59",
- "12-31+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDGMonthDay, str)
- end
-
- targets = [
- ["12-31",
- "12-31Z"],
- ["12-31+00:00",
- "12-31Z"],
- ["12-31-00:00",
- "12-31Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDGMonthDay.new(data).to_s)
- end
- end
-
- def test_XSDGDay
- o = XSD::XSDGDay.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::GDayLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "18Z",
- "01Z",
- "31Z",
- "31+09:00",
- "31+00:01",
- "31-00:01",
- "31-23:59",
- "31+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDGDay, str)
- end
-
- targets = [
- ["31",
- "31Z"],
- ["31+00:00",
- "31Z"],
- ["31-00:00",
- "31Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDGDay.new(data).to_s)
- end
- end
-
- def test_XSDGMonth
- o = XSD::XSDGMonth.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::GMonthLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "05Z",
- "01Z",
- "12Z",
- "12+09:00",
- "12+00:01",
- "12-00:01",
- "12-23:59",
- "12+13:30",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDGMonth, str)
- end
-
- targets = [
- ["12",
- "12Z"],
- ["12+00:00",
- "12Z"],
- ["12-00:00",
- "12Z"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDGMonth.new(data).to_s)
- end
- end
-
- def test_XSDHexBinary
- o = XSD::XSDHexBinary.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::HexBinaryLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "abcdef",
- "\xe3\x81\xaa\xe3\x81\xb2",
- %Q(\0),
- "",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDHexBinary.new(str).string)
- assert_equal(str.unpack("H*")[0 ].tr('a-f', 'A-F'),
- XSD::XSDHexBinary.new(str).data)
- o = XSD::XSDHexBinary.new
- o.set_encoded(str.unpack("H*")[0 ].tr('a-f', 'A-F'))
- assert_equal(str, o.string)
- o.set_encoded(str.unpack("H*")[0 ].tr('A-F', 'a-f'))
- assert_equal(str, o.string)
- end
-
- targets = [
- "0FG7",
- "0fg7",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError, d.to_s) do
- o = XSD::XSDHexBinary.new
- o.set_encoded(d)
- p o.string
- end
- end
- end
-
- def test_XSDBase64Binary
- o = XSD::XSDBase64Binary.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::Base64BinaryLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- "abcdef",
- "\xe3\x81\xaa\xe3\x81\xb2",
- %Q(\0),
- "",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDBase64Binary.new(str).string)
- assert_equal([str ].pack("m").chomp, XSD::XSDBase64Binary.new(str).data)
- o = XSD::XSDBase64Binary.new
- o.set_encoded([str ].pack("m").chomp)
- assert_equal(str, o.string)
- end
-
- targets = [
- "-",
- "*",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError, d.to_s) do
- o = XSD::XSDBase64Binary.new
- o.set_encoded(d)
- p o.string
- end
- end
- end
-
- def test_XSDAnyURI
- o = XSD::XSDAnyURI.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::AnyURILiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- # Too few tests here I know. Believe uri module. :)
- targets = [
- "foo",
- "http://foo",
- "http://foo/bar/baz",
- "http://foo/bar#baz",
- "http://foo/bar%20%20?a+b",
- "HTTP://FOO/BAR%20%20?A+B",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDAnyURI, str)
- end
- end
-
- def test_XSDQName
- o = XSD::XSDQName.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::QNameLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- # More strict test is needed but current implementation allows all non-':'
- # chars like ' ', C0 or C1...
- targets = [
- "foo",
- "foo:bar",
- "a:b",
- ]
- targets.each do |str|
- assert_parsed_result(XSD::XSDQName, str)
- end
- end
-
-
- ###
- ## Derived types
- #
-
- def test_XSDInteger
- o = XSD::XSDInteger.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::IntegerLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 1000000000,
- -9999999999,
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
- -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
- ]
- targets.each do |int|
- assert_equal(int, XSD::XSDInteger.new(int).data)
- end
-
- targets = [
- "0",
- "1000000000",
- "-9999999999",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDInteger.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["-000123", "-123"],
- [
- "+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
- ],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDInteger.new(data).to_s)
- end
-
- targets = [
- "0.0",
- "-5.2",
- "0.000000000000a",
- "+-5",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDInteger.new(d)
- end
- end
- end
-
- def test_XSDNonPositiveInteger
- o = XSD::XSDNonPositiveInteger.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::NonPositiveIntegerLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- -9999999999,
- -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
- ]
- targets.each do |int|
- assert_equal(int, XSD::XSDNonPositiveInteger.new(int).data)
- end
-
- targets = [
- "0",
- "-9999999999",
- "-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDNonPositiveInteger.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["-000123", "-123"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDNonPositiveInteger.new(data).to_s)
- end
-
- targets = [
- "0.0",
- "-5.2",
- "0.000000000000a",
- "+-5",
- "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDNonPositiveInteger.new(d)
- end
- end
- end
-
- def test_XSDNegativeInteger
- o = XSD::XSDNegativeInteger.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::NegativeIntegerLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- -1,
- -9999999999,
- -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
- ]
- targets.each do |int|
- assert_equal(int, XSD::XSDNegativeInteger.new(int).data)
- end
-
- targets = [
- "-1",
- "-9999999999",
- "-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDNegativeInteger.new(str).to_s)
- end
-
- targets = [
- ["-000123", "-123"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDNegativeInteger.new(data).to_s)
- end
-
- targets = [
- "-0.0",
- "-5.2",
- "-0.000000000000a",
- "+-5",
- "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDNegativeInteger.new(d)
- end
- end
- end
-
- def test_XSDLong
- o = XSD::XSDLong.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::LongLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 123,
- -123,
- 9223372036854775807,
- -9223372036854775808,
- ]
- targets.each do |lng|
- assert_equal(lng, XSD::XSDLong.new(lng).data)
- end
-
- targets = [
- "0",
- "123",
- "-123",
- "9223372036854775807",
- "-9223372036854775808",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDLong.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["-000123", "-123"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDLong.new(data).to_s)
- end
-
- targets = [
- 9223372036854775808,
- -9223372036854775809,
- "0.0",
- "-5.2",
- "0.000000000000a",
- "+-5",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDLong.new(d)
- end
- end
- end
-
- def test_XSDInt
- o = XSD::XSDInt.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::IntLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 123,
- -123,
- 2147483647,
- -2147483648,
- ]
- targets.each do |lng|
- assert_equal(lng, XSD::XSDInt.new(lng).data)
- end
-
- targets = [
- "0",
- "123",
- "-123",
- "2147483647",
- "-2147483648",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDInt.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["-000123", "-123"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDInt.new(data).to_s)
- end
-
- targets = [
- 2147483648,
- -2147483649,
- "0.0",
- "-5.2",
- "0.000000000000a",
- "+-5",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDInt.new(d)
- end
- end
- end
-
- def test_XSDShort
- o = XSD::XSDShort.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::ShortLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 123,
- -123,
- 32767,
- -32768,
- ]
- targets.each do |lng|
- assert_equal(lng, XSD::XSDShort.new(lng).data)
- end
-
- targets = [
- "0",
- "123",
- "-123",
- "32767",
- "-32768",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDShort.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["-000123", "-123"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDShort.new(data).to_s)
- end
-
- targets = [
- 32768,
- -32769,
- "0.0",
- "-5.2",
- "0.000000000000a",
- "+-5",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDShort.new(d)
- end
- end
- end
-
- def test_XSDByte
- o = XSD::XSDByte.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::ByteLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 123,
- -123,
- 127,
- -128,
- ]
- targets.each do |lng|
- assert_equal(lng, XSD::XSDByte.new(lng).data)
- end
-
- targets = [
- "0",
- "123",
- "-123",
- "127",
- "-128",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDByte.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["-000123", "-123"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDByte.new(data).to_s)
- end
-
- targets = [
- 128,
- -129,
- "0.0",
- "-5.2",
- "0.000000000000a",
- "+-5",
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDByte.new(d)
- end
- end
- end
-
- def test_XSDNonNegativeInteger
- o = XSD::XSDNonNegativeInteger.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::NonNegativeIntegerLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 1000000000,
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
- ]
- targets.each do |int|
- assert_equal(int, XSD::XSDNonNegativeInteger.new(int).data)
- end
-
- targets = [
- "0",
- "1000000000",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDNonNegativeInteger.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- [
- "+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
- ],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDNonNegativeInteger.new(data).to_s)
- end
-
- targets = [
- "0.0",
- "0.000000000000a",
- "+-5",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDNonNegativeInteger.new(d)
- end
- end
- end
-
- def test_XSDUnsignedLong
- o = XSD::XSDUnsignedLong.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::UnsignedLongLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 1000000000,
- 18446744073709551615,
- ]
- targets.each do |int|
- assert_equal(int, XSD::XSDUnsignedLong.new(int).data)
- end
-
- targets = [
- "0",
- "1000000000",
- "18446744073709551615",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDUnsignedLong.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["+18446744073709551615", "18446744073709551615"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDUnsignedLong.new(data).to_s)
- end
-
- targets = [
- "0.0",
- "0.000000000000a",
- "+-5",
- "18446744073709551615."
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDUnsignedLong.new(d)
- end
- end
- end
-
- def test_XSDUnsignedInt
- o = XSD::XSDUnsignedInt.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::UnsignedIntLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 1000000000,
- 4294967295,
- ]
- targets.each do |int|
- assert_equal(int, XSD::XSDUnsignedInt.new(int).data)
- end
-
- targets = [
- "0",
- "1000000000",
- "4294967295",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDUnsignedInt.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["+4294967295", "4294967295"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDUnsignedInt.new(data).to_s)
- end
-
- targets = [
- "0.0",
- "0.000000000000a",
- "+-5",
- "4294967295."
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDUnsignedInt.new(d)
- end
- end
- end
-
- def test_XSDUnsignedShort
- o = XSD::XSDUnsignedShort.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::UnsignedShortLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 10000,
- 65535,
- ]
- targets.each do |int|
- assert_equal(int, XSD::XSDUnsignedShort.new(int).data)
- end
-
- targets = [
- "0",
- "1000",
- "65535",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDUnsignedShort.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["+65535", "65535"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDUnsignedShort.new(data).to_s)
- end
-
- targets = [
- "0.0",
- "0.000000000000a",
- "+-5",
- "65535."
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDUnsignedShort.new(d)
- end
- end
- end
-
- def test_XSDUnsignedByte
- o = XSD::XSDUnsignedByte.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::UnsignedByteLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 0,
- 10,
- 255,
- ]
- targets.each do |int|
- assert_equal(int, XSD::XSDUnsignedByte.new(int).data)
- end
-
- targets = [
- "0",
- "10",
- "255",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDUnsignedByte.new(str).to_s)
- end
-
- targets = [
- ["-0", "0"],
- ["+0", "0"],
- ["000123", "123"],
- ["+255", "255"],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDUnsignedByte.new(data).to_s)
- end
-
- targets = [
- "0.0",
- "0.000000000000a",
- "+-5",
- "255."
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDUnsignedByte.new(d)
- end
- end
- end
-
- def test_XSDPositiveInteger
- o = XSD::XSDPositiveInteger.new
- assert_equal(XSD::Namespace, o.type.namespace)
- assert_equal(XSD::PositiveIntegerLiteral, o.type.name)
- assert_equal(nil, o.data)
- assert_equal(true, o.is_nil)
-
- targets = [
- 1,
- 1000000000,
- 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
- ]
- targets.each do |int|
- assert_equal(int, XSD::XSDPositiveInteger.new(int).data)
- end
-
- targets = [
- "1",
- "1000000000",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- ]
- targets.each do |str|
- assert_equal(str, XSD::XSDPositiveInteger.new(str).to_s)
- end
-
- targets = [
- ["+1", "1"],
- ["000123", "123"],
- [
- "+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
- ],
- ]
- targets.each do |data, expected|
- assert_equal(expected, XSD::XSDPositiveInteger.new(data).to_s)
- end
-
- targets = [
- "1.0",
- "1.000000000000a",
- "+-5",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
- ]
- targets.each do |d|
- assert_raises(XSD::ValueSpaceError) do
- XSD::XSDPositiveInteger.new(d)
- end
- end
- end
-end
-
-
-end
diff --git a/test/xsd/xmlschema.xml b/test/xsd/xmlschema.xml
deleted file mode 100644
index 018bd0cc67..0000000000
--- a/test/xsd/xmlschema.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<xs:schema
- attributeFormDefault="qualified"
- elementFormDefault="qualified"
- targetNamespace="urn:jp.gr.jin.rrr.example.fakeschema"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element name="MessageDataSet">
- <xs:complexType>
- <xs:choice maxOccurs="unbounded" />
- </xs:complexType>
- </xs:element>
-</xs:schema>