diff --git a/vendor/gems/soap4r-1.5.8/.specification b/vendor/gems/soap4r-1.5.8/.specification new file mode 100644 index 00000000..5f64ff07 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/.specification @@ -0,0 +1,566 @@ +--- !ruby/object:Gem::Specification +name: soap4r +version: !ruby/object:Gem::Version + version: 1.5.8 +platform: ruby +authors: +- NAKAMURA, Hiroshi +autorequire: +bindir: bin +cert_chain: +date: 2007-09-23 00:00:00 -07:00 +default_executable: +dependencies: +- !ruby/object:Gem::Dependency + name: httpclient + type: :runtime + version_requirement: + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: 2.1.1 + version: +description: +email: nahi@ruby-lang.org +executables: +- wsdl2ruby.rb +- xsd2ruby.rb +extensions: [] + +extra_rdoc_files: [] + +files: +- bin/wsdl2ruby.rb +- bin/xsd2ruby.rb +- lib/tags +- lib/xsd +- lib/xsd/datatypes.rb +- lib/xsd/namedelements.rb +- lib/xsd/iconvcharset.rb +- lib/xsd/charset.rb +- lib/xsd/qname.rb +- lib/xsd/mapping.rb +- lib/xsd/codegen +- lib/xsd/codegen/methoddef.rb +- lib/xsd/codegen/moduledef.rb +- lib/xsd/codegen/gensupport.rb +- lib/xsd/codegen/commentdef.rb +- lib/xsd/codegen/classdef.rb +- lib/xsd/xmlparser +- lib/xsd/xmlparser/xmlscanner.rb +- lib/xsd/xmlparser/rexmlparser.rb +- lib/xsd/xmlparser/parser.rb +- lib/xsd/xmlparser/xmlparser.rb +- lib/xsd/codegen.rb +- lib/xsd/xmlparser.rb +- lib/xsd/ns.rb +- lib/xsd/datatypes1999.rb +- lib/wsdl +- lib/wsdl/xmlSchema +- lib/wsdl/xmlSchema/fractiondigits.rb +- lib/wsdl/xmlSchema/union.rb +- lib/wsdl/xmlSchema/importHandler.rb +- lib/wsdl/xmlSchema/minexclusive.rb +- lib/wsdl/xmlSchema/complexRestriction.rb +- lib/wsdl/xmlSchema/totaldigits.rb +- lib/wsdl/xmlSchema/group.rb +- lib/wsdl/xmlSchema/include.rb +- lib/wsdl/xmlSchema/annotation.rb +- lib/wsdl/xmlSchema/content.rb +- lib/wsdl/xmlSchema/maxexclusive.rb +- lib/wsdl/xmlSchema/element.rb +- lib/wsdl/xmlSchema/choice.rb +- lib/wsdl/xmlSchema/unique.rb +- lib/wsdl/xmlSchema/sequence.rb +- lib/wsdl/xmlSchema/list.rb +- lib/wsdl/xmlSchema/any.rb +- lib/wsdl/xmlSchema/maxinclusive.rb +- lib/wsdl/xmlSchema/attribute.rb +- lib/wsdl/xmlSchema/complexType.rb +- lib/wsdl/xmlSchema/enumeration.rb +- lib/wsdl/xmlSchema/length.rb +- lib/wsdl/xmlSchema/maxlength.rb +- lib/wsdl/xmlSchema/complexExtension.rb +- lib/wsdl/xmlSchema/simpleType.rb +- lib/wsdl/xmlSchema/parser.rb +- lib/wsdl/xmlSchema/pattern.rb +- lib/wsdl/xmlSchema/whitespace.rb +- lib/wsdl/xmlSchema/all.rb +- lib/wsdl/xmlSchema/schema.rb +- lib/wsdl/xmlSchema/xsd2ruby.rb +- lib/wsdl/xmlSchema/simpleContent.rb +- lib/wsdl/xmlSchema/mininclusive.rb +- lib/wsdl/xmlSchema/complexContent.rb +- lib/wsdl/xmlSchema/anyAttribute.rb +- lib/wsdl/xmlSchema/minlength.rb +- lib/wsdl/xmlSchema/simpleExtension.rb +- lib/wsdl/xmlSchema/simpleRestriction.rb +- lib/wsdl/xmlSchema/attributeGroup.rb +- lib/wsdl/xmlSchema/data.rb +- lib/wsdl/xmlSchema/import.rb +- lib/wsdl/xmlSchema/importer.rb +- lib/wsdl/documentation.rb +- lib/wsdl/param.rb +- lib/wsdl/portType.rb +- lib/wsdl/definitions.rb +- lib/wsdl/wsdl.rb +- lib/wsdl/operation.rb +- lib/wsdl/operationBinding.rb +- lib/wsdl/parser.rb +- lib/wsdl/message.rb +- lib/wsdl/port.rb +- lib/wsdl/types.rb +- lib/wsdl/part.rb +- lib/wsdl/soap +- lib/wsdl/soap/servletStubCreator.rb +- lib/wsdl/soap/body.rb +- lib/wsdl/soap/methodDefCreator.rb +- lib/wsdl/soap/encodedMappingRegistryCreator.rb +- lib/wsdl/soap/driverCreator.rb +- lib/wsdl/soap/literalMappingRegistryCreator.rb +- lib/wsdl/soap/element.rb +- lib/wsdl/soap/definitions.rb +- lib/wsdl/soap/servantSkeltonCreator.rb +- lib/wsdl/soap/standaloneServerStubCreator.rb +- lib/wsdl/soap/mappingRegistryCreatorSupport.rb +- lib/wsdl/soap/fault.rb +- lib/wsdl/soap/complexType.rb +- lib/wsdl/soap/cgiStubCreator.rb +- lib/wsdl/soap/operation.rb +- lib/wsdl/soap/address.rb +- lib/wsdl/soap/wsdl2ruby.rb +- lib/wsdl/soap/clientSkeltonCreator.rb +- lib/wsdl/soap/classDefCreatorSupport.rb +- lib/wsdl/soap/headerfault.rb +- lib/wsdl/soap/classDefCreator.rb +- lib/wsdl/soap/mappingRegistryCreator.rb +- lib/wsdl/soap/classNameCreator.rb +- lib/wsdl/soap/binding.rb +- lib/wsdl/soap/data.rb +- lib/wsdl/soap/header.rb +- lib/wsdl/binding.rb +- lib/wsdl/service.rb +- lib/wsdl/data.rb +- lib/wsdl/import.rb +- lib/wsdl/importer.rb +- lib/wsdl/info.rb +- lib/soap +- lib/soap/mappingRegistry.rb +- lib/soap/filter +- lib/soap/filter/filterchain.rb +- lib/soap/filter/streamhandler.rb +- lib/soap/filter/handler.rb +- lib/soap/encodingstyle +- lib/soap/encodingstyle/literalHandler.rb +- lib/soap/encodingstyle/soapHandler.rb +- lib/soap/encodingstyle/aspDotNetHandler.rb +- lib/soap/encodingstyle/handler.rb +- lib/soap/wsdlDriver.rb +- lib/soap/rpc +- lib/soap/rpc/driver.rb +- lib/soap/rpc/element.rb +- lib/soap/rpc/soaplet.rb +- lib/soap/rpc/cgistub.rb +- lib/soap/rpc/proxy.rb +- lib/soap/rpc/rpc.rb +- lib/soap/rpc/standaloneServer.rb +- lib/soap/rpc/router.rb +- lib/soap/rpc/httpserver.rb +- lib/soap/XMLSchemaDatatypes.rb +- lib/soap/marshal.rb +- lib/soap/driver.rb +- lib/soap/mapping +- lib/soap/mapping/registry.rb +- lib/soap/mapping/typeMap.rb +- lib/soap/mapping/mapping.rb +- lib/soap/mapping/rubytypeFactory.rb +- lib/soap/mapping/encodedregistry.rb +- lib/soap/mapping/wsdlencodedregistry.rb +- lib/soap/mapping/factory.rb +- lib/soap/mapping/wsdlliteralregistry.rb +- lib/soap/mapping/schemadefinition.rb +- lib/soap/mapping/literalregistry.rb +- lib/soap/nestedexception.rb +- lib/soap/element.rb +- lib/soap/charset.rb +- lib/soap/qname.rb +- lib/soap/httpconfigloader.rb +- lib/soap/netHttpClient.rb +- lib/soap/mapping.rb +- lib/soap/cgistub.rb +- lib/soap/XMLSchemaDatatypes1999.rb +- lib/soap/proxy.rb +- lib/soap/filter.rb +- lib/soap/baseData.rb +- lib/soap/streamHandler.rb +- lib/soap/generator.rb +- lib/soap/rpcUtils.rb +- lib/soap/mimemessage.rb +- lib/soap/header +- lib/soap/header/simplehandler.rb +- lib/soap/header/handlerset.rb +- lib/soap/header/mappinghandler.rb +- lib/soap/header/handler.rb +- lib/soap/property.rb +- lib/soap/attachment.rb +- lib/soap/parser.rb +- lib/soap/processor.rb +- lib/soap/standaloneServer.rb +- lib/soap/server.rb +- lib/soap/rpcRouter.rb +- lib/soap/ns.rb +- lib/soap/compat.rb +- lib/soap/soap.rb +- lib/soap/namespace.rb +- test/interopR4 +- test/interopR4/client.rb +- test/testutil.rb +- test/sm11 +- test/sm11/driver.rb +- test/sm11/servant.rb +- test/sm11/classDef.rb +- test/sm11/server.rb +- test/sm11/client.rb +- test/xsd +- test/xsd/xmlschema.xml +- test/xsd/test_xsd.rb +- test/xsd/xsd2ruby +- test/xsd/xsd2ruby/expected_mysample.rb +- test/xsd/xsd2ruby/section.xsd +- test/xsd/xsd2ruby/expected_mysample_mapper.rb +- test/xsd/xsd2ruby/test_xsd2ruby.rb +- test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb +- test/xsd/test_noencoding.rb +- test/xsd/codegen +- test/xsd/codegen/test_classdef.rb +- test/xsd/noencoding.xml +- test/xsd/test_xmlschemaparser.rb +- test/xsd/test_ns.rb +- test/xsd/xmllang.xml +- test/wsdl +- test/wsdl/simpletype +- test/wsdl/simpletype/rpc +- test/wsdl/simpletype/rpc/expectedEchoVersion.rb +- test/wsdl/simpletype/rpc/test_rpc.rb +- test/wsdl/simpletype/rpc/expectedClient.rb +- test/wsdl/simpletype/rpc/expectedDriver.rb +- test/wsdl/simpletype/rpc/expectedMappingRegistry.rb +- test/wsdl/simpletype/rpc/rpc.wsdl +- test/wsdl/simpletype/rpc/expectedServant.rb +- test/wsdl/simpletype/rpc/expectedService.rb +- test/wsdl/simpletype/simpletype.wsdl +- test/wsdl/simpletype/test_simpletype.rb +- test/wsdl/abstract +- test/wsdl/abstract/test_abstract.rb +- test/wsdl/abstract/abstract.wsdl +- test/wsdl/rpc +- test/wsdl/rpc/test_rpc.rb +- test/wsdl/rpc/test_rpc_lit.rb +- test/wsdl/rpc/test-rpc-lit.wsdl +- test/wsdl/rpc/rpc.wsdl +- test/wsdl/test_multiplefault.rb +- test/wsdl/marshal +- test/wsdl/marshal/person.wsdl +- test/wsdl/marshal/test_wsdlmarshal.rb +- test/wsdl/marshal/person_org.rb +- test/wsdl/choice +- test/wsdl/choice/choice.wsdl +- test/wsdl/choice/test_choice.rb +- test/wsdl/simplecontent +- test/wsdl/simplecontent/test_simplecontent.rb +- test/wsdl/simplecontent/simplecontent.wsdl +- test/wsdl/overload +- test/wsdl/overload/overload.wsdl +- test/wsdl/overload/test_overload.rb +- test/wsdl/complexcontent +- test/wsdl/complexcontent/test_echo.rb +- test/wsdl/complexcontent/complexContent.wsdl +- test/wsdl/multiplefault.wsdl +- test/wsdl/raa +- test/wsdl/raa/README.txt +- test/wsdl/raa/RAAService.rb +- test/wsdl/raa/raa.wsdl +- test/wsdl/raa/test_raa.rb +- test/wsdl/raa/expectedDriver.rb +- test/wsdl/raa/expectedMappingRegistry.rb +- test/wsdl/raa/expectedClassDef.rb +- test/wsdl/document +- test/wsdl/document/test_rpc.rb +- test/wsdl/document/test_number.rb +- test/wsdl/document/ping_nosoapaction.wsdl +- test/wsdl/document/document.wsdl +- test/wsdl/document/number.wsdl +- test/wsdl/document/array +- test/wsdl/document/array/test_array.rb +- test/wsdl/document/array/double.wsdl +- test/wsdl/document/test_nosoapaction.rb +- test/wsdl/any +- test/wsdl/any/expectedDriver.rb +- test/wsdl/any/expectedMappingRegistry.rb +- test/wsdl/any/expectedEcho.rb +- test/wsdl/any/any.wsdl +- test/wsdl/any/test_any.rb +- test/wsdl/any/expectedService.rb +- test/wsdl/datetime +- test/wsdl/datetime/datetimeServant.rb +- test/wsdl/datetime/test_datetime.rb +- test/wsdl/datetime/datetime.wsdl +- test/wsdl/datetime/DatetimeService.rb +- test/wsdl/datetime/datetime.rb +- test/wsdl/list +- test/wsdl/list/test_list.rb +- test/wsdl/list/list.wsdl +- test/wsdl/ref +- test/wsdl/ref/product.wsdl +- test/wsdl/ref/test_ref.rb +- test/wsdl/ref/expectedDriver.rb +- test/wsdl/ref/expectedProduct.rb +- test/wsdl/test_fault.rb +- test/wsdl/emptycomplextype.wsdl +- test/wsdl/test_emptycomplextype.rb +- test/wsdl/map +- test/wsdl/map/map.xml +- test/wsdl/map/map.wsdl +- test/wsdl/map/test_map.rb +- test/wsdl/axisArray +- test/wsdl/axisArray/test_axisarray.rb +- test/wsdl/axisArray/axisArray.wsdl +- test/wsdl/qualified +- test/wsdl/qualified/np.wsdl +- test/wsdl/qualified/lp.xsd +- test/wsdl/qualified/test_qualified.rb +- test/wsdl/qualified/test_unqualified.rb +- test/wsdl/qualified/lp.wsdl +- test/wsdl/soap +- test/wsdl/soap/test_soapbodyparts.rb +- test/wsdl/soap/soapbodyparts.wsdl +- test/wsdl/soap/wsdl2ruby +- test/wsdl/soap/wsdl2ruby/expectedClassdef.rb +- test/wsdl/soap/wsdl2ruby/expectedClient.rb +- test/wsdl/soap/wsdl2ruby/section +- test/wsdl/soap/wsdl2ruby/section/test_section.rb +- test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb +- test/wsdl/soap/wsdl2ruby/section/section.xsd +- test/wsdl/soap/wsdl2ruby/expectedDriver.rb +- test/wsdl/soap/wsdl2ruby/expectedService.cgi +- test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb +- test/wsdl/soap/wsdl2ruby/soapenc +- test/wsdl/soap/wsdl2ruby/soapenc/soapenc.wsdl +- test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb +- test/wsdl/soap/wsdl2ruby/rpc.wsdl +- test/wsdl/soap/wsdl2ruby/expectedServant.rb +- test/wsdl/soap/wsdl2ruby/expectedService.rb +- test/wsdl/soap/wsdl2ruby/test_wsdl2ruby.rb +- test/wsdl/anonymous +- test/wsdl/anonymous/test_anonymous.rb +- test/wsdl/anonymous/expectedDriver.rb +- test/wsdl/anonymous/expectedMappingRegistry.rb +- test/wsdl/anonymous/expectedClassDef.rb +- test/wsdl/anonymous/lp.wsdl +- test/wsdl/oneway +- test/wsdl/oneway/test_oneway.rb +- test/wsdl/oneway/oneway.wsdl +- test/wsdl/group +- test/wsdl/group/expectedClassdef.rb +- test/wsdl/group/test_rpc.rb +- test/wsdl/group/group.wsdl +- test/wsdl/group/expectedDriver.rb +- test/wsdl/group/expectedMappingRegistry.rb +- test/wsdl/soaptype +- test/wsdl/soaptype/soaptype.wsdl +- test/wsdl/soaptype/test_soaptype.rb +- test/wsdl/fault +- test/wsdl/fault/test_multifault.rb +- test/wsdl/fault/test_fault.rb +- test/wsdl/fault/multifault.wsdl +- test/wsdl/fault/fault.wsdl +- test/runner.rb +- test/interopR2 +- test/interopR2/clientBEAWebLogic.rb +- test/interopR2/client4S4C2.rb +- test/interopR2/client.log +- test/interopR2/rwikiInteropService.rb +- test/interopR2/InteropTest.wsdl +- test/interopR2/clientJSOAP.rb +- test/interopR2/clientMSSOAPToolkit2.0.rb +- test/interopR2/clientOpenLink.rb +- test/interopR2/clientSilverStream.rb +- test/interopR2/clientSIMACE.rb +- test/interopR2/clientMSSOAPToolkit3.0.rb +- test/interopR2/InteropTestDriver.rb +- test/interopR2/clientApacheAxis.rb +- test/interopR2/SOAPBuildersInterop_R2GrB.wsdl +- test/interopR2/clientWASP.rb +- test/interopR2/InteropTestC.wsdl +- test/interopR2/clientEasySoap.rb +- test/interopR2/README.txt +- test/interopR2/interopService.rb +- test/interopR2/clientGLUE.rb +- test/interopR2/SOAPBuildersInterop_R2.wsdl +- test/interopR2/clientBase.rb +- test/interopR2/clientWASPC.rb +- test/interopR2/clientSpray2001.rb +- test/interopR2/clientASP.NET.rb +- test/interopR2/clientNuSOAP.rb +- test/interopR2/clientCapeConnect.rb +- test/interopR2/clientZSI.rb +- test/interopR2/clientSQLData.rb +- test/interopR2/groupc.wsdl +- test/interopR2/clientJAX-RPC.rb +- test/interopR2/iSimonReg.rb +- test/interopR2/clientWhiteMesa.rb +- test/interopR2/clienteSOAP.rb +- test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2GroupB.wsdl +- test/interopR2/clientOracle.rb +- test/interopR2/clientSun.rb +- test/interopR2/clientHP.rb +- test/interopR2/clientgSOAP.rb +- test/interopR2/simonReg.rb +- test/interopR2/clientDelphi.rb +- test/interopR2/clientXMLRPC-EPI.rb +- test/interopR2/client4S4C.rb +- test/interopR2/clientPhalanx.rb +- test/interopR2/server.cgi +- test/interopR2/clientPEAR.rb +- test/interopR2/clientkSOAP.rb +- test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2.wsdl +- test/interopR2/clientVWOpentalkSoap.rb +- test/interopR2/clientSOAP4R.rb +- test/interopR2/clientNuWave.rb +- test/interopR2/clientKafkaXSLT.rb +- test/interopR2/InteropTest.rb +- test/interopR2/server.rb +- test/interopR2/interopResultBase.rb +- test/interopR2/clientXSOAP.rb +- test/interopR2/clientFrontier.rb +- test/interopR2/client.rb +- test/interopR2/test.sh +- test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2GroupCClient.rb +- test/interopR2/clientWebMethods.rb +- test/interopR2/clientWingfoot.rb +- test/interopR2/SOAPBuildersInterop_R2GrC.wsdl +- test/interopR2/base.rb +- test/interopR2/clientXMLBus.rb +- test/interopR2/client.NetRemoting.rb +- test/interopR2/clientSOAP__Lite.rb +- test/interopR2/clientApacheSOAP.rb +- test/soap +- test/soap/ssl +- test/soap/ssl/client.cert +- test/soap/ssl/server.cert +- test/soap/ssl/README +- test/soap/ssl/test_ssl.rb +- test/soap/ssl/sslsvr.rb +- test/soap/ssl/server.key +- test/soap/ssl/ca.cert +- test/soap/ssl/client.key +- test/soap/ssl/subca.cert +- test/soap/filter +- test/soap/filter/test_filter.rb +- test/soap/marshal +- test/soap/marshal/test_digraph.rb +- test/soap/marshal/test_struct.rb +- test/soap/marshal/test_marshal.rb +- test/soap/marshal/marshaltestlib.rb +- test/soap/test_generator.rb +- test/soap/test_nestedexception.rb +- test/soap/helloworld +- test/soap/helloworld/test_helloworld.rb +- test/soap/helloworld/hw_s.rb +- test/soap/test_basetype.rb +- test/soap/test_custommap.rb +- test/soap/calc +- test/soap/calc/test_calc2.rb +- test/soap/calc/server2.rb +- test/soap/calc/test_calc_cgi.rb +- test/soap/calc/calc.rb +- test/soap/calc/calc2.rb +- test/soap/calc/server.cgi +- test/soap/calc/test_calc.rb +- test/soap/calc/server.rb +- test/soap/test_empty.rb +- test/soap/test_extraattr.rb +- test/soap/test_response_as_xml.rb +- test/soap/wsdlDriver +- test/soap/wsdlDriver/test_document.rb +- test/soap/wsdlDriver/README.txt +- test/soap/wsdlDriver/simpletype.wsdl +- test/soap/wsdlDriver/calc.wsdl +- test/soap/wsdlDriver/echo_version.rb +- test/soap/wsdlDriver/document.wsdl +- test/soap/wsdlDriver/test_calc.rb +- test/soap/wsdlDriver/test_simpletype.rb +- test/soap/test_soapelement.rb +- test/soap/test_httpconfigloader.rb +- test/soap/test_envelopenamespace.rb +- test/soap/struct +- test/soap/struct/test_struct.rb +- test/soap/test_nil.rb +- test/soap/case +- test/soap/case/test_mapping.rb +- test/soap/test_cookie.rb +- test/soap/test_property.rb +- test/soap/test_streamhandler.rb +- test/soap/header +- test/soap/header/test_simplehandler.rb +- test/soap/header/test_authheader.rb +- test/soap/header/server.cgi +- test/soap/header/test_authheader_cgi.rb +- test/soap/asp.net +- test/soap/asp.net/hello.wsdl +- test/soap/asp.net/test_aspdotnet.rb +- test/soap/styleuse +- test/soap/styleuse/server.rb +- test/soap/styleuse/client.rb +- test/soap/test_styleuse.rb +- test/soap/test_no_indent.rb +- test/soap/test_custom_ns.rb +- test/soap/htpasswd +- test/soap/literalArrayMapping +- test/soap/literalArrayMapping/amazonEcDriver.rb +- test/soap/literalArrayMapping/amazonresponse.xml +- test/soap/literalArrayMapping/amazonEc.rb +- test/soap/literalArrayMapping/test_definedarray.rb +- test/soap/auth +- test/soap/auth/htdigest +- test/soap/auth/test_basic.rb +- test/soap/auth/htpasswd +- test/soap/auth/test_digest.rb +- test/soap/swa +- test/soap/swa/test_file.rb +- test/soap/fault +- test/soap/fault/test_soaparray.rb +- test/soap/fault/test_customfault.rb +- test/soap/test_mapping.rb +- test/16runner.rb +has_rdoc: true +homepage: http://dev.ctor.org/soap4r +licenses: [] + +post_install_message: +rdoc_options: [] + +require_paths: +- lib +required_ruby_version: !ruby/object:Gem::Requirement + requirements: + - - ">" + - !ruby/object:Gem::Version + version: 0.0.0 + version: +required_rubygems_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: "0" + version: +requirements: [] + +rubyforge_project: +rubygems_version: 1.3.5 +signing_key: +specification_version: 1 +summary: An implementation of SOAP 1.1 for Ruby. +test_files: +- test/runner.rb diff --git a/vendor/gems/soap4r-1.5.8/bin/wsdl2ruby.rb b/vendor/gems/soap4r-1.5.8/bin/wsdl2ruby.rb new file mode 100644 index 00000000..37bae513 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/bin/wsdl2ruby.rb @@ -0,0 +1,137 @@ +#!/usr/bin/env ruby + +require 'getoptlong' +require 'logger' +require 'wsdl/soap/wsdl2ruby' + + +class WSDL2RubyApp < Logger::Application +private + + OptSet = [ + ['--wsdl','-w', GetoptLong::REQUIRED_ARGUMENT], + ['--module_path','-m', GetoptLong::REQUIRED_ARGUMENT], + ['--type','-t', GetoptLong::REQUIRED_ARGUMENT], + ['--classdef','-e', GetoptLong::OPTIONAL_ARGUMENT], + ['--mapping_registry','-r', GetoptLong::NO_ARGUMENT], + ['--client_skelton','-c', GetoptLong::OPTIONAL_ARGUMENT], + ['--servant_skelton','-s', GetoptLong::OPTIONAL_ARGUMENT], + ['--cgi_stub','-g', GetoptLong::OPTIONAL_ARGUMENT], + ['--servlet_stub','-l', GetoptLong::OPTIONAL_ARGUMENT], + ['--standalone_server_stub','-a', GetoptLong::OPTIONAL_ARGUMENT], + ['--driver','-d', GetoptLong::OPTIONAL_ARGUMENT], + ['--drivername_postfix','-n', GetoptLong::REQUIRED_ARGUMENT], + ['--force','-f', GetoptLong::NO_ARGUMENT], + ['--quiet','-q', GetoptLong::NO_ARGUMENT], + ] + + def initialize + super('app') + STDERR.sync = true + self.level = Logger::FATAL + end + + def run + @worker = WSDL::SOAP::WSDL2Ruby.new + @worker.logger = @log + location, opt = parse_opt(GetoptLong.new(*OptSet)) + usage_exit unless location + @worker.location = location + if opt['quiet'] + self.level = Logger::FATAL + else + self.level = Logger::INFO + end + @worker.opt.update(opt) + @worker.run + 0 + end + + def usage_exit + puts <<__EOU__ +Usage: #{ $0 } --wsdl wsdl_location [options] + wsdl_location: filename or URL + +Example: + For server side: + #{ $0 } --wsdl myapp.wsdl --type server + For client side: + #{ $0 } --wsdl myapp.wsdl --type client + +Options: + --wsdl wsdl_location + --type server|client + --type server implies; + --classdef --mapping_registry --servant_skelton --standalone_server_stub + --type client implies; + --classdef --mapping_registry --client_skelton --driver + --classdef [filenameprefix] + --mapping_registry + --client_skelton [servicename] + --servant_skelton [porttypename] + --cgi_stub [servicename] + --servlet_stub [servicename] + --standalone_server_stub [servicename] + --driver [porttypename] + --drivername_postfix driver_classname_postfix + --module_path Module::Path::Name + --force + --quiet + +Terminology: + Client <-> Driver <-(SOAP)-> Stub <-> Servant + + Driver and Stub: Automatically generated + Client and Servant: Skelton generated (you should change) +__EOU__ + exit 1 + end + + def parse_opt(getoptlong) + opt = {} + wsdl = nil + begin + getoptlong.each do |name, arg| + case name + when "--wsdl" + wsdl = arg + when "--module_path" + opt['module_path'] = arg + when "--type" + case arg + when "server" + opt['classdef'] ||= nil + opt['mapping_registry'] ||= nil + opt['servant_skelton'] ||= nil + opt['standalone_server_stub'] ||= nil + when "client" + opt['classdef'] ||= nil + opt['mapping_registry'] ||= nil + opt['driver'] ||= nil + opt['client_skelton'] ||= nil + else + raise ArgumentError.new("Unknown type #{ arg }") + end + when "--classdef", "--mapping_registry", + "--client_skelton", "--servant_skelton", + "--cgi_stub", "--servlet_stub", "--standalone_server_stub", + "--driver" + opt[name.sub(/^--/, '')] = arg.empty? ? nil : arg + when "--drivername_postfix" + opt['drivername_postfix'] = arg + when "--force" + opt['force'] = true + when "--quiet" + opt['quiet'] = true + else + raise ArgumentError.new("Unknown type #{ arg }") + end + end + rescue + usage_exit + end + return wsdl, opt + end +end + +WSDL2RubyApp.new.start diff --git a/vendor/gems/soap4r-1.5.8/bin/xsd2ruby.rb b/vendor/gems/soap4r-1.5.8/bin/xsd2ruby.rb new file mode 100644 index 00000000..26dfc135 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/bin/xsd2ruby.rb @@ -0,0 +1,90 @@ +#!/usr/bin/env ruby + +require 'getoptlong' +require 'logger' +require 'wsdl/xmlSchema/xsd2ruby' + + +class XSD2RubyApp < Logger::Application +private + + OptSet = [ + ['--xsd','-x', GetoptLong::REQUIRED_ARGUMENT], + ['--module_path','-m', GetoptLong::REQUIRED_ARGUMENT], + ['--classdef','-e', GetoptLong::OPTIONAL_ARGUMENT], + ['--mapping_registry','-r', GetoptLong::NO_ARGUMENT], + ['--mapper','-p', GetoptLong::NO_ARGUMENT], + ['--force','-f', GetoptLong::NO_ARGUMENT], + ['--quiet','-q', GetoptLong::NO_ARGUMENT], + ] + + def initialize + super('app') + STDERR.sync = true + self.level = Logger::FATAL + end + + def run + @worker = WSDL::XMLSchema::XSD2Ruby.new + @worker.logger = @log + location, opt = parse_opt(GetoptLong.new(*OptSet)) + usage_exit unless location + @worker.location = location + if opt['quiet'] + self.level = Logger::FATAL + else + self.level = Logger::INFO + end + @worker.opt.update(opt) + @worker.run + 0 + end + + def usage_exit + puts <<__EOU__ +Usage: #{ $0 } --xsd xsd_location [options] + xsd_location: filename or URL + +Example: + #{ $0 } --xsd myapp.xsd --classdef foo + +Options: + --xsd xsd_location + --classdef [filenameprefix] + --mapping_registry + --mapper + --module_path [Module::Path::Name] + --force + --quiet +__EOU__ + exit 1 + end + + def parse_opt(getoptlong) + opt = {} + xsd = nil + begin + getoptlong.each do |name, arg| + case name + when "--xsd" + xsd = arg + when "--module_path" + opt['module_path'] = arg + when "--classdef", "--mapping_registry", "--mapper" + opt[name.sub(/^--/, '')] = arg.empty? ? nil : arg + when "--force" + opt['force'] = true + when "--quiet" + opt['quiet'] = true + else + raise ArgumentError.new("Unknown type #{ arg }") + end + end + rescue + usage_exit + end + return xsd, opt + end +end + +XSD2RubyApp.new.start diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/XMLSchemaDatatypes.rb b/vendor/gems/soap4r-1.5.8/lib/soap/XMLSchemaDatatypes.rb new file mode 100644 index 00000000..481f5523 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/XMLSchemaDatatypes.rb @@ -0,0 +1,9 @@ +# soap/XMLSchemaDatatypes.rb: SOAP4R - XML Schema Datatype implementation. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/XMLSchemaDatatypes1999.rb b/vendor/gems/soap4r-1.5.8/lib/soap/XMLSchemaDatatypes1999.rb new file mode 100644 index 00000000..928b40f4 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/XMLSchemaDatatypes1999.rb @@ -0,0 +1,10 @@ +# soap/XMLSchemaDatatypes1999.rb: SOAP4R - XML Schema Datatype 1999 support +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/datatypes1999' +load 'soap/mapping/typeMap.rb' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/attachment.rb b/vendor/gems/soap4r-1.5.8/lib/soap/attachment.rb new file mode 100644 index 00000000..85b9078b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/attachment.rb @@ -0,0 +1,108 @@ +# soap/attachment.rb: SOAP4R - SwA implementation. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + @content = 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/vendor/gems/soap4r-1.5.8/lib/soap/baseData.rb b/vendor/gems/soap4r-1.5.8/lib/soap/baseData.rb new file mode 100644 index 00000000..1b028fa7 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/baseData.rb @@ -0,0 +1,1092 @@ +# soap/baseData.rb: SOAP4R - Base type library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 'xsd/codegen/gensupport' +require 'soap/mapping/mapping' + + +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 + + def to_data(str) + new(str).data + 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 + + attr_accessor :qualified + + def initialize(*arg) + super + @qualified = nil + end +end + + +### +## for SOAP compound type +# +module SOAPCompoundtype + include SOAPType + include SOAP + + attr_accessor :qualified + + def initialize(*arg) + super + @qualified = nil + end +end + +# marker for compound types which have named accessor +module SOAPNameAccessible +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 + + # for referenced base type such as a long value from Axis. + # base2obj requires a node to respond to :data + def data + if @obj.respond_to?(:data) + @obj.data + 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 + +public + + def initialize(value = nil) + super(value) + @extraattr[XSD::AttrNilName] = 'true' + end +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 + SOAPENCType = QName.new(EncodingNamespace, StringLiteral) +end + +class SOAPNormalizedString < XSD::XSDNormalizedString + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, NormalizedStringLiteral) +end + +class SOAPToken < XSD::XSDToken + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, TokenLiteral) +end + +class SOAPLanguage < XSD::XSDLanguage + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, LanguageLiteral) +end + +class SOAPNMTOKEN < XSD::XSDNMTOKEN + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, NMTOKENLiteral) +end + +class SOAPNMTOKENS < XSD::XSDNMTOKENS + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, NMTOKENSLiteral) +end + +class SOAPName < XSD::XSDName + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, NameLiteral) +end + +class SOAPNCName < XSD::XSDNCName + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, NCNameLiteral) +end + +class SOAPID < XSD::XSDID + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, IDLiteral) +end + +class SOAPIDREF < XSD::XSDIDREF + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, IDREFLiteral) +end + +class SOAPIDREFS < XSD::XSDIDREFS + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, IDREFSLiteral) +end + +class SOAPENTITY < XSD::XSDENTITY + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, ENTITYLiteral) +end + +class SOAPENTITIES < XSD::XSDENTITIES + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, ENTITIESLiteral) +end + +class SOAPBoolean < XSD::XSDBoolean + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, BooleanLiteral) +end + +class SOAPDecimal < XSD::XSDDecimal + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, DecimalLiteral) +end + +class SOAPFloat < XSD::XSDFloat + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, FloatLiteral) +end + +class SOAPDouble < XSD::XSDDouble + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, DoubleLiteral) +end + +class SOAPDuration < XSD::XSDDuration + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, DurationLiteral) +end + +class SOAPDateTime < XSD::XSDDateTime + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, DateTimeLiteral) +end + +class SOAPTime < XSD::XSDTime + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, TimeLiteral) +end + +class SOAPDate < XSD::XSDDate + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, DateLiteral) +end + +class SOAPGYearMonth < XSD::XSDGYearMonth + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, GYearMonthLiteral) +end + +class SOAPGYear < XSD::XSDGYear + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, GYearLiteral) +end + +class SOAPGMonthDay < XSD::XSDGMonthDay + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, GMonthDayLiteral) +end + +class SOAPGDay < XSD::XSDGDay + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, GDayLiteral) +end + +class SOAPGMonth < XSD::XSDGMonth + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, GMonthLiteral) +end + +class SOAPHexBinary < XSD::XSDHexBinary + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, HexBinaryLiteral) +end + +class SOAPBase64 < XSD::XSDBase64Binary + include SOAPBasetype + extend SOAPModuleUtils + Type = SOAPENCType = QName.new(EncodingNamespace, Base64Literal) + +public + + 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 + SOAPENCType = QName.new(EncodingNamespace, AnyURILiteral) +end + +class SOAPQName < XSD::XSDQName + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, QNameLiteral) +end + + +class SOAPInteger < XSD::XSDInteger + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, IntegerLiteral) +end + +class SOAPNonPositiveInteger < XSD::XSDNonPositiveInteger + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, NonPositiveIntegerLiteral) +end + +class SOAPNegativeInteger < XSD::XSDNegativeInteger + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, NegativeIntegerLiteral) +end + +class SOAPLong < XSD::XSDLong + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, LongLiteral) +end + +class SOAPInt < XSD::XSDInt + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, IntLiteral) +end + +class SOAPShort < XSD::XSDShort + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, ShortLiteral) +end + +class SOAPByte < XSD::XSDByte + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, ByteLiteral) +end + +class SOAPNonNegativeInteger < XSD::XSDNonNegativeInteger + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, NonNegativeIntegerLiteral) +end + +class SOAPUnsignedLong < XSD::XSDUnsignedLong + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, UnsignedLongLiteral) +end + +class SOAPUnsignedInt < XSD::XSDUnsignedInt + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, UnsignedIntLiteral) +end + +class SOAPUnsignedShort < XSD::XSDUnsignedShort + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, UnsignedShortLiteral) +end + +class SOAPUnsignedByte < XSD::XSDUnsignedByte + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, UnsignedByteLiteral) +end + +class SOAPPositiveInteger < XSD::XSDPositiveInteger + include SOAPBasetype + extend SOAPModuleUtils + SOAPENCType = QName.new(EncodingNamespace, PositiveIntegerLiteral) +end + + +### +## Compound datatypes. +# +class SOAPStruct < XSD::NSDBase + include Enumerable + include SOAPCompoundtype + include SOAPNameAccessible + +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) + 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 + + 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 have_member + !@array.empty? + 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 +end + + +# SOAPElement is not typed so it is not derived from NSDBase. +class SOAPElement + include Enumerable + include SOAPCompoundtype + include SOAPNameAccessible + + attr_accessor :type + # Text interface. + attr_accessor :text + alias data text + + def initialize(elename, text = nil) + super() + if elename.nil? + elename = XSD::QName::EMPTY + else + elename = Mapping.to_qname(elename) + end + @encodingstyle = LiteralNamespace + @elename = elename + @type = nil + + @array = [] + @data = [] + @text = text + end + + def inspect + sprintf("#<%s:0x%x %s>", self.class.name, __id__, self.elename) + + (@text ? " #{@text.inspect}" : '') + + @data.collect { |ele| "\n#{ele.inspect}" }.join.gsub(/^/, ' ') + end + + def set(value) + @text = value + end + + # Element interfaces. + def add(value) + name = value.elename.name + @array.push(name) + @data.push(value) + value.parent = self if value.respond_to?(:parent=) + 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 have_member + !@array.empty? + end + + def to_obj + if !have_member + @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_objs(objs) + objs.collect { |value| + if value.is_a?(SOAPElement) + value + else + k, v = value + ele = from_obj(v) + ele.elename = XSD::QName.new(nil, k) + ele + end + } + end + + # when obj is a Hash or an Array: + # when key starts with "xmlattr_": + # value is added as an XML attribute with the key name however the + # "xmlattr_" is dropped from the name. + # when key starts with "xmlele_": + # value is added as an XML element with the key name however the + # "xmlele_" is dropped from the name. + # if else: + # value is added as an XML element with the key name. + def self.from_obj(obj, namespace = nil) + return obj if obj.is_a?(SOAPElement) + o = SOAPElement.new(nil) + case obj + when nil + o.text = nil + when Hash, Array + obj.each do |name, value| + addname, is_attr = parse_name(name, namespace) + if value.is_a?(Array) + value.each do |subvalue| + if is_attr + o.extraattr[addname] = subvalue + else + child = from_obj(subvalue, namespace) + child.elename = addname + o.add(child) + end + end + else + if is_attr + o.extraattr[addname] = value + else + child = from_obj(value, namespace) + child.elename = addname + o.add(child) + end + end + end + else + o.text = obj.to_s + end + o + end + + def self.parse_name(obj, namespace = nil) + qname = to_qname(obj, namespace) + if /\Axmlele_/ =~ qname.name + qname = XSD::QName.new(qname.namespace, qname.name.sub(/\Axmlele_/, '')) + return qname, false + elsif /\Axmlattr_/ =~ qname.name + qname = XSD::QName.new(qname.namespace, qname.name.sub(/\Axmlattr_/, '')) + return qname, true + else + return qname, false + end + end + + def self.to_qname(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 +end + + +class SOAPRawData < SOAPElement + def initialize(obj) + super(XSD::QName::EMPTY) + @obj = obj + end + + def to_xmlpart + @obj.to_xmlpart + end +end + + +class SOAPREXMLElementWrap + def initialize(ele) + @ele = ele + end + + def to_xmlpart + @ele.to_s + 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 have_member + !@data.empty? + 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 = block.call(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 and data[idx] + 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 + + 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 + + def self.create_arytype(typename, rank) + "#{typename}[" << ',' * (rank - 1) << ']' + end + + TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$', nil, 'NONE') + + def self.parse_type(string) + TypeParseRegexp =~ string + return $1, $2 + end +end + + +require 'soap/mapping/typeMap' + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/cgistub.rb b/vendor/gems/soap4r-1.5.8/lib/soap/cgistub.rb new file mode 100644 index 00000000..d54e7ad5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/cgistub.rb @@ -0,0 +1,9 @@ +# SOAP4R - CGI stub library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/compat' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/charset.rb b/vendor/gems/soap4r-1.5.8/lib/soap/charset.rb new file mode 100644 index 00000000..b201a808 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/charset.rb @@ -0,0 +1,9 @@ +# SOAP4R - Charset encoding handler. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/compat' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/compat.rb b/vendor/gems/soap4r-1.5.8/lib/soap/compat.rb new file mode 100644 index 00000000..feb5e389 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/compat.rb @@ -0,0 +1,182 @@ +# SOAP4R - Compatibility definitions. +# Copyright (C) 2003 NAKAMURA, Hiroshi . + +# 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. + + +STDERR.puts "Loading compatibility library..." + + +require 'xsd/qname' +require 'xsd/ns' +require 'xsd/charset' +require 'soap/mapping' +require 'soap/rpc/rpc' +require 'soap/rpc/element' +require 'soap/rpc/driver' +require 'soap/rpc/cgistub' +require 'soap/rpc/router' +require 'soap/rpc/standaloneServer' + + +module SOAP + + +module RPC + RubyTypeNamespace = Mapping::RubyTypeNamespace + RubyTypeInstanceNamespace = Mapping::RubyTypeInstanceNamespace + RubyCustomTypeNamespace = Mapping::RubyCustomTypeNamespace + ApacheSOAPTypeNamespace = Mapping::ApacheSOAPTypeNamespace + + DefaultMappingRegistry = Mapping::DefaultRegistry + + def self.obj2soap(*arg); Mapping.obj2soap(*arg); end + def self.soap2obj(*arg); Mapping.soap2obj(*arg); end + def self.ary2soap(*arg); Mapping.ary2soap(*arg); end + def self.ary2md(*arg); Mapping.ary2md(*arg); end + def self.fault2exception(*arg); Mapping.fault2exception(*arg); end + + def self.defined_methods(obj) + if obj.is_a?(Module) + obj.methods - Module.methods + else + obj.methods - Kernel.instance_methods(true) + end + end +end + + +NS = XSD::NS +Charset = XSD::Charset +RPCUtils = RPC +RPCServerException = RPC::ServerException +RPCRouter = RPC::Router + + +class StandaloneServer < RPC::StandaloneServer + def initialize(*arg) + super + @router = @soaplet.app_scope_router + methodDef if respond_to?('methodDef') + end + + alias addServant add_servant + alias addMethod add_method + alias addMethodAs add_method_as +end + + +class CGIStub < RPC::CGIStub + def initialize(*arg) + super + methodDef if respond_to?('methodDef') + end + + alias addServant add_servant + + def addMethod(receiver, methodName, *paramArg) + addMethodWithNSAs(@default_namespace, receiver, methodName, methodName, *paramArg) + end + + def addMethodAs(receiver, methodName, methodNameAs, *paramArg) + addMethodWithNSAs(@default_namespace, receiver, methodName, methodNameAs, *paramArg) + end + + def addMethodWithNS(namespace, receiver, methodName, *paramArg) + addMethodWithNSAs(namespace, receiver, methodName, methodName, *paramArg) + end + + def addMethodWithNSAs(namespace, receiver, methodName, methodNameAs, *paramArg) + add_method_with_namespace_as(namespace, receiver, methodName, methodNameAs, *paramArg) + end +end + + +class Driver < RPC::Driver + include Logger::Severity + + attr_accessor :logdev + alias logDev= logdev= + alias logDev logdev + alias setWireDumpDev wiredump_dev= + alias setDefaultEncodingStyle default_encodingstyle= + alias mappingRegistry= mapping_registry= + alias mappingRegistry mapping_registry + + def initialize(log, logid, namespace, endpoint_url, httpproxy = nil, soapaction = nil) + super(endpoint_url, namespace, soapaction) + @logdev = log + @logid = logid + @logid_prefix = "<#{ @logid }> " + self.httpproxy = httpproxy if httpproxy + log(INFO) { 'initialize: initializing SOAP driver...' } + end + + def invoke(headers, body) + log(INFO) { "invoke: invoking message '#{ body.type }'." } + super + end + + def call(name, *params) + log(INFO) { "call: calling method '#{ name }'." } + log(DEBUG) { "call: parameters '#{ params.inspect }'." } + log(DEBUG) { + params = Mapping.obj2soap(params, @mapping_registry).to_a + "call: parameters '#{ params.inspect }'." + } + super + end + + def addMethod(name, *params) + addMethodWithSOAPActionAs(name, name, nil, *params) + end + + def addMethodAs(name_as, name, *params) + addMethodWithSOAPActionAs(name_as, name, nil, *params) + end + + def addMethodWithSOAPAction(name, soapaction, *params) + addMethodWithSOAPActionAs(name, name, soapaction, *params) + end + + def addMethodWithSOAPActionAs(name_as, name, soapaction, *params) + add_method_with_soapaction_as(name, name_as, soapaction, *params) + end + + def setLogDev(logdev) + self.logdev = logdev + end + +private + + def log(sev) + @logdev.add(sev, nil, self.class) { @logid_prefix + yield } if @logdev + end +end + + +module RPC + class MappingRegistry < SOAP::Mapping::Registry + def initialize(*arg) + super + end + + def add(obj_class, soap_class, factory, info = nil) + if (info.size > 1) + raise RuntimeError.new("Parameter signature changed. [namespace, name] should be { :type => XSD::QName.new(namespace, name) } from 1.5.0.") + end + @map.add(obj_class, soap_class, factory, { :type => info[0] }) + end + alias set add + end + + class Router + alias mappingRegistry mapping_registry + alias mappingRegistry= mapping_registry= + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/driver.rb b/vendor/gems/soap4r-1.5.8/lib/soap/driver.rb new file mode 100644 index 00000000..beefaa61 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/driver.rb @@ -0,0 +1,9 @@ +# SOAP4R - SOAP driver +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/compat' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/element.rb b/vendor/gems/soap4r-1.5.8/lib/soap/element.rb new file mode 100644 index 00000000..edc3fb75 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/element.rb @@ -0,0 +1,277 @@ +# SOAP4R - SOAP elements library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 = {}) + Generator.assign_ns(attrs, ns, EnvelopeNamespace) + Generator.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 + + attr_reader :is_fault + + def initialize(data = nil, is_fault = false) + super(nil) + @elename = EleBodyName + @encodingstyle = nil + if data + if data.respond_to?(:to_xmlpart) + data = SOAP::SOAPRawData.new(data) + elsif defined?(::REXML) and data.is_a?(::REXML::Element) + data = SOAP::SOAPRawData.new(SOAP::SOAPREXMLElementWrap.new(data)) + end + 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) + @data.each do |data| + yield(data) + end + generator.encode_tag_end(name, @data.size > 0) + 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 + attr_accessor :actor + + def initialize(element, mustunderstand = true, encodingstyle = nil, actor = nil) + super() + @type = nil + @element = element + @mustunderstand = mustunderstand + @encodingstyle = encodingstyle + @actor = actor + element.parent = self if element + element.qualified = true + end + + def encode(generator, ns, attrs = {}) + attrs.each do |key, value| + @element.extraattr[key] = value + end + # to remove mustUnderstand attribute, set it to nil + unless @mustunderstand.nil? + @element.extraattr[AttrMustUnderstandName] = (@mustunderstand ? '1' : '0') + end + if @encodingstyle + @element.extraattr[AttrEncodingStyleName] = @encodingstyle + end + unless @element.encodingstyle + @element.encodingstyle = @encodingstyle + end + if @actor + @element.extraattr[AttrActorName] = @actor + end + yield(@element) + end +end + + +class SOAPHeader < SOAPStruct + include SOAPEnvelopeElement + + attr_writer :force_encode + + def initialize + super(nil) + @elename = EleHeaderName + @encodingstyle = nil + @force_encode = false + 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, @data.size > 0) + end + + def add(name, value) + actor = value.extraattr[AttrActorName] + mu = value.extraattr[AttrMustUnderstandName] + encstyle = value.extraattr[AttrEncodingStyleName] + mu_value = mu.nil? ? nil : (mu == '1') + # to remove mustUnderstand attribute, set it to nil + item = SOAPHeaderItem.new(value, mu_value, encstyle, actor) + super(name, item) + end + + def length + @data.length + end + alias size length + + def encode? + @force_encode or length > 0 + end +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 = {}) + Generator.assign_ns(attrs, ns, elename.namespace) + name = ns.name(@elename) + generator.encode_tag(name, attrs) + yield(@header) if @header and @header.encode? + yield(@body) + generator.encode_tag_end(name, true) + end + + def to_ary + [header, body] + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/aspDotNetHandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/aspDotNetHandler.rb new file mode 100644 index 00000000..ce6c450b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/aspDotNetHandler.rb @@ -0,0 +1,207 @@ +# SOAP4R - ASP.NET EncodingStyle handler library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 = + XSD::QName.new(parent.elename.namespace, data.elename.name) + 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) and data.have_member) + 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 + 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/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/handler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/handler.rb new file mode 100644 index 00000000..90389aa0 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/handler.rb @@ -0,0 +1,120 @@ +# SOAP4R - EncodingStyle handler library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + end + + def decode_tag_end(ns, name) + raise NotImplementError + end + + def decode_text(ns, text) + raise NotImplementError + end + + def decode_prologue + end + + def decode_epilogue + end + + def encode_attr_key(attrs, ns, qname) + if qname.namespace.nil? + qname.name + else + unless ns.assigned_as_tagged?(qname.namespace) + Generator.assign_ns!(attrs, ns, qname.namespace) + end + ns.name_attr(qname) + end + end + + def encode_qname(attrs, ns, qname) + if qname.namespace.nil? + qname.name + else + Generator.assign_ns(attrs, ns, qname.namespace) + ns.name(qname) + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/literalHandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/literalHandler.rb new file mode 100644 index 00000000..b8353703 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/literalHandler.rb @@ -0,0 +1,192 @@ +# SOAP4R - XML Literal EncodingStyle handler library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 |key, value| + next if !@generate_explicit_type and key == XSD::AttrTypeName + keytag = key + if key.is_a?(XSD::QName) + keytag = encode_attr_key(attrs, ns, key) + end + if value.is_a?(XSD::QName) + value = encode_qname(attrs, ns, value) + end + attrs[keytag] = value + end + case data + when SOAPExternalReference + # do not encode SOAPExternalReference in + # literalHandler (which is used for literal service) + data.referred + when SOAPRawString + generator.encode_tag(name, attrs) + generator.encode_rawstring(data.to_s) + when XSD::XSDString + generator.encode_tag(name, attrs) + str = decode_str(data.to_s) + 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 + unless generator.use_default_namespace + # passes 2 times for simplifying namespace definition + data.each do |key, value| + if value.elename.namespace + Generator.assign_ns(attrs, ns, value.elename.namespace) + end + end + end + if data.text and data.text.is_a?(XSD::QName) + Generator.assign_ns(attrs, ns, data.text.namespace) + end + generator.encode_tag(name, attrs) + if data.text + if data.text.is_a?(XSD::QName) + text = ns.name(data.text) + else + text = data.text + end + generator.encode_string(text) + end + 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) + # do not encode SOAPExternalReference in + # literalHandler (which is used for literal service) + return nil if data.is_a?(SOAPExternalReference) + name = generator.encode_name_end(ns, data) + cr = (data.is_a?(SOAPCompoundtype) and data.have_member) + generator.encode_tag_end(name, cr) + end + + + ### + ## decode interface. + # + def decode_tag(ns, elename, attrs, parent) + @textbuf.clear + if attrs[XSD::AttrNilName] == 'true' + o = SOAPNil.decode(elename) + else + o = SOAPElement.decode(elename) + end + if definedtype = attrs[XSD::AttrTypeName] + o.type = ns.parse(definedtype) + end + o.parent = parent + o.extraattr.update(attrs) + decode_parent(parent, o) + o + end + + def decode_tag_end(ns, node) + textbufstr = @textbuf.join + @textbuf.clear + o = node.node + decode_textbuf(o, textbufstr) + 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) + return unless parent.node + case 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, textbufstr) + case node + when XSD::XSDString, SOAPElement + if @charset + node.set(decode_str(textbufstr)) + else + node.set(textbufstr) + end + else + # Nothing to do... + end + end + + def decode_str(str) + @charset ? XSD::Charset.encoding_from_xml(str, @charset) : str + end +end + +LiteralHandler.new + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/soapHandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/soapHandler.rb new file mode 100644 index 00000000..c4662bde --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/encodingstyle/soapHandler.rb @@ -0,0 +1,559 @@ +# SOAP4R - SOAP EncodingStyle handler library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' +require 'soap/mapping/registry' + + +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) and data.have_member) + 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 + if @extraattr[XSD::AttrNilName] == 'true' + return as_nil + end + 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 + if @extraattr[XSD::AttrNilName] == 'true' + return as_nil + end + 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.clear + is_nil, type, arytype, root, offset, position, href, id = + extract_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, attrs) + else + o = decode_tag_by_type(ns, elename, type, parent.node, arytype, attrs) + 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) + textbufstr = @textbuf.join + @textbuf.clear + o = node.node + if o.is_a?(SOAPUnknown) + newnode = if /\A\s*\z/ =~ textbufstr + 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, textbufstr) + # 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 + Generator.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 + Generator.assign_ns(attrs, ns, data.type.namespace) + end + if data.is_a?(SOAPArray) + if data.arytype.namespace + Generator.assign_ns(attrs, ns, data.arytype.namespace) + end + Generator.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| + keytag = key + if key.is_a?(XSD::QName) + keytag = encode_attr_key(attrs, ns, key) + end + if value.is_a?(XSD::QName) + value = encode_qname(attrs, ns, value) + else + value = encode_attr_value(generator, ns, key, value) + end + attrs[keytag] = value + end + if data.id + attrs['id'] = data.id + end + attrs + end + + def encode_attr_value(generator, ns, qname, value) + case value + when 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, attrs) + 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.elename = 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, attrs) + end + + if parent.type == XSD::AnyTypeName + return decode_tag_by_type(ns, elename, typestr, parent, arytypestr, attrs) + 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, attrs) + 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, attrs) + 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) + if typedef.base + o = decode_basetype(TypeMap[typedef.base], elename) + o.definedtype = typedef + o + else + raise RuntimeError.new("unsupported simpleType: #{typedef}") + end + 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, attrs) + if arytypestr + type = typestr ? ns.parse(typestr) : ValueArrayName + node = SOAPArray.decode(elename, type, ns.parse(arytypestr)) + node.extraattr.update(attrs) + 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. + # => type Array in SOAP-ENC. + # => type Country in foo. + type = elename + end + + if klass = TypeMap[type] + node = decode_basetype(klass, elename) + node.extraattr.update(attrs) + return node + end + + # Unknown type... Struct or String + SOAPUnknown.new(self, elename, type, attrs) + end + + def decode_textbuf(node, textbufstr) + case node + when XSD::XSDHexBinary, XSD::XSDBase64Binary + node.set_encoded(textbufstr) + when XSD::XSDString + if @charset + textbufstr = XSD::Charset.encoding_from_xml(textbufstr, @charset) + end + if node.definedtype + node.definedtype.check_lexical_format(textbufstr) + end + node.set(textbufstr) + when SOAPNil + # Nothing to do. + when SOAPBasetype + node.set(textbufstr) + else + # Nothing to do... + end + end + + NilLiteralMap = { + 'true' => true, + '1' => true, + 'false' => false, + '0' => false + } + RootLiteralMap = { + '1' => 1, + '0' => 0 + } + def extract_attrs(ns, attrs) + is_nil = NilLiteralMap[attrs[XSD::AttrNilName]] + type = attrs[XSD::AttrTypeName] + arytype = attrs[AttrArrayTypeName] + root = attrs[AttrRootName] + offset = attrs[AttrOffsetName] + position = attrs[AttrPositionName] + href = attrs[AttrHrefName] + id = attrs[AttrIdName] + if attrs.key?(Mapping::RubyIVarName) + attrs[Mapping::RubyIVarName] = + decode_ref_value(ns, attrs[Mapping::RubyIVarName]) + end + return is_nil, type, arytype, root, offset, position, href, id + end + + def decode_ref_value(ns, 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/vendor/gems/soap4r-1.5.8/lib/soap/filter.rb b/vendor/gems/soap4r-1.5.8/lib/soap/filter.rb new file mode 100644 index 00000000..83cc7bf7 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/filter.rb @@ -0,0 +1,13 @@ +# SOAP4R - SOAP filter. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/filter/filterchain' +# envelope filter +require 'soap/filter/handler' +# steram filter +require 'soap/filter/streamhandler' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/filter/filterchain.rb b/vendor/gems/soap4r-1.5.8/lib/soap/filter/filterchain.rb new file mode 100644 index 00000000..54d821a2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/filter/filterchain.rb @@ -0,0 +1,51 @@ +# SOAP4R - SOAP filter chain. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/filter/handler' + + +module SOAP +module Filter + + +class FilterChain + + def each + @array.each do |filter| + yield filter + end + end + + def reverse_each + @array.reverse_each do |filter| + yield filter + end + end + + def initialize + @array = [] + end + + def add(filter) + @array << filter + end + alias << add + + def delete(filter) + @array.delete(filter) + end + + def include?(filter) + @array.include?(filter) + end + +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/filter/handler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/filter/handler.rb new file mode 100644 index 00000000..1fde5cd0 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/filter/handler.rb @@ -0,0 +1,31 @@ +# SOAP4R - SOAP envelope filter base class. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 Filter + + +class Handler + + # should return envelope. opt can be updated for other filters. + def on_outbound(envelope, opt) + # do something. + envelope + end + + # should return xml. opt can be updated for other filters. + def on_inbound(xml, opt) + # do something. + xml + end + +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/filter/streamhandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/filter/streamhandler.rb new file mode 100644 index 00000000..868f786c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/filter/streamhandler.rb @@ -0,0 +1,29 @@ +# SOAP4R - SOAP stream filter base class. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 Filter + + +class StreamHandler + + # no returning value expected. + def on_http_outbound(req) + # do something. + end + + # no returning value expected. + def on_http_inbound(req, res) + # do something. + end + +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/generator.rb b/vendor/gems/soap4r-1.5.8/lib/soap/generator.rb new file mode 100644 index 00000000..d7326bf2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/generator.rb @@ -0,0 +1,304 @@ +# SOAP4R - SOAP XML Instance Generator library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/ns' +require 'soap/baseData' +require 'soap/encodingstyle/handler' +require 'xsd/codegen/gensupport' + + +module SOAP + + +### +## CAUTION: MT-unsafe +# +class Generator + include SOAP + include XSD::CodeGen::GenSupport + + class FormatEncodeError < Error; end + +public + + attr_accessor :charset + attr_accessor :default_encodingstyle + attr_accessor :generate_explicit_type + attr_accessor :use_numeric_character_reference + attr_accessor :use_default_namespace + + 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 + @use_default_namespace = opt[:use_default_namespace] + @attributeformdefault = opt[:attributeformdefault] + @use_numeric_character_reference = opt[:use_numeric_character_reference] + @indentstr = opt[:no_indent] ? '' : ' ' + @buf = @indent = @curr = nil + @default_ns = opt[:default_ns] + @default_ns_tag = opt[:default_ns_tag] + end + + def generate(obj, io = nil) + @buf = io || '' + @indent = '' + @encode_char_regexp = get_encode_char_regexp() + + prologue + @handlers.each do |uri, handler| + handler.encode_prologue + end + + ns = SOAP::NS.new + if @default_ns + @default_ns.each_ns do |default_ns, default_tag| + Generator.assign_ns(obj.extraattr, ns, default_ns, default_tag) + end + end + if @default_ns_tag + @default_ns_tag.each_ns do |default_ns, default_tag| + ns.known_tag[default_ns] = default_tag + end + end + @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.respond_to?(:to_xmlpart) + formatted = trim_eol(obj.to_xmlpart) + formatted = trim_indent(formatted) + formatted = formatted.gsub(/^/, @indent).sub(/\n+\z/, '') + @buf << "\n#{formatted}" + return + elsif 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 = obj.extraattr + 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. + Generator.assign_ns(attrs, ns, XSD::InstanceNamespace) + if @generate_explicit_type + Generator.assign_ns(attrs, ns, XSD::Namespace) + 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 @use_default_namespace + Generator.assign_ns(attrs, ns, data.elename.namespace, '') + else + Generator.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 }="#{ get_encoded(value.to_s) }"] + 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 }" + else + @buf << "" + end + end + + def encode_rawstring(str) + @buf << str + end + + def encode_string(str) + @buf << get_encoded(str) + end + + def element_local?(element) + element.elename.namespace.nil? + end + + def self.assign_ns(attrs, ns, namespace, tag = nil) + if namespace.nil? + raise FormatEncodeError.new("empty namespace") + end + override_default_ns = (tag == '' and namespace != ns.default_namespace) + if override_default_ns or !ns.assigned?(namespace) + assign_ns!(attrs, ns, namespace, tag) + end + end + + def self.assign_ns!(attrs, ns, namespace, tag = nil) + tag = ns.assign(namespace, tag) + if tag == '' + attr = 'xmlns' + else + attr = "xmlns:#{tag}" + end + attrs[attr] = namespace + end + +private + + def prologue + end + + def epilogue + end + + ENCODE_CHAR_REGEXP = {} + + EncodeMap = { + '&' => '&', + '<' => '<', + '>' => '>', + '"' => '"', + '\'' => ''', + "\r" => ' ' + } + + def get_encoded(str) + if @use_numeric_character_reference and !XSD::Charset.is_us_ascii(str) + str.gsub!(@encode_char_regexp) { |c| EncodeMap[c] } + 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 + str.gsub(@encode_char_regexp) { |c| EncodeMap[c] } + end + end + + def get_encode_char_regexp + ENCODE_CHAR_REGEXP[XSD::Charset.encoding] ||= + Regexp.new("[#{EncodeMap.keys.join}]", nil, XSD::Charset.encoding) + end + + def find_handler(encodingstyle) + unless @handlers.key?(encodingstyle) + factory = SOAP::EncodingStyle::Handler.handler(encodingstyle) + if factory + handler = factory.new(@charset) + handler.generate_explicit_type = @generate_explicit_type + handler.encode_prologue + @handlers[encodingstyle] = handler + end + end + @handlers[encodingstyle] + end + + def xmldecl + if @charset + %Q[] + else + %Q[] + end + end +end + +SOAPGenerator = Generator # for backward compatibility + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/header/handler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/header/handler.rb new file mode 100644 index 00000000..439f00ba --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/header/handler.rb @@ -0,0 +1,61 @@ +# SOAP4R - SOAP Header handler item +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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_accessor :mustunderstand + attr_reader :encodingstyle + attr_reader :target_actor + + def initialize(elename) + @elename = elename + @mustunderstand = false + @encodingstyle = nil + @target_actor = 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(header) + arity = self.method(:on_outbound).arity + item = (arity == 0) ? on_outbound : on_outbound(header) + if item.nil? + nil + elsif item.is_a?(::SOAP::SOAPHeaderItem) + item.elename = @elename + item + else + item.elename = @elename + ::SOAP::SOAPHeaderItem.new(item, @mustunderstand, @encodingstyle, + @target_actor) + end + end + + def on_inbound_headeritem(header, item) + on_inbound(item.element, item.mustunderstand) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/header/handlerset.rb b/vendor/gems/soap4r-1.5.8/lib/soap/header/handlerset.rb new file mode 100644 index 00000000..c86aab66 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/header/handlerset.rb @@ -0,0 +1,70 @@ +# SOAP4R - SOAP Header handler set +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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(header) + @store.collect { |handler| + handler.on_outbound_headeritem(header) + }.compact + end + + # header: SOAPHeaderItem enumerable object + def on_inbound(header) + header.each do |name, item| + handler = @store.find { |handler| + handler.elename == item.element.elename + } + if handler + handler.on_inbound_headeritem(header, 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/vendor/gems/soap4r-1.5.8/lib/soap/header/mappinghandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/header/mappinghandler.rb new file mode 100644 index 00000000..32529a57 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/header/mappinghandler.rb @@ -0,0 +1,47 @@ +# SOAP4R - SOAP Mapping header item handler +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/mapping/mapping' + + +module SOAP +module Header + + +class MappingHandler < SOAP::Header::Handler + attr_accessor :registry + + def initialize(elename, registry = nil) + super(elename) + @registry = registry + end + + # Should return an Object for mapping + def on_mapping_outbound + nil + end + + # Given header is a mapped Object + def on_mapping_inbound(obj, mustunderstand) + end + + def on_outbound + obj = on_mapping_outbound + obj ? SOAP::Mapping.obj2soap(obj, @registry, @elename) : nil + end + + def on_inbound(header, mustunderstand) + obj = SOAP::Mapping.soap2obj(header, @registry) + on_mapping_inbound(obj, mustunderstand) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/header/simplehandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/header/simplehandler.rb new file mode 100644 index 00000000..39ce8fa0 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/header/simplehandler.rb @@ -0,0 +1,44 @@ +# SOAP4R - SOAP Simple header item handler +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/soap/httpconfigloader.rb b/vendor/gems/soap4r-1.5.8/lib/soap/httpconfigloader.rb new file mode 100644 index 00000000..ed31b0a2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/httpconfigloader.rb @@ -0,0 +1,139 @@ +# SOAP4R - HTTP config loader. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + auth = options["auth"] ||= ::SOAP::Property.new + set_auth(client, auth) + auth.add_hook do |key, value| + set_auth(client, 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 |ele| + client.set_basic_auth(*authele_to_triplets(ele)) + end + end + + def set_auth(client, auth) + auth.values.each do |ele| + client.set_auth(*authele_to_triplets(ele)) + end + end + + def authele_to_triplets(ele) + if ele.is_a?(::Array) + url, userid, passwd = ele + else + url, userid, passwd = ele[:url], ele[:userid], ele[:password] + end + return url, userid, passwd + 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/vendor/gems/soap4r-1.5.8/lib/soap/mapping.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping.rb new file mode 100644 index 00000000..a121290e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping.rb @@ -0,0 +1,12 @@ +# SOAP4R - Ruby type mapping utility. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' +require 'soap/mapping/encodedregistry' +require 'soap/mapping/literalregistry' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/encodedregistry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/encodedregistry.rb new file mode 100644 index 00000000..88651739 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/encodedregistry.rb @@ -0,0 +1,548 @@ +# SOAP4R - encoded mapping registry. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 Mapping + + +# Inner class to pass an exception. +class SOAPException + 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 + + +class EncodedRegistry + include TraverseSupport + include RegistrySupport + + 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 + klass.ancestors.each do |baseclass| + next if baseclass == klass + if map = @obj2soap[baseclass] + 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 + FixnumFactory = FixnumFactory_.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, + {:derived_class => true}], + [::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}], + [::Fixnum, ::SOAP::SOAPInt, FixnumFactory], + [::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, + {:derived_class => true}], + [::Hash, ::SOAP::SOAPStruct, HashFactory, + {:derived_class => true}], + + [::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}], + [::Fixnum, ::SOAP::SOAPInt, FixnumFactory], + [::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 = {}) + super() + @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 + + # initial mapping interface + # new interface Registry#register is defined in RegisterSupport + def add(obj_class, soap_class, factory, info = nil) + @map.add(obj_class, soap_class, factory, info) + end + alias set add + + def obj2soap(obj, type_qname = nil) + soap = _obj2soap(obj, type_qname) + 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, type_qname = nil) + ret = nil + if obj.is_a?(SOAPCompoundtype) + obj.replace do |ele| + Mapping._obj2soap(ele, self) + end + return obj + elsif obj.is_a?(SOAPBasetype) + return obj + elsif type_qname && type = TypeMap[type_qname] + return base2soap(obj, type) + end + cause = nil + begin + if definition = schema_definition_from_class(obj.class) + return stubobj2soap(obj, definition) + end + ret = @map.obj2soap(obj) || + @default_factory.obj2soap(nil, obj, nil, self) + return ret if ret + rescue MappingError + cause = $! + 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.", cause) + end + + # Might return nil as a mapping result. + def _soap2obj(node, klass = nil) + definition = find_node_definition(node) + if klass + klass_definition = schema_definition_from_class(klass) + if definition and (definition.class_for < klass) + klass = definition.class_for + else + definition = klass_definition + end + else + klass = definition.class_for if definition + end + if definition and node.is_a?(::SOAP::SOAPNameAccessible) + return elesoap2stubobj(node, klass, definition) + end + if node.extraattr.key?(RubyTypeName) + conv, obj = @rubytype_factory.soap2obj(nil, node, nil, self) + return obj if conv + end + conv, obj = @map.soap2obj(node) + return obj if conv + conv, obj = @default_factory.soap2obj(nil, node, nil, self) + return obj if conv + cause = nil + if @excn_handler_soap2obj + begin + return @excn_handler_soap2obj.call(node) { |yield_node| + Mapping._soap2obj(yield_node, self) + } + rescue Exception + cause = $! + end + end + raise MappingError.new("Cannot map #{ node.type.name } to Ruby object.", cause) + 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| + name = c.name + if name.nil? or name.empty? + raise TypeError.new("singleton can't be dumped #{ obj }") + end + name + }.join(" ") + end + end + + def stubobj2soap(obj, definition) + case obj + when ::Array + array2soap(obj, definition) + else + unknownstubobj2soap(obj, definition) + end + end + + def array2soap(obj, definition) + return SOAPNil.new if obj.nil? # ToDo: check nillable. + eledef = definition.elements[0] + soap_obj = SOAPArray.new(ValueArrayName, 1, eledef.elename) + mark_marshalled_obj(obj, soap_obj) + obj.each do |item| + soap_obj.add(typedobj2soap(item, eledef.mapped_class)) + end + soap_obj + end + + def unknownstubobj2soap(obj, definition) + return SOAPNil.new if obj.nil? + if definition.elements.size == 0 + ele = Mapping.obj2soap(obj) + ele.elename = definition.elename if definition.elename + ele.extraattr[XSD::AttrTypeName] = definition.type if definition.type + return ele + else + ele = SOAPStruct.new(definition.type) + mark_marshalled_obj(obj, ele) + end + definition.elements.each do |eledef| + name = eledef.elename.name + if obj.respond_to?(:each) and eledef.as_array? + obj.each do |item| + ele.add(name, typedobj2soap(item, eledef.mapped_class)) + end + else + child = Mapping.get_attribute(obj, eledef.varname) + if child.respond_to?(:each) and eledef.as_array? + child.each do |item| + ele.add(name, typedobj2soap(item, eledef.mapped_class)) + end + else + ele.add(name, typedobj2soap(child, eledef.mapped_class)) + end + end + end + ele + end + + def typedobj2soap(value, klass) + if klass and klass.include?(::SOAP::SOAPBasetype) + base2soap(value, klass) + else + Mapping._obj2soap(value, self) + end + end + + def elesoap2stubobj(node, obj_class, definition) + obj = Mapping.create_empty_object(obj_class) + add_elesoap2stubobj(node, obj, definition) + obj + end + + # XXX consider to merge with the method in LiteralRegistry + def add_elesoap2stubobj(node, obj, definition) + vars = {} + node.each do |name, value| + item = definition.elements.find_element(value.elename) + if item + child = soap2typedobj(value, item.mapped_class) + else + # unknown element is treated as anyType. + child = Mapping._soap2obj(value, self) + end + if item and item.as_array? + (vars[name] ||= []) << child + elsif vars.key?(name) + vars[name] = [vars[name], child].flatten + else + vars[name] = child + end + end + if obj.is_a?(::Array) and is_stubobj_elements_for_array(vars) + Array.instance_method(:replace).bind(obj).call(vars.values[0]) + else + Mapping.set_attributes(obj, vars) + end + end + + def soap2typedobj(value, klass) + unless klass + raise MappingError.new("unknown class: #{klass}") + end + if klass.include?(::SOAP::SOAPBasetype) + obj = base2obj(value, klass) + else + obj = Mapping._soap2obj(value, self, klass) + end + obj + end +end + + +Registry = EncodedRegistry +DefaultRegistry = EncodedRegistry.new +RubyOriginalRegistry = EncodedRegistry.new(:allow_original_mapping => true) + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/factory.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/factory.rb new file mode 100644 index 00000000..1bd10670 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/factory.rb @@ -0,0 +1,388 @@ +# SOAP4R - Mapping factory. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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') + setdefinediv2soap(node, obj, map) + else + # should we sort instance_variables? how? + obj.instance_variables.each do |var| + name = var.sub(/^@/, '') + elename = Mapping.name2elename(name) + node.add(elename, + Mapping._obj2soap(obj.instance_variable_get(var), map)) + end + end + end + +private + + def setdefinediv2soap(ele, obj, map) + definition = Mapping.schema_definition_classdef(obj.class) + definition.elements.each do |eledef| + child = Mapping.get_attribute(obj, eledef.varname) + # extract method + if child.nil? + value = SOAPNil.new + elsif child.is_a?(XSD::NSDBase) + value = child + else + klass = Mapping.class_from_name(eledef.type) + if klass && klass.include?(::SOAP::SOAPBasetype) + value = klass.new(child) + else + # should check klass matches an actual object? + value = Mapping._obj2soap(child, map) + end + end + ele.add(eledef.elename.name, value) + end + end + + 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 + + def anonymous_class?(obj) + name = obj.class.name + name.nil? or name.empty? # 1.8 returns "" + 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 + encoded = XSD::Charset.encoding_conv(obj, Mapping.external_ces, + 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, + Mapping.external_ces) + obj.replace(decoded) + mark_unmarshalled_obj(node, obj) + return true, obj + end +end + +class FixnumFactory_ < Factory + def obj2soap(soap_class, obj, info, map) + soap_obj = nil + begin + soap_obj = soap_class.new(obj) + rescue XSD::ValueSpaceError + return nil + end + soap_obj + end + + def soap2obj(obj_class, node, info, map) + obj = node.data + 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 + # allow to serialize an instance of unmarked class + 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/vendor/gems/soap4r-1.5.8/lib/soap/mapping/literalregistry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/literalregistry.rb new file mode 100644 index 00000000..36dbdefb --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/literalregistry.rb @@ -0,0 +1,388 @@ +# SOAP4R - literal mapping registry. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 LiteralRegistry + include RegistrySupport + + attr_accessor :excn_handler_obj2soap + attr_accessor :excn_handler_soap2obj + + def initialize + super() + @excn_handler_obj2soap = nil + @excn_handler_soap2obj = nil + end + + def obj2soap(obj, qname, obj_class = nil) + soap_obj = nil + if obj.is_a?(SOAPElement) + soap_obj = obj + else + soap_obj = any2soap(obj, qname, obj_class) + 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) + cause = nil + begin + return any2obj(node, obj_class) + rescue MappingError + cause = $! + 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 + raise MappingError.new("cannot map #{node.elename.name}/#{node.type.name} to Ruby object", cause) + end + +private + + MAPPING_OPT = { :no_reference => true } + + def definedobj2soap(obj, definition) + obj2soap(obj, definition.elename, definition.mapped_class) + end + + def any2soap(obj, qname, obj_class) + ele = nil + if obj.is_a?(SOAP::Mapping::Object) + return mappingobj2soap(obj, qname) + end + class_definition = schema_definition_from_class(obj.class) + if class_definition.nil? and obj_class + class_definition = schema_definition_from_class(obj_class) + end + elename_definition = schema_definition_from_elename(qname) + if !class_definition and !elename_definition + # no definition found + return anyobj2soap(obj, qname) + end + if !class_definition or !elename_definition + # use found one + return stubobj2soap(obj, qname, class_definition || elename_definition) + end + # found both: + if class_definition.class_for == elename_definition.class_for + # if two definitions are for the same class, give qname a priority. + return stubobj2soap(obj, qname, elename_definition) + end + # it should be a derived class + return stubobj2soap(obj, qname, class_definition) + end + + def anyobj2soap(obj, qname) + ele = nil + case obj + when Hash + ele = SOAPElement.from_obj(obj, nil) + ele.elename = qname + when Array + # treat as a list of simpletype + ele = SOAPElement.new(qname, obj.join(" ")) + when XSD::QName + ele = SOAPElement.new(qname) + ele.text = obj + 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 + rescue MappingError + ele = SOAPElement.new(qname, obj.to_s) + end + end + add_attributes2soap(obj, ele) + ele + end + + def stubobj2soap(obj, qname, definition) + if obj.nil? + ele = SOAPNil.new + ele.elename = qname + elsif obj.is_a?(::String) + ele = SOAPElement.new(qname, obj) + else + ele = SOAPElement.new(qname) + end + ele.qualified = definition.qualified + if definition.type and (definition.basetype or Mapping.root_type_hint) + Mapping.reset_root_type_hint + ele.extraattr[XSD::AttrTypeName] = definition.type + end + if qname.nil? and definition.elename + ele.elename = definition.elename + end + return ele if obj.nil? + stubobj2soap_elements(obj, ele, definition.elements) + add_definedattributes2soap(obj, ele, definition) + ele + end + + def stubobj2soap_elements(obj, ele, definition, is_choice = false) + added = false + case definition + when SchemaSequenceDefinition, SchemaEmptyDefinition + definition.each do |eledef| + ele_added = stubobj2soap_elements(obj, ele, eledef, is_choice) + added = true if ele_added + end + when SchemaChoiceDefinition + definition.each do |eledef| + added = stubobj2soap_elements(obj, ele, eledef, true) + break if added + end + else + added = true + if definition.as_any? + any = Mapping.get_attributes_for_any(obj) + SOAPElement.from_objs(any).each do |child| + ele.add(child) + end + elsif obj.respond_to?(:each) and definition.as_array? + obj.each do |item| + ele.add(definedobj2soap(item, definition)) + end + else + child = Mapping.get_attribute(obj, definition.varname) + if child.nil? and (is_choice or definition.minoccurs == 0) + added = false + else + if child.respond_to?(:each) and definition.as_array? + if child.empty? + added = false + else + child.each do |item| + ele.add(definedobj2soap(item, definition)) + end + end + else + ele.add(definedobj2soap(child, definition)) + end + end + end + end + added + 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 any2obj(node, obj_class = nil) + is_compound = node.is_a?(::SOAP::SOAPCompoundtype) + # trust xsi:type first + if is_compound and node.type + definition = schema_definition_from_type(node.type) + end + # element name next + definition ||= schema_definition_from_elename(node.elename) + # class defined in parent type last + if obj_class + definition ||= schema_definition_from_class(obj_class) + end + if definition + obj_class = definition.class_for + end + if is_compound + if definition + return elesoap2stubobj(node, obj_class, definition) + elsif node.is_a?(::SOAP::SOAPNameAccessible) + return elesoap2plainobj(node) + end + end + obj = Mapping.soap2obj(node, nil, obj_class, MAPPING_OPT) + add_attributes2obj(node, obj) + obj + end + + def elesoap2stubobj(node, obj_class, definition) + obj = nil + if obj_class == ::String + obj = node.text + elsif obj_class < ::String + obj = obj_class.new(node.text) + else + obj = Mapping.create_empty_object(obj_class) + add_elesoap2stubobj(node, obj, definition) + end + add_attributes2stubobj(node, obj, definition) + obj + end + + def elesoap2plainobj(node) + obj = nil + if !node.have_member + obj = base2obj(node, ::SOAP::SOAPString) + else + obj = anytype2obj(node) + add_elesoap2plainobj(node, obj) + end + add_attributes2obj(node, obj) + obj + end + + def anytype2obj(node) + if node.is_a?(::SOAP::SOAPBasetype) + return node.data + end + ::SOAP::Mapping::Object.new + end + + def add_elesoap2stubobj(node, obj, definition) + vars = {} + node.each do |name, value| + item = definition.elements.find_element(value.elename) + if item + child = elesoapchild2obj(value, item) + else + # unknown element is treated as anyType. + child = any2obj(value) + end + if item and item.as_array? + (vars[name] ||= []) << child + elsif vars.key?(name) + vars[name] = [vars[name], child].flatten + else + vars[name] = child + end + end + if obj.is_a?(::Array) and is_stubobj_elements_for_array(vars) + Array.instance_method(:replace).bind(obj).call(vars.values[0]) + else + Mapping.set_attributes(obj, vars) + end + end + + def elesoapchild2obj(value, eledef) + if eledef.mapped_class + if eledef.mapped_class.include?(::SOAP::SOAPBasetype) + base2obj(value, eledef.mapped_class) + else + any2obj(value, eledef.mapped_class) + end + else + child_definition = schema_definition_from_elename(eledef.elename) + if child_definition + any2obj(value, child_definition.class_for) + else + # untyped element is treated as anyType. + any2obj(value) + end + end + end + + def add_attributes2stubobj(node, obj, definition) + return if obj.nil? or node.extraattr.empty? + if attributes = definition.attributes + define_xmlattr(obj) + attributes.each do |qname, class_name| + child = node.extraattr[qname] + next if child.nil? + if class_name + klass = Mapping.class_from_name(class_name) + if klass.include?(::SOAP::SOAPBasetype) + child = klass.to_data(child) + end + end + obj.__xmlattr[qname] = child + define_xmlattr_accessor(obj, qname) + end + end + end + + def add_elesoap2plainobj(node, obj) + node.each do |name, value| + obj.__add_xmlele_value(value.elename, any2obj(value)) + end + end + + def add_attributes2obj(node, obj) + return if obj.nil? or node.extraattr.empty? + define_xmlattr(obj) + node.extraattr.each do |qname, value| + obj.__xmlattr[qname] = value + define_xmlattr_accessor(obj, qname) + end + end + + # Mapping.define_attr_accessor calls define_method with proc and it exhausts + # much memory for each singleton Object. just instance_eval instead of it. + def define_xmlattr_accessor(obj, qname) + # untaint depends GenSupport.safemethodname + name = Mapping.safemethodname('xmlattr_' + qname.name).untaint + unless obj.respond_to?(name) + # untaint depends QName#dump + qnamedump = qname.dump.untaint + obj.instance_eval <<-EOS + def #{name} + @__xmlattr[#{qnamedump}] + end + + def #{name}=(value) + @__xmlattr[#{qnamedump}] = value + end + EOS + end + end + + # Mapping.define_attr_accessor calls define_method with proc and it exhausts + # much memory for each singleton Object. just instance_eval instead of it. + 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 + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb new file mode 100644 index 00000000..62f215ed --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/mapping.rb @@ -0,0 +1,609 @@ +# SOAP4R - Ruby type mapping utility. +# Copyright (C) 2000-2007 NAKAMURA Hiroshi . + +# 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 'soap/mapping/schemadefinition' + + +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' + + + module TraverseSupport + def mark_marshalled_obj(obj, soap_obj) + raise if obj.nil? + Thread.current[:SOAPMapping][:MarshalKey][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[:SOAPMapping][:MarshalKey][node.id] = obj + end + end + + + EMPTY_OPT = {}.freeze + def self.obj2soap(obj, registry = nil, type = nil, opt = EMPTY_OPT) + registry ||= Mapping::DefaultRegistry + soap_obj = nil + protect_mapping(opt) do + soap_obj = _obj2soap(obj, registry, type) + end + soap_obj + end + + def self.objs2soap(objs, registry = nil, types = nil, opt = EMPTY_OPT) + registry ||= Mapping::DefaultRegistry + ary = [] + protect_mapping(opt) do + 0.upto(objs.length - 1) do |idx| + type = types ? types[idx] : nil + soap = _obj2soap(objs[idx], registry, type) + ary << soap + end + end + ary + end + + def self.soap2obj(node, registry = nil, klass = nil, opt = EMPTY_OPT) + registry ||= Mapping::DefaultRegistry + obj = nil + protect_mapping(opt) do + 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_mapping(opt) do + 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_mapping(opt) do + 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 obj.respond_to?(:to_xmlpart) + SOAPRawData.new(obj) + elsif defined?(::REXML) and obj.is_a?(::REXML::Element) + SOAPRawData.new(SOAPREXMLElementWrap.new(obj)) + elsif referent = Thread.current[:SOAPMapping][:MarshalKey][obj.__id__] and + !Thread.current[:SOAPMapping][:NoReference] + 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[:SOAPMapping][:MarshalKey][target.id] and + !Thread.current[:SOAPMapping][:NoReference] + 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.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 /\A[A-Z]/ =~ const_str + begin + if const.const_defined?(const_str) + const = const.const_get(const_str) + next + end + rescue NameError + end + end + if lenient + const_str = Mapping.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) + unless lenient + const = const_from_name_nonlenient(name) + else + const = const_from_name(name, true) + end + if const.is_a?(::Class) + const + else + nil + end + end + + def self.module_from_name(name, lenient = false) + unless lenient + const = const_from_name_nonlenient(name) + else + const = const_from_name(name, true) + end + if const.is_a?(::Module) + const + else + nil + end + end + + def self.const_from_name_nonlenient(name) + if Thread.current[:SOAPMapping] + Thread.current[:SOAPMapping][:ConstFromName][name] ||= + const_from_name(name) + else + const_from_name(name) + 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) + name = schema_type_definition(klass) || + Mapping.name2elename(klass.name) + namespace = schema_ns_definition(klass) || RubyCustomTypeNamespace + XSD::QName.new(namespace, name) + 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.to_qname(obj, ns = nil) + if obj.is_a?(XSD::QName) + obj + else + XSD::QName.new(ns, obj) + 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_attributes(obj) + if obj.is_a?(::Hash) + obj + else + rs = {} + obj.instance_variables.each do |ele| + rs[ele.sub(/^@/, '')] = obj.instance_variable_get(ele) + end + rs + end + end + + EMPTY_ATTRIBUTES = {}.freeze + def self.get_attributes_for_any(obj) + if obj.respond_to?(:__xmlele_any) + obj.__xmlele_any || EMPTY_ATTRIBUTES + else + get_attributes(obj) + end + end + + def self.get_attribute(obj, attr_name) + case obj + when ::SOAP::Mapping::Object + return obj[attr_name] + when ::Hash + return obj[attr_name] || obj[attr_name.intern] + else + if obj.respond_to?(attr_name) + return obj.__send__(attr_name) + end + iv = obj.instance_variables + name = Mapping.safevarname(attr_name) + if iv.include?("@#{name}") + return obj.instance_variable_get("@#{name}") + elsif iv.include?("@#{attr_name}") + return obj.instance_variable_get("@#{attr_name}") + end + if obj.respond_to?(name) + return obj.__send__(name) + end + nil + end + end + + def self.set_attributes(obj, values) + case obj + when ::SOAP::Mapping::Object + values.each do |attr_name, value| + obj.__add_xmlele_value(attr_name, value) + end + else + values.each do |attr_name, value| + # untaint depends GenSupport.safevarname + name = Mapping.safevarname(attr_name).untaint + setter = name + "=" + if obj.respond_to?(setter) + obj.__send__(setter, value) + else + obj.instance_variable_set('@' + name, value) + begin + unless obj.respond_to?(name) + obj.instance_eval <<-EOS + def #{name} + @#{name} + end + EOS + end + unless self.respond_to?(name + "=") + obj.instance_eval <<-EOS + def #{name}=(value) + @#{name} = value + end + EOS + end + rescue TypeError + # singleton class may not exist (e.g. Float) + end + end + end + end + end + + def self.safeconstname(name) + Thread.current[:SOAPMapping][:SafeConstName][name] ||= + XSD::CodeGen::GenSupport.safeconstname(name) + end + + def self.safemethodname(name) + Thread.current[:SOAPMapping][:SafeMethodName][name] ||= + XSD::CodeGen::GenSupport.safemethodname(name) + end + + def self.safevarname(name) + Thread.current[:SOAPMapping][:SafeVarName][name] ||= + XSD::CodeGen::GenSupport.safevarname(name) + end + + def self.root_type_hint + Thread.current[:SOAPMapping][:RootTypeHint] + end + + def self.reset_root_type_hint + Thread.current[:SOAPMapping][:RootTypeHint] = false + end + + def self.external_ces + Thread.current[:SOAPMapping][:ExternalCES] + end + + def self.schema_ns_definition(klass) + class_schema_variable(:schema_ns, klass) + end + + def self.schema_name_definition(klass) + class_schema_variable(:schema_name, klass) + end + + def self.schema_type_definition(klass) + class_schema_variable(:schema_type, klass) + end + + def self.schema_qualified_definition(klass) + class_schema_variable(:schema_qualified, klass) + end + + def self.schema_element_definition(klass) + class_schema_variable(:schema_element, klass) + end + + def self.schema_attribute_definition(klass) + class_schema_variable(:schema_attribute, klass) + end + + def self.schema_definition_classdef(klass) + if Thread.current[:SOAPMapping][:SchemaDefinition].key?(klass) + return Thread.current[:SOAPMapping][:SchemaDefinition][klass] + end + schema_ns = schema_ns_definition(klass) + schema_name = schema_name_definition(klass) + schema_type = schema_type_definition(klass) + qualified = schema_qualified_definition(klass) + elements = schema_element_definition(klass) + attributes = schema_attribute_definition(klass) + return nil if schema_name.nil? and schema_type.nil? + schema_name = Mapping.to_qname(schema_name, schema_ns) if schema_name + schema_type = Mapping.to_qname(schema_type, schema_ns) if schema_type + definition = create_schema_definition(klass, + :schema_name => schema_name, + :schema_type => schema_type, + :is_anonymous => false, + :schema_qualified => qualified, + :schema_element => elements, + :schema_attribute => attributes + ) + Thread.current[:SOAPMapping][:SchemaDefinition][klass] = definition + definition + end + + def self.create_schema_definition(klass, definition) + schema_ns = definition[:schema_ns] + schema_name = definition[:schema_name] + schema_type = definition[:schema_type] + is_anonymous = definition[:is_anonymous] + schema_basetype = definition[:schema_basetype] + # wrap if needed for backward compatibility + if schema_ns + schema_name = Mapping.to_qname(schema_name, schema_ns) if schema_name + schema_type = Mapping.to_qname(schema_type, schema_ns) if schema_type + # no need for schema_basetype bacause it's introduced later + end + schema_qualified = definition[:schema_qualified] + schema_element = definition[:schema_element] + schema_attributes = definition[:schema_attribute] + definition = SchemaDefinition.new(klass, schema_name, schema_type, is_anonymous, schema_qualified) + definition.basetype = schema_basetype + definition.attributes = schema_attributes + if schema_element + if schema_element.respond_to?(:is_concrete_definition) and + schema_element.is_concrete_definition + definition.elements = schema_element + else + default_ns = schema_name.namespace if schema_name + default_ns ||= schema_type.namespace if schema_type + definition.elements = parse_schema_definition(schema_element, default_ns) + if klass < ::Array + definition.elements.set_array + end + end + end + definition + end + + # for backward compatibility + # returns SchemaComplexTypeDefinition + def self.parse_schema_definition(schema_element, default_ns) + definition = nil + if schema_element[0] == :choice + schema_element.shift + definition = SchemaChoiceDefinition.new + else + definition = SchemaSequenceDefinition.new + end + schema_element.each do |ele| + element_definition = parse_schema_element_definition(ele, default_ns) + definition << element_definition + end + definition + end + + # returns SchemaElementDefinition + def self.parse_schema_element_definition(schema_element, default_ns) + if schema_element[0] == :choice + parse_schema_definition(schema_element, default_ns) + elsif schema_element[0].is_a?(Array) + parse_schema_definition(schema_element, default_ns) + else + varname, info, occurrence = schema_element + mapped_class_str, elename = info + if occurrence + minoccurs, maxoccurs = occurrence + else + # for backward compatibility + minoccurs, maxoccurs = 1, 1 + end + as_any = as_array = false + if /\[\]$/ =~ mapped_class_str + mapped_class_str = mapped_class_str.sub(/\[\]$/, '') + if mapped_class_str.empty? + mapped_class_str = nil + end + as_array = true + end + if mapped_class_str + mapped_class = Mapping.class_from_name(mapped_class_str) + if mapped_class.nil? + warn("cannot find mapped class: #{mapped_class_str}") + end + end + if elename == XSD::AnyTypeName + as_any = true + elsif elename.nil? + elename = XSD::QName.new(default_ns, varname) + end + SchemaElementDefinition.new( + varname, mapped_class, elename, minoccurs, maxoccurs, as_any, as_array) + end + end + + class << Mapping + public + + 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 + + private + + def class_schema_variable(sym, klass) + var = "@@#{sym}" + klass.class_variables.include?(var) ? klass.class_eval(var) : nil + end + + def protect_mapping(opt) + protect_threadvars(:SOAPMapping) do + data = Thread.current[:SOAPMapping] = {} + data[:MarshalKey] = {} + data[:ExternalCES] = opt[:external_ces] || XSD::Charset.encoding + data[:NoReference] = opt[:no_reference] + data[:RootTypeHint] = opt[:root_type_hint] + data[:SchemaDefinition] = {} + data[:SafeConstName] = {} + data[:SafeMethodName] = {} + data[:SafeVarName] = {} + data[:ConstFromName] = {} + yield + 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/vendor/gems/soap4r-1.5.8/lib/soap/mapping/registry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/registry.rb new file mode 100644 index 00000000..b083fc98 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/registry.rb @@ -0,0 +1,295 @@ +# SOAP4R - Mapping registry. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' + + +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') + + +# For anyType object: SOAP::Mapping::Object not ::Object +class Object + 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) + qname = Mapping.to_qname(qname) + @__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) + qname = Mapping.to_qname(qname) + 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 + + def marshal_load(dumpobj) + __import(dumpobj) + end + +private + + # Mapping.define_attr_accessor calls define_method with proc and it exhausts + # much memory for each singleton Object. just instance_eval instead of it. + def __define_attr_accessor(qname) + # untaint depends GenSupport.safemethodname + name = Mapping.safemethodname(qname.name).untaint + # untaint depends on QName#dump + qnamedump = qname.dump.untaint + singleton = false + unless self.respond_to?(name) + singleton = true + instance_eval <<-EOS + def #{name} + self[#{qnamedump}] + end + EOS + end + unless self.respond_to?(name + "=") + singleton = true + instance_eval <<-EOS + def #{name}=(value) + self[#{qnamedump}] = value + end + EOS + end + if singleton && !self.respond_to?(:marshal_dump) + instance_eval <<-EOS + def marshal_dump + __export + 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 + + def __export + dumpobj = ::SOAP::Mapping::Object.new + dumpobj.__xmlele.replace(@__xmlele) + dumpobj.__xmlattr.replace(@__xmlattr) + dumpobj + end + + def __import(dumpobj) + @__xmlele_type = {} + @__xmlele = [] + @__xmlattr = {} + dumpobj.__xmlele.each do |qname, value| + __add_xmlele_value(qname, value) + end + @__xmlattr.replace(dumpobj.__xmlattr) + end +end + + +class MappingError < Error; end + + +module RegistrySupport + def initialize + super() + @class_schema_definition = {} + @class_elename_schema_definition = {} + @elename_schema_definition = {} + @type_schema_definition = {} + end + + def register(definition) + obj_class = definition[:class] + definition = Mapping.create_schema_definition(obj_class, definition) + # give complexType definition a priority explicitly + if !@class_schema_definition[obj_class] or definition.type + @class_schema_definition[obj_class] = definition + end + if definition.elename and !definition.is_anonymous? + @class_elename_schema_definition[obj_class] = definition + @elename_schema_definition[definition.elename] = definition + end + if definition.type + @type_schema_definition[definition.type] = definition + end + end + + def schema_definition_from_class(klass) + @class_schema_definition[klass] || Mapping.schema_definition_classdef(klass) + end + + def elename_schema_definition_from_class(klass) + @class_elename_schema_definition[klass] + end + + def schema_definition_from_elename(qname) + @elename_schema_definition[qname] + end + + def schema_definition_from_type(type) + @type_schema_definition[type] + end + + def find_node_definition(node) + schema_definition_from_type(node.type) || + schema_definition_from_elename(node.elename) || + find_schema_definition(node.elename.name) || + find_schema_definition(node.type.name) + end + + def find_schema_definition(name) + return nil unless name + typestr = Mapping.safeconstname(name) + obj_class = Mapping.class_from_name(typestr) + if obj_class + schema_definition_from_class(obj_class) + end + end + + def add_attributes2soap(obj, ele) + if definition = Mapping.schema_definition_classdef(obj.class) + add_definedattributes2soap(obj, ele, definition) + elsif obj.respond_to?(:__xmlattr) + obj.__xmlattr.each do |key, value| + ele.extraattr[key] = value + end + end + end + + def add_definedattributes2soap(obj, ele, typedef) + if typedef.attributes + typedef.attributes.each do |qname, param| + value = get_xmlattr_value(obj, qname) + ele.extraattr[qname] = value unless value.nil? + end + end + end + + def get_xmlattr_value(obj, qname) + attrname = 'xmlattr_' + qname.name + value = Mapping.get_attribute(obj, attrname) + if value.nil? + attrname = Mapping.safemethodname('xmlattr_' + qname.name) + value = Mapping.get_attribute(obj, attrname) + end + value + end + + def base2soap(obj, type, qualified = nil) + return SOAPNil.new if obj.nil? + soap_obj = nil + if type <= XSD::XSDString + str = XSD::Charset.encoding_conv(obj.to_s, Mapping.external_ces, + XSD::Charset.encoding) + soap_obj = type.new(str) + else + soap_obj = type.new(obj) + end + soap_obj.qualified = qualified + soap_obj + end + + def base2obj(value, klass) + v = if value.respond_to?(:data) + value.data + elsif value.respond_to?(:text) + value.text + else + nil + end + if value.is_a?(klass) + v + else + klass.to_data(v) + end + end + + def is_stubobj_elements_for_array(vars) + vars.keys.size == 1 and vars.values[0].is_a?(::Array) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/rubytypeFactory.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/rubytypeFactory.rb new file mode 100644 index 00000000..bb57d935 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/rubytypeFactory.rb @@ -0,0 +1,478 @@ +# SOAP4R - Ruby type mapping factory. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 ::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 ::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 ::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) + if anonymous_class?(obj) + 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.respond_to?(:soap_marshallable) and !klass.soap_marshallable + return nil + end + 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/vendor/gems/soap4r-1.5.8/lib/soap/mapping/schemadefinition.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/schemadefinition.rb new file mode 100644 index 00000000..d024794e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/schemadefinition.rb @@ -0,0 +1,170 @@ +# SOAP4R - Ruby type mapping schema definition utility. +# Copyright (C) 2000-2007 NAKAMURA Hiroshi . + +# 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 + + +class SchemaElementDefinition + attr_reader :varname, :mapped_class, :elename, :minoccurs, :maxoccurs + + def initialize(varname, mapped_class, elename, minoccurs, maxoccurs, + as_any, as_array) + @varname = varname + @mapped_class = mapped_class + @elename = elename + @minoccurs = minoccurs + @maxoccurs = maxoccurs + @as_any = as_any + @as_array = as_array + end + + def as_any? + @as_any + end + + def as_array? + @as_array + end +end + +module SchemaComplexTypeDefinition + include Enumerable + + def initialize + @content = [] + @element_cache = {} + end + + def is_concrete_definition + true + end + + def <<(ele) + @content << ele + end + + def each + @content.each do |ele| + yield ele + end + end + + def size + @content.size + end + + def as_any? + false + end + + def as_array? + false + end + + def find_element(qname) + @element_cache[qname] ||= search_element(qname) + end + +private + + def search_element(qname) + each do |ele| + if ele.respond_to?(:find_element) + found = ele.find_element(qname) + return found if found + else + # relaxed match + if ele.elename == qname or + (qname.namespace.nil? and ele.elename.name == qname.name) + return ele + end + end + end + nil + end +end + +class SchemaEmptyDefinition + include SchemaComplexTypeDefinition + + def initialize + super() + @content.freeze + end +end + +class SchemaSequenceDefinition + include SchemaComplexTypeDefinition + + def initialize + super() + end + + def choice? + false + end + + # override + def as_array? + @as_array ||= false + end + + def set_array + @as_array = true + end +end + +class SchemaChoiceDefinition + include SchemaComplexTypeDefinition + + def initialize + super() + end + + def choice? + true + end +end + +class SchemaDefinition + EMPTY = SchemaEmptyDefinition.new + + attr_reader :class_for + attr_reader :elename, :type + attr_reader :qualified + attr_accessor :basetype + attr_accessor :attributes + attr_accessor :elements + + def initialize(class_for, elename, type, anonymous, qualified) + @class_for = class_for + @elename = elename + @type = type + @anonymous = anonymous + @qualified = qualified + @basetype = nil + @elements = EMPTY + @attributes = nil + end + + def is_anonymous? + @anonymous + end + + def choice? + @elements.choice? + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/typeMap.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/typeMap.rb new file mode 100644 index 00000000..f06e5441 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/typeMap.rb @@ -0,0 +1,106 @@ +# SOAP4R - Base type mapping definition +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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::XSDNormalizedString::Type => SOAPNormalizedString, + XSD::XSDToken::Type => SOAPToken, + XSD::XSDLanguage::Type => SOAPLanguage, + XSD::XSDNMTOKEN::Type => SOAPNMTOKEN, + XSD::XSDNMTOKENS::Type => SOAPNMTOKENS, + XSD::XSDName::Type => SOAPName, + XSD::XSDNCName::Type => SOAPNCName, + XSD::XSDID::Type => SOAPID, + XSD::XSDIDREF::Type => SOAPIDREF, + XSD::XSDIDREFS::Type => SOAPIDREFS, + XSD::XSDENTITY::Type => SOAPENTITY, + XSD::XSDENTITIES::Type => SOAPENTITIES, + 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, + + # soap4r does not use soapenc types actively but it should be accepted. + SOAP::SOAPString::SOAPENCType => SOAPString, + SOAP::SOAPNormalizedString::Type => SOAPNormalizedString, + SOAP::SOAPToken::Type => SOAPToken, + SOAP::SOAPLanguage::Type => SOAPLanguage, + SOAP::SOAPNMTOKEN::Type => SOAPNMTOKEN, + SOAP::SOAPNMTOKENS::Type => SOAPNMTOKENS, + SOAP::SOAPName::Type => SOAPName, + SOAP::SOAPNCName::Type => SOAPNCName, + SOAP::SOAPID::Type => SOAPID, + SOAP::SOAPIDREF::Type => SOAPIDREF, + SOAP::SOAPIDREFS::Type => SOAPIDREFS, + SOAP::SOAPENTITY::Type => SOAPENTITY, + SOAP::SOAPENTITIES::Type => SOAPENTITIES, + SOAP::SOAPBoolean::SOAPENCType => SOAPBoolean, + SOAP::SOAPDecimal::SOAPENCType => SOAPDecimal, + SOAP::SOAPFloat::SOAPENCType => SOAPFloat, + SOAP::SOAPDouble::SOAPENCType => SOAPDouble, + SOAP::SOAPDuration::SOAPENCType => SOAPDuration, + SOAP::SOAPDateTime::SOAPENCType => SOAPDateTime, + SOAP::SOAPTime::SOAPENCType => SOAPTime, + SOAP::SOAPDate::SOAPENCType => SOAPDate, + SOAP::SOAPGYearMonth::SOAPENCType => SOAPGYearMonth, + SOAP::SOAPGYear::SOAPENCType => SOAPGYear, + SOAP::SOAPGMonthDay::SOAPENCType => SOAPGMonthDay, + SOAP::SOAPGDay::SOAPENCType => SOAPGDay, + SOAP::SOAPGMonth::SOAPENCType => SOAPGMonth, + SOAP::SOAPHexBinary::SOAPENCType => SOAPHexBinary, + SOAP::SOAPBase64::SOAPENCType => SOAPBase64, + SOAP::SOAPAnyURI::SOAPENCType => SOAPAnyURI, + SOAP::SOAPQName::SOAPENCType => SOAPQName, + SOAP::SOAPInteger::SOAPENCType => SOAPInteger, + SOAP::SOAPNonPositiveInteger::SOAPENCType => SOAPNonPositiveInteger, + SOAP::SOAPNegativeInteger::SOAPENCType => SOAPNegativeInteger, + SOAP::SOAPLong::SOAPENCType => SOAPLong, + SOAP::SOAPInt::SOAPENCType => SOAPInt, + SOAP::SOAPShort::SOAPENCType => SOAPShort, + SOAP::SOAPByte::SOAPENCType => SOAPByte, + SOAP::SOAPNonNegativeInteger::SOAPENCType => SOAPNonNegativeInteger, + SOAP::SOAPUnsignedLong::SOAPENCType => SOAPUnsignedLong, + SOAP::SOAPUnsignedInt::SOAPENCType => SOAPUnsignedInt, + SOAP::SOAPUnsignedShort::SOAPENCType => SOAPUnsignedShort, + SOAP::SOAPUnsignedByte::SOAPENCType => SOAPUnsignedByte, + SOAP::SOAPPositiveInteger::SOAPENCType => SOAPPositiveInteger, +} + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlencodedregistry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlencodedregistry.rb new file mode 100644 index 00000000..19fce1c5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlencodedregistry.rb @@ -0,0 +1,211 @@ +# SOAP4R - WSDL encoded mapping registry. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 < EncodedRegistry + attr_reader :definedelements + attr_reader :definedtypes + + def initialize(definedtypes = XSD::NamedElements::Empty) + super() + @definedtypes = definedtypes + # @definedelements = definedelements needed? + # For mapping AnyType element. + @rubytype_factory = RubytypeFactory.new( + :allow_untyped_struct => true, + :allow_original_mapping => true + ) + 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) + cause = nil + begin + unless obj_class + typestr = Mapping.safeconstname(node.elename.name) + obj_class = Mapping.class_from_name(typestr) + end + return Mapping._soap2obj(node, Mapping::DefaultRegistry, obj_class) + rescue MappingError + cause = $! + 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", cause) + end + +private + + def any2soap(obj, qname) + ele = nil + if obj.nil? + ele = SOAPNil.new + elsif qname.nil? or qname == XSD::AnyTypeName + ele = @rubytype_factory.obj2soap(nil, obj, nil, self) + elsif obj.is_a?(XSD::NSDBase) + ele = soap2soap(obj, qname) + elsif type = TypeMap[qname] + ele = base2soap(obj, type) + end + add_attributes2soap(obj, ele) unless ele.nil? + ele + 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.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. + if type.base + ele = base2soap(obj, TypeMap[type.base]) + ele.type = type.name + elsif type.list + value = obj.is_a?(Array) ? obj.join(" ") : obj.to_s + ele = base2soap(value, SOAP::SOAPString) + else + raise MappingError.new("unsupported simpleType: #{type}") + end + ele + 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 struct2soap(obj, type_qname, type) + return SOAPNil.new if obj.nil? # ToDo: check nillable. + soap_obj = SOAPStruct.new(type_qname) + mark_marshalled_obj(obj, soap_obj) + elements2soap(obj, soap_obj, type.elements) + 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 +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb new file mode 100644 index 00000000..91a6f944 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mapping/wsdlliteralregistry.rb @@ -0,0 +1,243 @@ +# SOAP4R - WSDL literal mapping registry. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/literalregistry' +require 'soap/mapping/typeMap' +require 'xsd/codegen/gensupport' +require 'xsd/namedelements' + + +module SOAP +module Mapping + + +class WSDLLiteralRegistry < LiteralRegistry + attr_reader :definedelements + attr_reader :definedtypes + + def initialize(definedtypes = XSD::NamedElements::Empty, + definedelements = XSD::NamedElements::Empty) + super() + @definedtypes = definedtypes + @definedelements = definedelements + end + + def obj2soap(obj, qname, obj_class = nil) + soap_obj = nil + if obj.is_a?(SOAPElement) + soap_obj = obj + elsif eledef = @definedelements[qname] + soap_obj = obj2elesoap(obj, eledef) + elsif type = @definedtypes[qname] + soap_obj = obj2typesoap(obj, type) + else + soap_obj = any2soap(obj, qname, obj_class) + 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) + cause = nil + begin + return any2obj(node, obj_class) + rescue MappingError + cause = $! + 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", cause) + else + raise MappingError.new("cannot map #{node.elename.name} to Ruby object", cause) + end + end + +private + + def obj2elesoap(obj, eledef) + ele = nil + qualified = (eledef.elementform == 'qualified') + if obj.is_a?(SOAPNil) + ele = obj + elsif eledef.type + if type = @definedtypes[eledef.type] + ele = obj2typesoap(obj, type) + elsif type = TypeMap[eledef.type] + ele = base2soap(obj, type) + else + raise MappingError.new("cannot find type #{eledef.type}") + end + elsif eledef.local_complextype + ele = obj2typesoap(obj, eledef.local_complextype) + elsif eledef.local_simpletype + ele = obj2typesoap(obj, eledef.local_simpletype) + else + raise MappingError.new('illegal schema?') + end + ele.elename = eledef.name + ele.qualified = qualified + ele + end + + def obj2typesoap(obj, type) + ele = nil + if type.is_a?(::WSDL::XMLSchema::SimpleType) + ele = simpleobj2soap(obj, type) + else # complexType + if type.simplecontent + ele = simpleobj2soap(obj, type.simplecontent) + else + ele = complexobj2soap(obj, type) + end + add_definedattributes2soap(obj, ele, type) + end + ele + end + + def simpleobj2soap(obj, type) + type.check_lexical_format(obj) + return SOAPNil.new if obj.nil? + if type.base + ele = base2soap(obj, TypeMap[type.base]) + elsif type.list + value = obj.is_a?(Array) ? obj.join(" ") : obj.to_s + ele = base2soap(value, SOAP::SOAPString) + else + raise MappingError.new("unsupported simpleType: #{type}") + end + ele + end + + def complexobj2soap(obj, type) + ele = SOAPElement.new(type.name) + complexobj2sequencesoap(obj, ele, type, type.choice?, type.choice?) + ele + end + + def complexobj2sequencesoap(obj, soap, type, nillable, is_choice) + added = false + type.elements.each do |child_ele| + case child_ele + when WSDL::XMLSchema::Any + any = Mapping.get_attributes_for_any(obj) + SOAPElement.from_objs(any).each do |child| + soap.add(child) + end + ele_added = true + when WSDL::XMLSchema::Element + ele_added = complexobj2soapchildren(obj, soap, child_ele, nillable) + when WSDL::XMLSchema::Sequence + ele_added = complexobj2sequencesoap(obj, soap, child_ele, nillable, false) + when WSDL::XMLSchema::Choice + ele_added = complexobj2sequencesoap(obj, soap, child_ele, true, true) + else + raise MappingError.new("unknown type: #{child_ele}") + end + added = true if ele_added + break if is_choice and ele_added + end + added + end + + def complexobj2soapchildren(obj, soap, child_ele, nillable = false) + if child_ele.map_as_array? + complexobj2soapchildren_array(obj, soap, child_ele, nillable) + else + complexobj2soapchildren_single(obj, soap, child_ele, nillable) + end + end + + def complexobj2soapchildren_array(obj, soap, child_ele, nillable) + child = Mapping.get_attribute(obj, child_ele.name.name) + if child.nil? and obj.is_a?(::Array) + child = obj + end + if child.nil? + return false if nillable + if child_soap = nil2soap(child_ele) + soap.add(child_soap) + return true + else + return false + end + end + unless child.respond_to?(:each) + return false + end + child.each do |item| + if item.is_a?(SOAPElement) + soap.add(item) + else + child_soap = obj2elesoap(item, child_ele) + soap.add(child_soap) + end + end + true + end + + def complexobj2soapchildren_single(obj, soap, child_ele, nillable) + child = Mapping.get_attribute(obj, child_ele.name.name) + case child + when NilClass + return false if nillable + if child_soap = nil2soap(child_ele) + soap.add(child_soap) + true + else + false + end + when SOAPElement + soap.add(child) + true + else + child_soap = obj2elesoap(child, child_ele) + soap.add(child_soap) + true + end + end + + def nil2soap(ele) + if ele.nillable + obj2elesoap(nil, ele) # add an empty element + elsif ele.minoccurs == 0 + nil # intends no element + else + warn("nil not allowed: #{ele.name.name}") + nil + end + end + + def add_definedattributes2soap(obj, ele, typedef) + if typedef.attributes + typedef.attributes.each do |at| + value = get_xmlattr_value(obj, at.name) + ele.extraattr[at.name] = value unless value.nil? + end + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/mappingRegistry.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mappingRegistry.rb new file mode 100644 index 00000000..50b0d220 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mappingRegistry.rb @@ -0,0 +1,9 @@ +# SOAP4R - RPC utility -- Mapping registry. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/compat' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/marshal.rb b/vendor/gems/soap4r-1.5.8/lib/soap/marshal.rb new file mode 100644 index 00000000..a74f98d4 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/marshal.rb @@ -0,0 +1,59 @@ +# SOAP4R - Marshalling/Unmarshalling Ruby's object using SOAP Encoding. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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::EncodedRegistry.new( + :allow_original_mapping => true) + MarshalMappingRegistry.add( + Time, + ::SOAP::SOAPDateTime, + ::SOAP::Mapping::EncodedRegistry::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/vendor/gems/soap4r-1.5.8/lib/soap/mimemessage.rb b/vendor/gems/soap4r-1.5.8/lib/soap/mimemessage.rb new file mode 100644 index 00000000..06686b99 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/mimemessage.rb @@ -0,0 +1,241 @@ +# 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.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, 2) + 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 + @boundary = 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/vendor/gems/soap4r-1.5.8/lib/soap/namespace.rb b/vendor/gems/soap4r-1.5.8/lib/soap/namespace.rb new file mode 100644 index 00000000..adc4f28e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/namespace.rb @@ -0,0 +1,9 @@ +# SOAP4R - Namespace library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/compat' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/nestedexception.rb b/vendor/gems/soap4r-1.5.8/lib/soap/nestedexception.rb new file mode 100644 index 00000000..a36c3dd1 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/nestedexception.rb @@ -0,0 +1,42 @@ +# SOAP4R - Nested exception implementation +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 NestedException + attr_reader :cause + attr_reader :original_backtraace + + def initialize(msg = nil, cause = nil) + super(msg) + @cause = cause + @original_backtrace = nil + end + + def set_backtrace(backtrace) + if @cause and @cause.respond_to?(:backtrace) + @original_backtrace = backtrace +=begin + # for agressive backtrace abstraction: 'here' only should not be good + here = @original_backtrace[0] + backtrace = Array[*@cause.backtrace] + backtrace[0] = "#{backtrace[0]}: #{@cause} (#{@cause.class})" + backtrace.unshift(here) +=end + # just join the nested backtrace at the tail of backtrace + caused = Array[*@cause.backtrace] + caused[0] = "#{caused[0]}: #{@cause} (#{@cause.class}) [NESTED]" + backtrace += caused + end + super(backtrace) + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/netHttpClient.rb b/vendor/gems/soap4r-1.5.8/lib/soap/netHttpClient.rb new file mode 100644 index 00000000..bbd5aa27 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/netHttpClient.rb @@ -0,0 +1,241 @@ +# SOAP4R - net/http wrapper +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' +require 'soap/filter/filterchain' + + +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 + attr_reader :test_loopback_response + attr_reader :request_filter # ignored for now. + + def initialize(proxy = nil, agent = nil) + @proxy = proxy ? URI.parse(proxy) : nil + @agent = agent + @debug_dev = nil + @test_loopback_response = [] + @request_filter = Filter::FilterChain.new + @session_manager = SessionManager.new + @no_proxy = @ssl_config = @protocol_version = nil + @connect_timeout = @send_timeout = @receive_timeout = nil + 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_auth(uri, user_id, passwd) + raise NotImplementedError.new("auth is not supported under soap4r + net/http.") + 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 = {}) + post_redirect(url, req_body, header, 10) + end + + def get_content(url, header = {}) + if str = @test_loopback_response.shift + return str + end + 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 post_redirect(url, req_body, header, redirect_count) + if str = @test_loopback_response.shift + if @debug_dev + @debug_dev << "= Request\n\n" + @debug_dev << req_body + @debug_dev << "\n\n= Response\n\n" + @debug_dev << str + end + status = 200 + reason = nil + contenttype = 'text/xml' + content = str + return Response.new(status, reason, contenttype, content) + return str + end + unless url.is_a?(URI) + url = URI.parse(url) + end + extra = header.dup + extra['User-Agent'] = @agent if @agent + res = start(url) { |http| + if @debug_dev + @debug_dev << "= Request\n\n" + @debug_dev << req_body << "\n" + end + http.post(url.request_uri, req_body, extra) + } + case res + when Net::HTTPRedirection + if redirect_count > 0 + post_redirect(res['location'], req_body, header, + redirect_count - 1) + else + raise ArgumentError.new("Too many redirects") + end + else + Response.from_httpresponse(res) + end + end + + def start(url) + http = create_connection(url) + response = nil + http.start { |worker| + response = yield(worker) + worker.finish + } + if @debug_dev + @debug_dev << "\n\n= Response\n\n" + @debug_dev << response.body << "\n" + end + 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 + unless @no_proxy + return false + end + @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 + false + end + + class SessionManager + attr_accessor :connect_timeout + attr_accessor :send_timeout + attr_accessor :receive_timeout + end + + class Response + attr_reader :status + attr_reader :reason + attr_reader :contenttype + attr_reader :content + + def initialize(status, reason, contenttype, content) + @status = status + @reason = reason + @contenttype = contenttype + @content = content + end + + def self.from_httpresponse(res) + status = res.code.to_i + reason = res.message + contenttype = res['content-type'] + content = res.body + new(status, reason, contenttype, content) + end + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/ns.rb b/vendor/gems/soap4r-1.5.8/lib/soap/ns.rb new file mode 100644 index 00000000..74321a87 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/ns.rb @@ -0,0 +1,34 @@ +# SOAP4R - SOAP Namespace library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 'xsd/ns' +require 'soap/soap' + + +module SOAP + + +class NS < XSD::NS + KNOWN_TAG = XSD::NS::KNOWN_TAG.dup.update( + SOAP::EnvelopeNamespace => 'env' + ) + + def initialize(tag2ns = nil) + super(tag2ns) + end + +private + + def default_known_tag + KNOWN_TAG + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/parser.rb b/vendor/gems/soap4r-1.5.8/lib/soap/parser.rb new file mode 100644 index 00000000..bdd28fdc --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/parser.rb @@ -0,0 +1,252 @@ +# SOAP4R - SOAP XML Instance Parser library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 'soap/soap' +require 'soap/ns' +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 + attr_reader :encodingstyle + attr_reader :handler + + 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, handler) + @ns = ns + @name = name + @node = NodeContainer.new(node) + @encodingstyle = encodingstyle + @handler = handler + end + + # to avoid memory consumption + def update(ns, name, node, encodingstyle, handler) + @ns = ns + @name = name + @node.replace_node(node) + @encodingstyle = encodingstyle + @handler = handler + self + 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 + @recycleframe = 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, raw_attrs) + lastframe = @parsestack.last + ns = parent = parent_encodingstyle = nil + if lastframe + ns = lastframe.ns + parent = lastframe.node + parent_encodingstyle = lastframe.encodingstyle + else + ns = SOAP::NS.new + parent = ParseFrame::NodeContainer.new(nil) + parent_encodingstyle = nil + end + # ns might be the same + ns, raw_attrs = XSD::XMLParser.filter_ns(ns, raw_attrs) + attrs = decode_attrs(ns, raw_attrs) + encodingstyle = attrs[AttrEncodingStyleName] + # 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 + handler = find_handler(encodingstyle) + unless handler + raise FormatDecodeError.new("Unknown encodingStyle: #{ encodingstyle }.") + end + node = decode_tag(ns, name, attrs, parent, handler) + if @recycleframe + @parsestack << @recycleframe.update(ns, name, node, encodingstyle, handler) + @recycleframe = nil + else + @parsestack << ParseFrame.new(ns, name, node, encodingstyle, handler) + end + end + + def characters(text) + # Ignore Text outside of SOAP Envelope. + if lastframe = @parsestack.last + # Need not to be cloned because character does not have attr. + decode_text(lastframe.ns, text, lastframe.handler) + 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.handler) + @lastnode = lastframe.node.node + @recycleframe = lastframe + end + +private + + def decode_tag(ns, name, attrs, parent, handler) + 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. + return handler.decode_tag(ns, ele, attrs, parent) + end + + def decode_tag_end(ns, node, handler) + return handler.decode_tag_end(ns, node) + 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_text(ns, text, handler) + handler.decode_text(ns, text) + 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 + return nil unless parent.node.is_a?(SOAPEnvelope) + o = SOAPHeader.new + parent.node.header = o + elsif ele.name == EleBody + return nil unless parent.node.is_a?(SOAPEnvelope) + o = SOAPBody.new + parent.node.body = o + elsif ele.name == EleFault + if parent.node.is_a?(SOAPBody) + o = SOAPFault.new + parent.node.fault = o + elsif parent.node.is_a?(SOAPEnvelope) + # live.com server returns SOAPFault as a direct child of SOAPEnvelope. + # support it even if it's not spec compliant. + warn("Fault must be a child of Body.") + body = SOAPBody.new + parent.node.body = body + o = SOAPFault.new + body.fault = o + else + return nil + end + end + o.extraattr.update(attrs) if o + 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/vendor/gems/soap4r-1.5.8/lib/soap/processor.rb b/vendor/gems/soap4r-1.5.8/lib/soap/processor.rb new file mode 100644 index 00000000..c78fc5d8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/processor.rb @@ -0,0 +1,66 @@ +# SOAP4R - marshal/unmarshal interface. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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) + Generator.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/vendor/gems/soap4r-1.5.8/lib/soap/property.rb b/vendor/gems/soap4r-1.5.8/lib/soap/property.rb new file mode 100644 index 00000000..23633ade --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/property.rb @@ -0,0 +1,333 @@ +# soap/property.rb: SOAP4R - Property implementation. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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('^(?:#.*|)$', nil, 'u') + CATDEF_REGEXP = Regexp.new("^\\[\\s*#{KEY_REGSRC}\\s*\\]$", nil, 'u') + LINE_REGEXP = Regexp.new("^#{DEF_REGSRC}$", nil, 'u') + def load(stream) + key_prefix = "" + stream.each_with_index do |line, lineno| + line.sub!(/\r?\n\z/u, '') + 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(/[^.\\]+(?:\\.[^.\\])*/u) # 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(/\\./u) { |c| eval("\"#{c}\"") } + end +end + + +end + + +# for ruby/1.6. +unless Enumerable.instance_methods.include?('inject') + module Enumerable + def inject(init) + result = init + each do |item| + result = yield(result, item) + end + result + end + end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/proxy.rb b/vendor/gems/soap4r-1.5.8/lib/soap/proxy.rb new file mode 100644 index 00000000..35ac400c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/proxy.rb @@ -0,0 +1,14 @@ +# SOAP4R - Proxy library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/proxy' + + +module SOAP + SOAPProxy = RPC::Proxy +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/qname.rb b/vendor/gems/soap4r-1.5.8/lib/soap/qname.rb new file mode 100644 index 00000000..e0f91523 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/qname.rb @@ -0,0 +1,9 @@ +# SOAP4R - XML QName definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/compat' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/cgistub.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/cgistub.rb new file mode 100644 index 00000000..65f9dd86 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/cgistub.rb @@ -0,0 +1,247 @@ +# SOAP4R - CGI/mod_ruby stub library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + + EMPTY_COOKIES = [].freeze + def cookies; EMPTY_COOKIES; end + + def user; 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 + + def cookies + if cookie = ENV['HTTP_Cookie'] || ENV['Cookie'] + [WEBrick::Cookie.parse(cookie)] + else + EMPTY_COOKIES + end + end + + def user + ENV['REMOTE_USER'] + 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 + + def cookies + if cookie = @request.env['HTTP_Cookie'] || @request.env['Cookie'] + [WEBrick::Cookie.parse(cookie)] + else + EMPTY_COOKIES + end + end + + def user + @request.env['REMOTE_USER'] + 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=(mapping_registry) + @router.mapping_registry = mapping_registry + end + + def literal_mapping_registry + @router.literal_mapping_registry + end + + def literal_mapping_registry=(literal_mapping_registry) + @router.literal_mapping_registry = literal_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_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 + + def filterchain + @router.filterchain + end + + # 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/vendor/gems/soap4r-1.5.8/lib/soap/rpc/driver.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/driver.rb new file mode 100644 index 00000000..7e221e0b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/driver.rb @@ -0,0 +1,247 @@ +# SOAP4R - SOAP RPC driver +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/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 :literal_mapping_registry, true + __attr_proxy :allow_unqualified_element, true + __attr_proxy :default_encodingstyle, true + __attr_proxy :generate_explicit_type, true + __attr_proxy :use_default_namespace, true + __attr_proxy :return_response_as_xml, true + __attr_proxy :headerhandler + __attr_proxy :filterchain + __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 + + # Mapping.define_singleton_method calls define_method with proc and it + # exhausts much memory for each singleton Object. just instance_eval instead + # of it. + 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 diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/element.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/element.rb new file mode 100644 index 00000000..4a78aca0 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/element.rb @@ -0,0 +1,369 @@ +# SOAP4R - RPC element definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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('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_member + true + 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 input_param_types + collect_param_types(IN, INOUT) + end + + def output_param_types + collect_param_types(OUT, INOUT) + end + + def set_param(params) + params.each do |param, data| + @inparam[param] = data + data.elename = XSD::QName.new(data.elename.namespace, param) + data.parent = self + end + end + + def set_outparam(params) + params.each do |param, data| + @outparam[param] = data + data.elename = XSD::QName.new(data.elename.namespace, param) + end + end + + def get_paramtypes(names) + types = [] + @signature.each do |io_type, name, type_qname| + if type_qname && idx = names.index(name) + types[idx] = type_qname + end + end + types + 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 and res_qnames can be nil + if req_qnames + req_qnames.each do |qname| + param_def << [IN, qname.name, [nil, qname.namespace, qname.name]] + end + end + if res_qnames + res_qnames.each do |qname| + param_def << [OUT, qname.name, [nil, qname.namespace, qname.name]] + end + end + param_def + end + +private + + def collect_param_types(*type) + names = [] + @signature.each do |io_type, name, type_qname| + names << type_qname if type.include?(io_type) + end + names + end + + def collect_params(*type) + names = [] + @signature.each do |io_type, name, type_qname| + names << name if type.include?(io_type) + end + names + end + + def init_param(param_def) + param_def.each do |io_type, name, param_type| + mapped_class, nsdef, namedef = SOAPMethod.parse_param_type(param_type) + if nsdef && namedef + type_qname = XSD::QName.new(nsdef, namedef) + elsif mapped_class + type_qname = TypeMap.index(mapped_class) + end + case io_type + when IN + @signature.push([IN, name, type_qname]) + @inparam_names.push(name) + when OUT + @signature.push([OUT, name, type_qname]) + @outparam_names.push(name) + when INOUT + @signature.push([INOUT, name, type_qname]) + @inoutparam_names.push(name) + when RETVAL + if @retval_name + raise MethodDefinitionError.new('duplicated retval') + end + @retval_name = name + @retval_class_name = mapped_class + else + raise MethodDefinitionError.new("unknown type: #{io_type}") + end + end + end + + def self.parse_param_type(param_type) + mapped_class, nsdef, namedef = param_type + # the first element of typedef in param_def can be a String like + # "::SOAP::SOAPStruct" or "CustomClass[]". turn this String to a class if + # we can. + if mapped_class.is_a?(String) + if /\[\]\Z/ =~ mapped_class + # when '[]' is added, ignore this. + mapped_class = nil + else + mapped_class = Mapping.class_from_name(mapped_class) + end + end + [mapped_class, nsdef, namedef] + 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) + 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 +end + + +class SOAPMethodResponse < SOAPMethod + + def initialize(qname, param_def = nil) + super(qname, param_def) + @retval = nil + end + + def retval + @retval + 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/vendor/gems/soap4r-1.5.8/lib/soap/rpc/httpserver.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/httpserver.rb new file mode 100644 index 00000000..26eb55e2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/httpserver.rb @@ -0,0 +1,169 @@ +# SOAP4R - WEBrick HTTP Server +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + + class << self + if RUBY_VERSION >= "1.7.0" + def __attr_proxy(symbol, assignable = false) + name = symbol.to_s + define_method(name) { + @router.__send__(name) + } + if assignable + aname = name + '=' + define_method(aname) { |rhs| + @router.__send__(aname, rhs) + } + end + end + else + def __attr_proxy(symbol, assignable = false) + name = symbol.to_s + module_eval <<-EOS + def #{name} + @router.#{name} + end + EOS + if assignable + module_eval <<-EOS + def #{name}=(value) + @router.#{name} = value + end + EOS + end + end + end + end + + __attr_proxy :mapping_registry, true + __attr_proxy :literal_mapping_registry, true + __attr_proxy :generate_explicit_type, true + __attr_proxy :use_default_namespace, true + + def initialize(config) + actor = config[:SOAPHTTPServerApplicationName] || self.class.name + super(actor) + @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(actor) + @soaplet = ::SOAP::RPC::SOAPlet.new(@router) + on_init + @server = WEBrick::HTTPServer.new(@webrick_config) + @server.mount('/soaprouter', @soaplet) + if wsdldir = config[:WSDLDocumentDirectory] + @server.mount('/wsdl', WEBrick::HTTPServlet::FileHandler, wsdldir) + end + # for backward compatibility + @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 authenticator + @soaplet.authenticator + end + + def authenticator=(authenticator) + @soaplet.authenticator = authenticator + 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 + + def filterchain + @router.filterchain + end + + # 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/vendor/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb new file mode 100644 index 00000000..a2cd0701 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb @@ -0,0 +1,576 @@ +# SOAP4R - RPC Proxy library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/literalregistry' +require 'soap/rpc/rpc' +require 'soap/rpc/element' +require 'soap/header/handlerset' +require 'soap/filter' +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_accessor :use_default_namespace + attr_accessor :return_response_as_xml + attr_reader :headerhandler + attr_reader :filterchain + 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 + @protocol_option = options["protocol"] ||= ::SOAP::Property.new + initialize_streamhandler(@protocol_option) + @operation = {} + @operation_by_qname = {} + @operation_by_soapaction = {} + @mandatorycharset = nil + # TODO: set to false by default or drop thie option in 1.6.0 + @allow_unqualified_element = true + @default_encodingstyle = nil + @generate_explicit_type = true + @use_default_namespace = false + @return_response_as_xml = false + @headerhandler = Header::HandlerSet.new + @filterchain = Filter::FilterChain.new + @mapping_registry = nil + @literal_mapping_registry = ::SOAP::Mapping::LiteralRegistry.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 = {}) + ensure_styleuse_option(opt, :rpc, :encoded) + opt[:request_qname] = qname + op = Operation.new(soapaction, param_def, opt) + assign_operation(name, qname, soapaction, op) + end + + def add_document_operation(soapaction, name, param_def, opt = {}) + ensure_styleuse_option(opt, :document, :literal) + op = Operation.new(soapaction, param_def, opt) + assign_operation(name, nil, soapaction, op) + 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 + env = route(req_header, req_body, opt, opt) + if @return_response_as_xml + opt[:response_as_xml] + else + env + end + end + + def call(name, *params) + # name must be used only for lookup + op_info = lookup_operation(name) + 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, + :use_default_namespace => + op_info.use_default_namespace || @use_default_namespace + ) + resopt = create_encoding_opt( + :envelopenamespace => @options["soap.envelope.responsenamespace"], + :default_encodingstyle => + @default_encodingstyle || op_info.response_default_encodingstyle + ) + env = route(req_header, req_body, reqopt, resopt) + if op_info.response_use.nil? + return nil + end + 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 + if @return_response_as_xml + resopt[:response_as_xml] + else + op_info.response_obj(env.body, @mapping_registry, + @literal_mapping_registry, mapping_opt) + end + 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 ensure_styleuse_option(opt, style, use) + if opt[:request_style] || opt[:response_style] || opt[:request_use] || opt[:response_use] + # do not edit + else + opt[:request_style] ||= style + opt[:response_style] ||= style + opt[:request_use] ||= use + opt[:response_use] ||= use + end + end + + def initialize_streamhandler(options) + value = options["streamhandler"] + if value and !value.empty? + factory = Property::Util.const_from_name(value) + else + factory = HTTPStreamHandler + end + @streamhandler = factory.create(options) + options.add_hook("streamhandler") do |key, value| + @streamhandler.reset + if value.respond_to?(:create) + factory = value + elsif value and !value.to_str.empty? + factory = Property::Util.const_from_name(value.to_str) + else + factory = HTTPStreamHandler + end + options.unlock(true) + @streamhandler = factory.create(options) + end + end + + 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 + header = ::SOAP::SOAPHeader.new + items = @headerhandler.on_outbound(header) + items.each do |item| + header.add(item.elename.name, item) + end + header + end + + def receive_headers(header) + @headerhandler.on_inbound(header) if header + end + + def marshal(env, opt) + @filterchain.each do |filter| + env = filter.on_outbound(env, opt) + break unless env + end + send_string = Processor.marshal(env, opt) + StreamHandler::ConnectionData.new(send_string) + end + + def unmarshal(conn_data, opt) + contenttype = conn_data.receive_contenttype + xml = nil + 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) + xml = mime.root.content + else + opt[:charset] = @mandatorycharset || + ::SOAP::StreamHandler.parse_media_type(contenttype) + xml = conn_data.receive_string + end + @filterchain.reverse_each do |filter| + xml = filter.on_inbound(xml, opt) + break unless xml + end + env = Processor.unmarshal(xml, opt) + if @return_response_as_xml + opt[:response_as_xml] = xml + end + unless env.is_a?(::SOAP::SOAPEnvelope) + raise ResponseFormatError.new("response is not a SOAP envelope: #{env}") + end + env + 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 + + def assign_operation(name, qname, soapaction, op) + assigned = false + if name and !name.empty? + @operation[name] = op + assigned = true + end + if qname + @operation_by_qname[qname] = op + assigned = true + end + if soapaction and !soapaction.empty? + @operation_by_soapaction[soapaction] = op + assigned = true + end + unless assigned + raise MethodDefinitionError.new("cannot assign operation") + end + end + + def lookup_operation(name_or_qname_or_soapaction) + if op = @operation[name_or_qname_or_soapaction] + return op + end + if op = @operation_by_qname[name_or_qname_or_soapaction] + return op + end + if op = @operation_by_soapaction[name_or_qname_or_soapaction] + return op + end + raise MethodDefinitionError.new( + "operation: #{name_or_qname_or_soapaction} not supported") + end + + class Operation + attr_reader :soapaction + attr_reader :request_style + attr_reader :response_style + attr_reader :request_use + attr_reader :response_use + attr_reader :use_default_namespace + + 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] + @use_default_namespace = + opt[:use_default_namespace] || opt[:elementformdefault] + if opt.key?(:elementformdefault) + warn("option :elementformdefault is deprecated. use :use_default_namespace instead") + end + 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 + unique_result_for_one_element_array( + response_doc(body, mapping_registry, literal_mapping_registry, opt)) + 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 + + # nil for [] / 1 for [1] / [1, 2] for [1, 2] + def unique_result_for_one_element_array(ary) + ary.size <= 1 ? ary[0] : ary + end + + def check_style(style) + unless [:rpc, :document].include?(style) + raise MethodDefinitionError.new("unknown style: #{style}") + end + end + + # nil means oneway + def check_use(use) + unless [:encoded, :literal, nil].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 + types = method.input_param_types + ary = Mapping.objs2soap(values, mapping_registry, types, opt) + soap = {} + 0.upto(ary.length - 1) do |idx| + soap[names[idx]] = ary[idx] + end + method.set_param(soap) + method + end + + def request_rpc_lit(values, mapping_registry, opt) + method = @rpc_method_factory.dup + names = method.input_params + types = method.get_paramtypes(names) + params = {} + idx = 0 + names.each do |name| + params[name] = Mapping.obj2soap(values[idx], mapping_registry, + types[idx], opt) + params[name].elename = XSD::QName.new(nil, name) + 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.qualified = @doc_request_qualified[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 + ele.qualified = @doc_request_qualified[idx] + 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 + response_doc_enc(body, mapping_registry, opt) + else + 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 + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpc/router.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/router.rb new file mode 100644 index 00000000..18d4baf9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/router.rb @@ -0,0 +1,669 @@ +# SOAP4R - RPC Routing library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/literalregistry' +require 'soap/rpc/rpc' +require 'soap/rpc/element' +require 'soap/header/handlerset' +require 'soap/filter' +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 :use_default_namespace + attr_accessor :external_ces + attr_reader :filterchain + + def initialize(actor) + @actor = actor + @mapping_registry = nil + @headerhandler = Header::HandlerSet.new + @literal_mapping_registry = ::SOAP::Mapping::LiteralRegistry.new + @generate_explicit_type = true + @use_default_namespace = false + @external_ces = nil + @operation_by_soapaction = {} + @operation_by_qname = {} + @headerhandlerfactory = [] + @filterchain = Filter::FilterChain.new + 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 + soap_response = default_encodingstyle = nil + begin + receive_headers(headerhandler, env.header) + soap_response = + op.call(env.body, @mapping_registry, @literal_mapping_registry, + create_mapping_opt) + conn_data.is_fault = true if soap_response.is_a?(SOAPFault) + default_encodingstyle = op.response_default_encodingstyle + rescue Exception => e + # If a wsdl fault was raised by service, the fault declaration details + # is kept in wsdl_fault. Otherwise (exception is a program fault) + # wsdl_fault is nil + wsdl_fault_details = op.faults && op.faults[e.class.name] + soap_response = fault(e, wsdl_fault_details) + conn_data.is_fault = true + default_encodingstyle = nil + end + header = call_headers(headerhandler) + if op.response_use.nil? + conn_data.send_string = '' + conn_data.is_nocontent = true + conn_data + else + body = SOAPBody.new(soap_response, conn_data.is_fault) + env = SOAPEnvelope.new(header, body) + marshal(conn_data, env, default_encodingstyle) + end + end + + # Create fault response string. + def create_fault_response(e) + env = SOAPEnvelope.new(SOAPHeader.new, SOAPBody.new(fault(e, nil), true)) + opt = {} + opt[:external_content] = nil + @filterchain.reverse_each do |filter| + env = filter.on_outbound(env, opt) + break unless env + end + 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) + if opt[:request_style] || opt[:response_style] || opt[:request_use] || opt[:response_use] + # do not edit + else + opt[:request_style] ||= style + opt[:response_style] ||= style + opt[:request_use] ||= use + opt[:response_use] ||= use + end + 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) + header = ::SOAP::SOAPHeader.new + items = headerhandler.on_outbound(header) + items.each do |item| + header.add(item.elename.name, item) + end + header + end + + def receive_headers(headerhandler, header) + headerhandler.on_inbound(header) if header + end + + def unmarshal(conn_data) + xml = nil + 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) + xml = mime.root.content + else + opt[:charset] = ::SOAP::StreamHandler.parse_media_type(contenttype) + xml = conn_data.receive_string + end + @filterchain.each do |filter| + xml = filter.on_inbound(xml, opt) + break unless xml + end + env = Processor.unmarshal(xml, opt) + 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 + opt[:use_default_namespace] = @use_default_namespace + @filterchain.reverse_each do |filter| + env = filter.on_outbound(env, opt) + break unless env + end + 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, wsdl_fault_details) + if e.is_a?(UnhandledMustUnderstandHeaderError) + faultcode = FaultCode::MustUnderstand + else + faultcode = FaultCode::Server + end + + # If the exception represents a WSDL fault, the fault element should + # be added as the SOAP fault element. If the exception is a + # normal program exception, it is wrapped inside a custom SOAP4R + # SOAP exception element. + detail = nil + begin + if (wsdl_fault_details) + registry = wsdl_fault_details[:use] == "literal" ? + @literal_mapping_registry : @mapping_registry + faultQName = XSD::QName.new( + wsdl_fault_details[:ns], wsdl_fault_details[:name] + ) + detail = Mapping.obj2soap(e, registry, faultQName) + # wrap fault element (SOAPFault swallows top-level element) + wrapper = SOAP::SOAPElement.new(faultQName) + wrapper.add(detail) + detail = wrapper + else + # Exception is a normal program exception. Wrap it. + detail = Mapping.obj2soap(Mapping::SOAPException.new(e), + @mapping_registry) + detail.elename ||= XSD::QName::EMPTY # for literal mappingregstry + end + rescue + detail = SOAPString.new("failed to serialize detail object: #{$!}") + end + + SOAPFault.new( + SOAPElement.new(nil, faultcode), + SOAPString.new(e.to_s), + SOAPString.new(@actor), + detail) + 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 + attr_reader :faults + + 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] + @faults = opt[:faults] + 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) + elsif @doc_response_qnames.empty? + # nothing to do + 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?(SOAPNameAccessible) + if request.is_a?(SOAPNil) + # SOAP::Lite/0.69 seems to send xsi:nil="true" element as a request. + request = SOAPStruct.new(request.elename) + else + raise RPCRoutingError.new("not an RPC style") + end + 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 == 0 + result = [] + elsif @doc_response_qnames.size == 1 + 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, + soap_response.elename, opt) + else + soap_response.retval = Mapping.obj2soap(result, mapping_registry, + 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.qualified = @doc_response_qualified[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 + ele.qualified = @doc_response_qualified[idx] + ele + } + end + + def check_style(style) + unless [:rpc, :document].include?(style) + raise ArgumentError.new("unknown style: #{style}") + end + end + + # nil means oneway + def check_use(use) + unless [:encoded, :literal, nil].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/vendor/gems/soap4r-1.5.8/lib/soap/rpc/rpc.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/rpc.rb new file mode 100644 index 00000000..521d001d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/rpc.rb @@ -0,0 +1,25 @@ +# SOAP4R - RPC utility. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/soap/rpc/soaplet.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/soaplet.rb new file mode 100644 index 00000000..88a955c3 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/soaplet.rb @@ -0,0 +1,210 @@ +# SOAP4R - SOAP handler servlet for WEBrick +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + attr_accessor :authenticator + + def initialize(router = nil) + @router = router || ::SOAP::RPC::Router.new(self.class.name) + @options = {} + @authenticator = nil + @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 + if @authenticator + @authenticator.authenticate(req, res) + # you can check authenticated user with SOAP::RPC::SOAPlet.user + end + begin + conn_data = ::SOAP::StreamHandler::ConnectionData.new + setup_req(conn_data, req) + @router.external_ces = @options[:external_ces] + Mapping.protect_threadvars(:SOAPlet) do + SOAPlet.user = req.user + SOAPlet.cookies = req.cookies + conn_data = @router.route(conn_data) + setup_res(conn_data, req, res) + end + 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 + + def self.cookies + get_variable(:Cookies) + end + + def self.cookies=(cookies) + set_variable(:Cookies, cookies) + end + + def self.user + get_variable(:User) + end + + def self.user=(user) + set_variable(:User, user) + end + +private + + def self.get_variable(name) + if var = Thread.current[:SOAPlet] + var[name] + else + nil + end + end + + def self.set_variable(name, value) + var = Thread.current[:SOAPlet] ||= {} + var[name] = value + end + + 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 + cookies = SOAPlet.cookies + unless cookies.empty? + res['set-cookie'] = cookies.collect { |cookie| cookie.to_s } + end + if conn_data.is_nocontent + res.status = WEBrick::HTTPStatus::RC_ACCEPTED + res.body = '' + return + end + 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/vendor/gems/soap4r-1.5.8/lib/soap/rpc/standaloneServer.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/standaloneServer.rb new file mode 100644 index 00000000..b7e1ae4c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpc/standaloneServer.rb @@ -0,0 +1,43 @@ +# SOAP4R - WEBrick Server +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/soap/rpcRouter.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpcRouter.rb new file mode 100644 index 00000000..857943b6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpcRouter.rb @@ -0,0 +1,9 @@ +# SOAP4R - RPC Routing library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/compat' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/rpcUtils.rb b/vendor/gems/soap4r-1.5.8/lib/soap/rpcUtils.rb new file mode 100644 index 00000000..918add99 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/rpcUtils.rb @@ -0,0 +1,9 @@ +# SOAP4R - RPC utility. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/compat' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/server.rb b/vendor/gems/soap4r-1.5.8/lib/soap/server.rb new file mode 100644 index 00000000..e0b22f4f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/server.rb @@ -0,0 +1,9 @@ +# SOAP4R - Server implementation +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/compat' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/soap.rb b/vendor/gems/soap4r-1.5.8/lib/soap/soap.rb new file mode 100644 index 00000000..f05b25f8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/soap.rb @@ -0,0 +1,151 @@ +# soap/soap.rb: SOAP4R - Base definitions. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 'soap/nestedexception' + + +module SOAP + + +VERSION = Version = '1.5.8' +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' +AttrHref = 'href' +AttrId = 'id' +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 +AttrActorName = XSD::QName.new(EnvelopeNamespace, AttrActor).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 +AttrHrefName = XSD::QName.new(nil, AttrHref).freeze +AttrIdName = XSD::QName.new(nil, AttrId).freeze +ValueArrayName = XSD::QName.new(EncodingNamespace, ValueArray).freeze + +Base64Literal = 'base64' + +MediaType = 'text/xml' + +class Error < StandardError; include NestedException; 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 + + +module FaultCode + VersionMismatch = XSD::QName.new(EnvelopeNamespace, 'VersionMismatch').freeze + MustUnderstand = XSD::QName.new(EnvelopeNamespace, 'MustUnderstand').freeze + Client = XSD::QName.new(EnvelopeNamespace, 'Client').freeze + Server = XSD::QName.new(EnvelopeNamespace, 'Server').freeze +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 + + is_cgi = !getenv('request_method').nil? + HTTP_PROXY = is_cgi ? getenv('cgi_http_proxy') : getenv('http_proxy') + NO_PROXY = getenv('no_proxy') +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/vendor/gems/soap4r-1.5.8/lib/soap/standaloneServer.rb b/vendor/gems/soap4r-1.5.8/lib/soap/standaloneServer.rb new file mode 100644 index 00000000..807fdcb5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/standaloneServer.rb @@ -0,0 +1,9 @@ +# SOAP4R - Standalone Server +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/compat' diff --git a/vendor/gems/soap4r-1.5.8/lib/soap/streamHandler.rb b/vendor/gems/soap4r-1.5.8/lib/soap/streamHandler.rb new file mode 100644 index 00000000..c9de3748 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/streamHandler.rb @@ -0,0 +1,302 @@ +# SOAP4R - Stream handler. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' +require 'soap/filter/filterchain' +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 }]" + + attr_reader :filterchain + + class ConnectionData + attr_accessor :send_string + attr_accessor :send_contenttype + attr_accessor :receive_string + attr_accessor :receive_contenttype + attr_accessor :is_fault + attr_accessor :is_nocontent + attr_accessor :soapaction + + def initialize(send_string = nil) + @send_string = send_string + @send_contenttype = nil + @receive_string = nil + @receive_contenttype = nil + @is_fault = false + @is_nocontent = false + @soapaction = nil + end + end + + def initialize + @filterchain = Filter::FilterChain.new + 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 + + def send(url, conn_data, soapaction = nil, charset = nil) + # send a ConnectionData to specified url. + # return value is a ConnectionData with receive_* property filled. + # You can fill values of given conn_data and return it. + end + + def reset(url = nil) + # for initializing connection status if needed. + # return value is not expected. + end + + def set_wiredump_file_base(wiredump_file_base) + # for logging. return value is not expected. + # Override it when you want. + raise NotImplementedError + end + + def test_loopback_response + # for loopback testing. see HTTPStreamHandler for more detail. + # return value is an Array of loopback responses. + # Override it when you want. + raise NotImplementedError + end +end + + +class HTTPStreamHandler < StreamHandler + include SOAP + + begin + require 'httpclient' + Client = HTTPClient + RETRYABLE = true + rescue LoadError + 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 + end + + class HttpPostRequestFilter + def initialize(filterchain) + @filterchain = filterchain + end + + def filter_request(req) + @filterchain.each do |filter| + filter.on_http_outbound(req) + end + end + + def filter_response(req, res) + @filterchain.each do |filter| + filter.on_http_inbound(req, res) + end + end + end + +public + + attr_reader :client + attr_accessor :wiredump_file_base + + MAX_RETRY_COUNT = 10 # [times] + + def self.create(options) + new(options) + end + + def initialize(options) + super() + @client = Client.new(nil, "SOAP4R/#{ Version }") + if @client.respond_to?(:request_filter) + @client.request_filter << HttpPostRequestFilter.new(@filterchain) + end + @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(url, conn_data, soapaction = nil, charset = @charset) + conn_data.soapaction ||= soapaction # for backward conpatibility + conn_data = send_post(url, conn_data, charset) + @client.save_cookie_store if @cookie_store + conn_data + end + + def reset(url = nil) + if url.nil? + @client.reset_all + else + @client.reset(url) + end + @client.save_cookie_store if @cookie_store + end + +private + + def set_options + @options["http"] ||= ::SOAP::Property.new + HTTPConfigLoader.set_options(@client, @options["http"]) + @charset = @options["http.charset"] || XSD::Charset.xml_encoding_label + @options.add_hook("http.charset") do |key, value| + @charset = value + end + @wiredump_dev = @options["http.wiredump_dev"] + @options.add_hook("http.wiredump_dev") do |key, value| + @wiredump_dev = value + @client.debug_dev = @wiredump_dev + end + set_cookie_store_file(@options["http.cookie_store_file"]) + @options.add_hook("http.cookie_store_file") do |key, value| + set_cookie_store_file(value) + end + ssl_config = @options["http.ssl_config"] + basic_auth = @options["http.basic_auth"] + auth = @options["http.auth"] + @options["http"].lock(true) + ssl_config.unlock + basic_auth.unlock + 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(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 + + extheader = {} + extheader['Content-Type'] = conn_data.send_contenttype + extheader['SOAPAction'] = "\"#{ conn_data.soapaction }\"" + extheader['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(url, send_string, extheader) + if RETRYABLE and HTTP::Status.redirect?(res.status) + retry_count += 1 + if retry_count >= MAX_RETRY_COUNT + raise HTTPStreamError.new("redirect count exceeded") + end + url = res.header["location"][0] + puts "redirected to #{url}" if $DEBUG + else + break + end + end + rescue + @client.reset(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, 202, 500 + # Nothing to do. 202 is for oneway service. + else + raise HTTPStreamError.new("#{ res.status }: #{ res.reason }") + end + + # decode gzipped content, if we know it's there from the headers + 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) + # otherwise check for the gzip header + elsif @accept_encoding_gzip && receive_string[0..1] == "\x1f\x8b" + 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/vendor/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb b/vendor/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb new file mode 100644 index 00000000..f0d7fd2a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb @@ -0,0 +1,597 @@ +# SOAP4R - SOAP WSDL driver +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' +require 'wsdl/soap/classDefCreatorSupport' +require 'wsdl/soap/classNameCreator' + + +module SOAP + + +class WSDLDriverFactory + include WSDL::SOAP::ClassDefCreatorSupport + + class FactoryError < StandardError; end + + attr_reader :wsdl + + def initialize(wsdl) + @wsdl = import(wsdl) + name_creator = WSDL::SOAP::ClassNameCreator.new + @modulepath = 'WSDLDriverFactory' + @methoddefcreator = + WSDL::SOAP::MethodDefCreator.new(@wsdl, name_creator, @modulepath, {}) + end + + def inspect + sprintf("#<%s:%s:0x%x\n\n%s>", self.class.name, @wsdl.name, __id__, dump_method_signatures) + 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 + + # deprecated old interface + def create_driver(servicename = nil, portname = nil) + warn("WSDLDriverFactory#create_driver is deprecated. Use create_rpc_driver instead.") + port = find_port(servicename, portname) + WSDLDriver.new(@wsdl, port, nil) + end + + # Backward compatibility. + alias createDriver create_driver + + def dump_method_signatures(servicename = nil, portname = nil) + targetservice = XSD::QName.new(@wsdl.targetnamespace, servicename) if servicename + targetport = XSD::QName.new(@wsdl.targetnamespace, portname) if portname + sig = [] + element_definitions = @wsdl.collect_elements + @wsdl.services.each do |service| + next if targetservice and service.name != targetservice + service.ports.each do |port| + next if targetport and port.name != targetport + sig << port.porttype.operations.collect { |operation| + dump_method_signature(operation, element_definitions).gsub(/^#/, ' ') + }.join("\n") + end + end + sig.join("\n") + end + +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.soapbody_use_input, + :response_use => op_bind.soapbody_use_output + } + 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_type, name, param_type| + [io_type, name, ::SOAP::RPC::SOAPMethod.parse_param_type(param_type)] + } + 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 + header = SOAPHeader.new + items = @proxy.headerhandler.on_outbound(header) + items.each do |item| + header.add(item.elename.name, item) + end + header + end + + def receive_headers(header) + @proxy.headerhandler.on_inbound(header) if header + 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) + param_count = parts_names.size + @host.instance_eval <<-EOS + def #{name}(*arg) + unless arg.size == #{param_count} + raise ArgumentError.new( + "wrong number of arguments (\#{arg.size} for #{param_count})") + end + @servant.rpc_call(#{name.dump}, *arg) + end + EOS + @host.method(name) + end + + def add_document_method_interface(name, parts_names) + @host.instance_eval <<-EOS + def #{name}(h, b) + @servant.document_send(#{name.dump}, h, b) + end + EOS + @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/vendor/gems/soap4r-1.5.8/lib/tags b/vendor/gems/soap4r-1.5.8/lib/tags new file mode 100644 index 00000000..37e4303e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/tags @@ -0,0 +1,5690 @@ ++ xsd/namedelements.rb /^ def +/ +::Enumerable soap/property.rb /^ module Enumerable/ +::Enumerable#inject soap/property.rb /^ def inject/ +::Kernel soap/soap.rb /^ module Kernel/ +::Kernel#warn soap/soap.rb /^ def warn/ +::Object soap/soap.rb /^ class Object/ +::Object#instance_variable_get soap/soap.rb /^ def instance_variable_get/ +::Object#instance_variable_set soap/soap.rb /^ def instance_variable_set/ +::SOAP soap/attachment.rb /^module SOAP/ +::SOAP soap/baseData.rb /^module SOAP/ +::SOAP soap/compat.rb /^module SOAP/ +::SOAP soap/element.rb /^module SOAP/ +::SOAP soap/encodingstyle/aspDotNetHandler.rb /^module SOAP/ +::SOAP soap/encodingstyle/handler.rb /^module SOAP/ +::SOAP soap/encodingstyle/literalHandler.rb /^module SOAP/ +::SOAP soap/encodingstyle/soapHandler.rb /^module SOAP/ +::SOAP soap/filter/filterchain.rb /^module SOAP/ +::SOAP soap/filter/handler.rb /^module SOAP/ +::SOAP soap/filter/streamhandler.rb /^module SOAP/ +::SOAP soap/generator.rb /^module SOAP/ +::SOAP soap/header/handler.rb /^module SOAP/ +::SOAP soap/header/handlerset.rb /^module SOAP/ +::SOAP soap/header/mappinghandler.rb /^module SOAP/ +::SOAP soap/header/simplehandler.rb /^module SOAP/ +::SOAP soap/httpconfigloader.rb /^module SOAP/ +::SOAP soap/mapping/encodedregistry.rb /^module SOAP/ +::SOAP soap/mapping/factory.rb /^module SOAP/ +::SOAP soap/mapping/literalregistry.rb /^module SOAP/ +::SOAP soap/mapping/mapping.rb /^module SOAP/ +::SOAP soap/mapping/registry.rb /^module SOAP/ +::SOAP soap/mapping/rubytypeFactory.rb /^module SOAP/ +::SOAP soap/mapping/schemadefinition.rb /^module SOAP/ +::SOAP soap/mapping/typeMap.rb /^module SOAP/ +::SOAP soap/mapping/wsdlencodedregistry.rb /^module SOAP/ +::SOAP soap/mapping/wsdlliteralregistry.rb /^module SOAP/ +::SOAP soap/marshal.rb /^module SOAP/ +::SOAP soap/mimemessage.rb /^module SOAP/ +::SOAP soap/nestedexception.rb /^module SOAP/ +::SOAP soap/netHttpClient.rb /^module SOAP/ +::SOAP soap/ns.rb /^module SOAP/ +::SOAP soap/parser.rb /^module SOAP/ +::SOAP soap/processor.rb /^module SOAP/ +::SOAP soap/property.rb /^module SOAP/ +::SOAP soap/proxy.rb /^module SOAP/ +::SOAP soap/rpc/cgistub.rb /^module SOAP/ +::SOAP soap/rpc/driver.rb /^module SOAP/ +::SOAP soap/rpc/element.rb /^module SOAP/ +::SOAP soap/rpc/httpserver.rb /^module SOAP/ +::SOAP soap/rpc/proxy.rb /^module SOAP/ +::SOAP soap/rpc/router.rb /^module SOAP/ +::SOAP soap/rpc/rpc.rb /^module SOAP/ +::SOAP soap/rpc/soaplet.rb /^module SOAP/ +::SOAP soap/rpc/standaloneServer.rb /^module SOAP/ +::SOAP soap/soap.rb /^module SOAP/ +::SOAP soap/streamHandler.rb /^module SOAP/ +::SOAP soap/wsdlDriver.rb /^module SOAP/ +::SOAP.create_schema_definition soap/mapping/mapping.rb /^ def self.create_schema_definition/ +::SOAP.external_ces soap/mapping/mapping.rb /^ def self.external_ces/ +::SOAP.get_attribute soap/mapping/mapping.rb /^ def self.get_attribute/ +::SOAP.get_attributes soap/mapping/mapping.rb /^ def self.get_attributes/ +::SOAP.get_attributes_for_any soap/mapping/mapping.rb /^ def self.get_attributes_for_any/ +::SOAP.parse_schema_definition soap/mapping/mapping.rb /^ def self.parse_schema_definition/ +::SOAP.parse_schema_element_definition soap/mapping/mapping.rb /^ def self.parse_schema_element_definition/ +::SOAP.reset_root_type_hint soap/mapping/mapping.rb /^ def self.reset_root_type_hint/ +::SOAP.root_type_hint soap/mapping/mapping.rb /^ def self.root_type_hint/ +::SOAP.safeconstname soap/mapping/mapping.rb /^ def self.safeconstname/ +::SOAP.safemethodname soap/mapping/mapping.rb /^ def self.safemethodname/ +::SOAP.safevarname soap/mapping/mapping.rb /^ def self.safevarname/ +::SOAP.schema_attribute_definition soap/mapping/mapping.rb /^ def self.schema_attribute_definition/ +::SOAP.schema_definition_classdef soap/mapping/mapping.rb /^ def self.schema_definition_classdef/ +::SOAP.schema_element_definition soap/mapping/mapping.rb /^ def self.schema_element_definition/ +::SOAP.schema_name_definition soap/mapping/mapping.rb /^ def self.schema_name_definition/ +::SOAP.schema_ns_definition soap/mapping/mapping.rb /^ def self.schema_ns_definition/ +::SOAP.schema_qualified_definition soap/mapping/mapping.rb /^ def self.schema_qualified_definition/ +::SOAP.schema_type_definition soap/mapping/mapping.rb /^ def self.schema_type_definition/ +::SOAP.set_attributes soap/mapping/mapping.rb /^ def self.set_attributes/ +::SOAP::ArrayIndexOutOfBoundsError soap/soap.rb /^class ArrayIndexOutOfBoundsError/ +::SOAP::ArrayStoreError soap/soap.rb /^class ArrayStoreError/ +::SOAP::Attachment soap/attachment.rb /^class Attachment/ +::SOAP::Attachment#content soap/attachment.rb /^ def content/ +::SOAP::Attachment#contentid soap/attachment.rb /^ def contentid/ +::SOAP::Attachment#contentid= soap/attachment.rb /^ def contentid=/ +::SOAP::Attachment#contenttype soap/attachment.rb /^ attr_accessor :contenttype/ +::SOAP::Attachment#initialize soap/attachment.rb /^ def initialize/ +::SOAP::Attachment#io soap/attachment.rb /^ attr_reader :io/ +::SOAP::Attachment#mime_contentid soap/attachment.rb /^ def mime_contentid/ +::SOAP::Attachment#save soap/attachment.rb /^ def save/ +::SOAP::Attachment#to_s soap/attachment.rb /^ def to_s/ +::SOAP::Attachment#write soap/attachment.rb /^ def write/ +::SOAP::Attachment.contentid soap/attachment.rb /^ def self.contentid/ +::SOAP::Attachment.mime_contentid soap/attachment.rb /^ def self.mime_contentid/ +::SOAP::CGIStub soap/compat.rb /^class CGIStub/ +::SOAP::CGIStub#addMethod soap/compat.rb /^ def addMethod/ +::SOAP::CGIStub#addMethodAs soap/compat.rb /^ def addMethodAs/ +::SOAP::CGIStub#addMethodWithNS soap/compat.rb /^ def addMethodWithNS/ +::SOAP::CGIStub#addMethodWithNSAs soap/compat.rb /^ def addMethodWithNSAs/ +::SOAP::CGIStub#addServant soap/compat.rb /^ alias addServant/ +::SOAP::CGIStub#initialize soap/compat.rb /^ def initialize/ +::SOAP::Driver soap/compat.rb /^class Driver/ +::SOAP::Driver#addMethod soap/compat.rb /^ def addMethod/ +::SOAP::Driver#addMethodAs soap/compat.rb /^ def addMethodAs/ +::SOAP::Driver#addMethodWithSOAPAction soap/compat.rb /^ def addMethodWithSOAPAction/ +::SOAP::Driver#addMethodWithSOAPActionAs soap/compat.rb /^ def addMethodWithSOAPActionAs/ +::SOAP::Driver#call soap/compat.rb /^ def call/ +::SOAP::Driver#initialize soap/compat.rb /^ def initialize/ +::SOAP::Driver#invoke soap/compat.rb /^ def invoke/ +::SOAP::Driver#log soap/compat.rb /^ def log/ +::SOAP::Driver#logDev soap/compat.rb /^ alias logDev/ +::SOAP::Driver#logDev= soap/compat.rb /^ alias logDev=/ +::SOAP::Driver#logdev soap/compat.rb /^ attr_accessor :logdev/ +::SOAP::Driver#mappingRegistry soap/compat.rb /^ alias mappingRegistry/ +::SOAP::Driver#mappingRegistry= soap/compat.rb /^ alias mappingRegistry=/ +::SOAP::Driver#setDefaultEncodingStyle soap/compat.rb /^ alias setDefaultEncodingStyle/ +::SOAP::Driver#setLogDev soap/compat.rb /^ def setLogDev/ +::SOAP::Driver#setWireDumpDev soap/compat.rb /^ alias setWireDumpDev/ +::SOAP::EmptyResponseError soap/soap.rb /^class EmptyResponseError/ +::SOAP::EncodingStyle soap/encodingstyle/aspDotNetHandler.rb /^module EncodingStyle/ +::SOAP::EncodingStyle soap/encodingstyle/handler.rb /^module EncodingStyle/ +::SOAP::EncodingStyle soap/encodingstyle/literalHandler.rb /^module EncodingStyle/ +::SOAP::EncodingStyle soap/encodingstyle/soapHandler.rb /^module EncodingStyle/ +::SOAP::EncodingStyle::ASPDotNetHandler soap/encodingstyle/aspDotNetHandler.rb /^class ASPDotNetHandler/ +::SOAP::EncodingStyle::ASPDotNetHandler#decode_epilogue soap/encodingstyle/aspDotNetHandler.rb /^ def decode_epilogue/ +::SOAP::EncodingStyle::ASPDotNetHandler#decode_parent soap/encodingstyle/aspDotNetHandler.rb /^ def decode_parent/ +::SOAP::EncodingStyle::ASPDotNetHandler#decode_prologue soap/encodingstyle/aspDotNetHandler.rb /^ def decode_prologue/ +::SOAP::EncodingStyle::ASPDotNetHandler#decode_tag soap/encodingstyle/aspDotNetHandler.rb /^ def decode_tag/ +::SOAP::EncodingStyle::ASPDotNetHandler#decode_tag_end soap/encodingstyle/aspDotNetHandler.rb /^ def decode_tag_end/ +::SOAP::EncodingStyle::ASPDotNetHandler#decode_text soap/encodingstyle/aspDotNetHandler.rb /^ def decode_text/ +::SOAP::EncodingStyle::ASPDotNetHandler#decode_textbuf soap/encodingstyle/aspDotNetHandler.rb /^ def decode_textbuf/ +::SOAP::EncodingStyle::ASPDotNetHandler#encode_data soap/encodingstyle/aspDotNetHandler.rb /^ def encode_data/ +::SOAP::EncodingStyle::ASPDotNetHandler#encode_data_end soap/encodingstyle/aspDotNetHandler.rb /^ def encode_data_end/ +::SOAP::EncodingStyle::ASPDotNetHandler#initialize soap/encodingstyle/aspDotNetHandler.rb /^ def initialize/ +::SOAP::EncodingStyle::ASPDotNetHandler::SOAPTemporalObject soap/encodingstyle/aspDotNetHandler.rb /^ class SOAPTemporalObject/ +::SOAP::EncodingStyle::ASPDotNetHandler::SOAPTemporalObject#initialize soap/encodingstyle/aspDotNetHandler.rb /^ def initialize/ +::SOAP::EncodingStyle::ASPDotNetHandler::SOAPTemporalObject#parent soap/encodingstyle/aspDotNetHandler.rb /^ attr_accessor :parent/ +::SOAP::EncodingStyle::ASPDotNetHandler::SOAPUnknown soap/encodingstyle/aspDotNetHandler.rb /^ class SOAPUnknown/ +::SOAP::EncodingStyle::ASPDotNetHandler::SOAPUnknown#as_string soap/encodingstyle/aspDotNetHandler.rb /^ def as_string/ +::SOAP::EncodingStyle::ASPDotNetHandler::SOAPUnknown#as_struct soap/encodingstyle/aspDotNetHandler.rb /^ def as_struct/ +::SOAP::EncodingStyle::ASPDotNetHandler::SOAPUnknown#initialize soap/encodingstyle/aspDotNetHandler.rb /^ def initialize/ +::SOAP::EncodingStyle::Handler soap/encodingstyle/handler.rb /^class Handler/ +::SOAP::EncodingStyle::Handler#charset soap/encodingstyle/handler.rb /^ attr_reader :charset/ +::SOAP::EncodingStyle::Handler#decode_epilogue soap/encodingstyle/handler.rb /^ def decode_epilogue/ +::SOAP::EncodingStyle::Handler#decode_prologue soap/encodingstyle/handler.rb /^ def decode_prologue/ +::SOAP::EncodingStyle::Handler#decode_tag soap/encodingstyle/handler.rb /^ def decode_tag/ +::SOAP::EncodingStyle::Handler#decode_tag_end soap/encodingstyle/handler.rb /^ def decode_tag_end/ +::SOAP::EncodingStyle::Handler#decode_text soap/encodingstyle/handler.rb /^ def decode_text/ +::SOAP::EncodingStyle::Handler#decode_typemap= soap/encodingstyle/handler.rb /^ def decode_typemap=/ +::SOAP::EncodingStyle::Handler#encode_attr_key soap/encodingstyle/handler.rb /^ def encode_attr_key/ +::SOAP::EncodingStyle::Handler#encode_data soap/encodingstyle/handler.rb /^ def encode_data/ +::SOAP::EncodingStyle::Handler#encode_data_end soap/encodingstyle/handler.rb /^ def encode_data_end/ +::SOAP::EncodingStyle::Handler#encode_epilogue soap/encodingstyle/handler.rb /^ def encode_epilogue/ +::SOAP::EncodingStyle::Handler#encode_prologue soap/encodingstyle/handler.rb /^ def encode_prologue/ +::SOAP::EncodingStyle::Handler#encode_qname soap/encodingstyle/handler.rb /^ def encode_qname/ +::SOAP::EncodingStyle::Handler#generate_explicit_type soap/encodingstyle/handler.rb /^ attr_accessor :generate_explicit_type/ +::SOAP::EncodingStyle::Handler#initialize soap/encodingstyle/handler.rb /^ def initialize/ +::SOAP::EncodingStyle::Handler.add_handler soap/encodingstyle/handler.rb /^ def add_handler/ +::SOAP::EncodingStyle::Handler.each soap/encodingstyle/handler.rb /^ def each/ +::SOAP::EncodingStyle::Handler.handler soap/encodingstyle/handler.rb /^ def handler/ +::SOAP::EncodingStyle::Handler.uri soap/encodingstyle/handler.rb /^ def uri/ +::SOAP::EncodingStyle::Handler::EncodingStyleError soap/encodingstyle/handler.rb /^ class EncodingStyleError/ +::SOAP::EncodingStyle::LiteralHandler soap/encodingstyle/literalHandler.rb /^class LiteralHandler/ +::SOAP::EncodingStyle::LiteralHandler#decode_epilogue soap/encodingstyle/literalHandler.rb /^ def decode_epilogue/ +::SOAP::EncodingStyle::LiteralHandler#decode_parent soap/encodingstyle/literalHandler.rb /^ def decode_parent/ +::SOAP::EncodingStyle::LiteralHandler#decode_prologue soap/encodingstyle/literalHandler.rb /^ def decode_prologue/ +::SOAP::EncodingStyle::LiteralHandler#decode_str soap/encodingstyle/literalHandler.rb /^ def decode_str/ +::SOAP::EncodingStyle::LiteralHandler#decode_tag soap/encodingstyle/literalHandler.rb /^ def decode_tag/ +::SOAP::EncodingStyle::LiteralHandler#decode_tag_end soap/encodingstyle/literalHandler.rb /^ def decode_tag_end/ +::SOAP::EncodingStyle::LiteralHandler#decode_text soap/encodingstyle/literalHandler.rb /^ def decode_text/ +::SOAP::EncodingStyle::LiteralHandler#decode_textbuf soap/encodingstyle/literalHandler.rb /^ def decode_textbuf/ +::SOAP::EncodingStyle::LiteralHandler#encode_data soap/encodingstyle/literalHandler.rb /^ def encode_data/ +::SOAP::EncodingStyle::LiteralHandler#encode_data_end soap/encodingstyle/literalHandler.rb /^ def encode_data_end/ +::SOAP::EncodingStyle::LiteralHandler#initialize soap/encodingstyle/literalHandler.rb /^ def initialize/ +::SOAP::EncodingStyle::SOAPHandler soap/encodingstyle/soapHandler.rb /^class SOAPHandler/ +::SOAP::EncodingStyle::SOAPHandler#content_ranksize soap/encodingstyle/soapHandler.rb /^ def content_ranksize/ +::SOAP::EncodingStyle::SOAPHandler#content_typename soap/encodingstyle/soapHandler.rb /^ def content_typename/ +::SOAP::EncodingStyle::SOAPHandler#create_arytype soap/encodingstyle/soapHandler.rb /^ def create_arytype/ +::SOAP::EncodingStyle::SOAPHandler#decode_arypos soap/encodingstyle/soapHandler.rb /^ def decode_arypos/ +::SOAP::EncodingStyle::SOAPHandler#decode_basetype soap/encodingstyle/soapHandler.rb /^ def decode_basetype/ +::SOAP::EncodingStyle::SOAPHandler#decode_defined_complextype soap/encodingstyle/soapHandler.rb /^ def decode_defined_complextype/ +::SOAP::EncodingStyle::SOAPHandler#decode_defined_simpletype soap/encodingstyle/soapHandler.rb /^ def decode_defined_simpletype/ +::SOAP::EncodingStyle::SOAPHandler#decode_definedtype soap/encodingstyle/soapHandler.rb /^ def decode_definedtype/ +::SOAP::EncodingStyle::SOAPHandler#decode_epilogue soap/encodingstyle/soapHandler.rb /^ def decode_epilogue/ +::SOAP::EncodingStyle::SOAPHandler#decode_parent soap/encodingstyle/soapHandler.rb /^ def decode_parent/ +::SOAP::EncodingStyle::SOAPHandler#decode_prologue soap/encodingstyle/soapHandler.rb /^ def decode_prologue/ +::SOAP::EncodingStyle::SOAPHandler#decode_ref_value soap/encodingstyle/soapHandler.rb /^ def decode_ref_value/ +::SOAP::EncodingStyle::SOAPHandler#decode_resolve_id soap/encodingstyle/soapHandler.rb /^ def decode_resolve_id/ +::SOAP::EncodingStyle::SOAPHandler#decode_tag soap/encodingstyle/soapHandler.rb /^ def decode_tag/ +::SOAP::EncodingStyle::SOAPHandler#decode_tag_by_type soap/encodingstyle/soapHandler.rb /^ def decode_tag_by_type/ +::SOAP::EncodingStyle::SOAPHandler#decode_tag_by_wsdl soap/encodingstyle/soapHandler.rb /^ def decode_tag_by_wsdl/ +::SOAP::EncodingStyle::SOAPHandler#decode_tag_end soap/encodingstyle/soapHandler.rb /^ def decode_tag_end/ +::SOAP::EncodingStyle::SOAPHandler#decode_text soap/encodingstyle/soapHandler.rb /^ def decode_text/ +::SOAP::EncodingStyle::SOAPHandler#decode_textbuf soap/encodingstyle/soapHandler.rb /^ def decode_textbuf/ +::SOAP::EncodingStyle::SOAPHandler#encode_attr_value soap/encodingstyle/soapHandler.rb /^ def encode_attr_value/ +::SOAP::EncodingStyle::SOAPHandler#encode_attrs soap/encodingstyle/soapHandler.rb /^ def encode_attrs/ +::SOAP::EncodingStyle::SOAPHandler#encode_data soap/encodingstyle/soapHandler.rb /^ def encode_data/ +::SOAP::EncodingStyle::SOAPHandler#encode_data_end soap/encodingstyle/soapHandler.rb /^ def encode_data_end/ +::SOAP::EncodingStyle::SOAPHandler#extract_attrs soap/encodingstyle/soapHandler.rb /^ def extract_attrs/ +::SOAP::EncodingStyle::SOAPHandler#initialize soap/encodingstyle/soapHandler.rb /^ def initialize/ +::SOAP::EncodingStyle::SOAPHandler::SOAPTemporalObject soap/encodingstyle/soapHandler.rb /^ class SOAPTemporalObject/ +::SOAP::EncodingStyle::SOAPHandler::SOAPTemporalObject#id soap/encodingstyle/soapHandler.rb /^ attr_accessor :id/ +::SOAP::EncodingStyle::SOAPHandler::SOAPTemporalObject#initialize soap/encodingstyle/soapHandler.rb /^ def initialize/ +::SOAP::EncodingStyle::SOAPHandler::SOAPTemporalObject#parent soap/encodingstyle/soapHandler.rb /^ attr_accessor :parent/ +::SOAP::EncodingStyle::SOAPHandler::SOAPTemporalObject#position soap/encodingstyle/soapHandler.rb /^ attr_accessor :position/ +::SOAP::EncodingStyle::SOAPHandler::SOAPTemporalObject#root soap/encodingstyle/soapHandler.rb /^ attr_accessor :root/ +::SOAP::EncodingStyle::SOAPHandler::SOAPUnknown soap/encodingstyle/soapHandler.rb /^ class SOAPUnknown/ +::SOAP::EncodingStyle::SOAPHandler::SOAPUnknown#as_nil soap/encodingstyle/soapHandler.rb /^ def as_nil/ +::SOAP::EncodingStyle::SOAPHandler::SOAPUnknown#as_string soap/encodingstyle/soapHandler.rb /^ def as_string/ +::SOAP::EncodingStyle::SOAPHandler::SOAPUnknown#as_struct soap/encodingstyle/soapHandler.rb /^ def as_struct/ +::SOAP::EncodingStyle::SOAPHandler::SOAPUnknown#definedtype soap/encodingstyle/soapHandler.rb /^ attr_accessor :definedtype/ +::SOAP::EncodingStyle::SOAPHandler::SOAPUnknown#extraattr soap/encodingstyle/soapHandler.rb /^ attr_reader :extraattr/ +::SOAP::EncodingStyle::SOAPHandler::SOAPUnknown#initialize soap/encodingstyle/soapHandler.rb /^ def initialize/ +::SOAP::EncodingStyle::SOAPHandler::SOAPUnknown#type soap/encodingstyle/soapHandler.rb /^ attr_reader :type/ +::SOAP::Env soap/soap.rb /^module Env/ +::SOAP::Env.getenv soap/soap.rb /^ def self.getenv/ +::SOAP::Error soap/soap.rb /^class Error/ +::SOAP::FaultCode soap/soap.rb /^module FaultCode/ +::SOAP::FaultError soap/soap.rb /^class FaultError/ +::SOAP::FaultError#detail soap/soap.rb /^ attr_accessor :detail/ +::SOAP::FaultError#faultactor soap/soap.rb /^ attr_reader :faultactor/ +::SOAP::FaultError#faultcode soap/soap.rb /^ attr_reader :faultcode/ +::SOAP::FaultError#faultstring soap/soap.rb /^ attr_reader :faultstring/ +::SOAP::FaultError#initialize soap/soap.rb /^ def initialize/ +::SOAP::FaultError#to_s soap/soap.rb /^ def to_s/ +::SOAP::Filter soap/filter/filterchain.rb /^module Filter/ +::SOAP::Filter soap/filter/handler.rb /^module Filter/ +::SOAP::Filter soap/filter/streamhandler.rb /^module Filter/ +::SOAP::Filter::FilterChain soap/filter/filterchain.rb /^class FilterChain/ +::SOAP::Filter::FilterChain#<< soap/filter/filterchain.rb /^ alias <. + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/data.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/data.rb new file mode 100644 index 00000000..f645acbc --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/data.rb @@ -0,0 +1,64 @@ +# WSDL4R - WSDL data definitions. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/definitions.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/definitions.rb new file mode 100644 index 00000000..2e76e0d0 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/definitions.rb @@ -0,0 +1,236 @@ +# WSDL4R - WSDL definitions. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + collect_imports(:collect_attributes) + end + + def collect_modelgroups + collect_imports(:collect_modelgroups) + end + + def collect_attributegroups + collect_imports(:collect_attributegroups) + end + + def collect_elements + collect_imports(:collect_elements) + end + + def collect_complextypes + result = collect_imports(:collect_complextypes) + @anontypes.dup.concat(result) + end + + def collect_simpletypes + collect_imports(:collect_simpletypes) + 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 + + def collect_imports(method) + result = XSD::NamedElements.new + if @types + @types.schemas.each do |schema| + result.concat(schema.send(method)) + end + end + @imports.each do |import| + result.concat(import.content.send(method)) + end + result + end + +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/documentation.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/documentation.rb new file mode 100644 index 00000000..0cbf8f80 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/documentation.rb @@ -0,0 +1,32 @@ +# WSDL4R - WSDL SOAP documentation element. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/import.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/import.rb new file mode 100644 index 00000000..c1f262cc --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/import.rb @@ -0,0 +1,80 @@ +# WSDL4R - WSDL import definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/importer.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/importer.rb new file mode 100644 index 00000000..0fe72989 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/importer.rb @@ -0,0 +1,38 @@ +# WSDL4R - WSDL importer library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/info.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/info.rb new file mode 100644 index 00000000..173fe245 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/info.rb @@ -0,0 +1,50 @@ +# WSDL4R - WSDL information base. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + +private + + def to_int(value) + Integer(value.source) + end + + def to_boolean(value) + s = value.source + s == "true" or s == "1" + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/message.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/message.rb new file mode 100644 index 00000000..d5aa1a5d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/message.rb @@ -0,0 +1,54 @@ +# WSDL4R - WSDL message definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/operation.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/operation.rb new file mode 100644 index 00000000..096fca43 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/operation.rb @@ -0,0 +1,178 @@ +# WSDL4R - WSDL operation definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 operationname + as_operationname(@name) + end + + def input_info + if message = input_message + typename = message.name + else + typename = nil + end + NameInfo.new(operationname, typename, inputparts) + end + + def output_info + if message = output_message + typename = message.name + else + typename = nil + end + NameInfo.new(operationname, typename, outputparts) + end + + EMPTY = [].freeze + def inputparts + if message = input_message + sort_parts(message.parts) + else + EMPTY + end + end + + def inputname + if input + as_operationname(input.name ? input.name.name : @name) + else + nil + end + end + + def outputparts + if message = output_message + sort_parts(message.parts) + else + EMPTY + end + end + + def outputname + if output + as_operationname(output.name ? output.name.name : @name + 'Response') + 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 DocumentationName + o = Documentation.new + o + else + nil + end + end + + def parse_attr(attr, value) + case attr + when NameAttrName + @name = value.source + when TypeAttrName + @type = value + when ParameterOrderAttrName + @parameter_order = value.source.split(/\s+/) + else + nil + end + end + +private + + def input_message + if input and message = input.find_message + message + else + nil + end + end + + def output_message + if output and message = output.find_message + message + else + nil + end + end + + 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 + + def as_operationname(name) + XSD::QName.new(targetnamespace, name) + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/operationBinding.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/operationBinding.rb new file mode 100644 index 00000000..e10446b9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/operationBinding.rb @@ -0,0 +1,130 @@ +# WSDL4R - WSDL bound operation definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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.each do |op| + next if op.name != @name + next if op.input and @input and op.input.name and @input.name and + op.input.name != @input.name + next if op.output and @output and op.output.name and @output.name and + op.output.name != @output.name + return op + end + raise RuntimeError.new("#{@name} not found") + end + + def soapoperation_name + op_name = find_operation.operationname + if @input and @input.soapbody and @input.soapbody.namespace + op_name = XSD::QName.new(@input.soapbody.namespace, op_name.name) + end + op_name + 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 soapbody_use_input + soapbody_use(@input) + end + + def soapbody_use_output + soapbody_use(@output) + 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 = value.source + else + nil + end + end + +private + + def soapbody_use(param) + param ? param.soapbody_use : nil + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/param.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/param.rb new file mode 100644 index 00000000..f36e1d1b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/param.rb @@ -0,0 +1,93 @@ +# WSDL4R - WSDL param definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + nil + end + end + + def soapbody_encodingstyle + if @soapbody + @soapbody.encodingstyle + else + nil + 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 + @soapfault = 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/vendor/gems/soap4r-1.5.8/lib/wsdl/parser.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/parser.rb new file mode 100644 index 00000000..e84245f9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/parser.rb @@ -0,0 +1,164 @@ +# WSDL4R - WSDL XML Instance parser library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 'xsd/datatypes' +require 'xsd/xmlparser' +require 'soap/ns' +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 + parent = lastframe.node + else + ns = ::SOAP::NS.new + parent = nil + end + # ns might be the same + ns, 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 + if o.nil? + 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, false) + value_ele.source = value # for recovery; value may not be a QName + if o.parse_attr(attr_ele, value_ele).nil? + 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/vendor/gems/soap4r-1.5.8/lib/wsdl/part.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/part.rb new file mode 100644 index 00000000..a52e6c38 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/part.rb @@ -0,0 +1,52 @@ +# WSDL4R - WSDL part definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/port.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/port.rb new file mode 100644 index 00000000..b1ba70e5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/port.rb @@ -0,0 +1,84 @@ +# WSDL4R - WSDL port definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/portType.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/portType.rb new file mode 100644 index 00000000..26269f21 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/portType.rb @@ -0,0 +1,75 @@ +# WSDL4R - WSDL portType definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + + # may be nil if not defined + def find_binding + root.bindings.find { |item| item.type == @name } + end + + def locations + binding = find_binding + return [] if binding.nil? + bind_name = 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/vendor/gems/soap4r-1.5.8/lib/wsdl/service.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/service.rb new file mode 100644 index 00000000..1efbd591 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/service.rb @@ -0,0 +1,61 @@ +# WSDL4R - WSDL service definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/address.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/address.rb new file mode 100644 index 00000000..fc03aa23 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/address.rb @@ -0,0 +1,40 @@ +# WSDL4R - WSDL SOAP address definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/binding.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/binding.rb new file mode 100644 index 00000000..3b840c41 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/binding.rb @@ -0,0 +1,49 @@ +# WSDL4R - WSDL SOAP binding definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/body.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/body.rb new file mode 100644 index 00000000..b2392d78 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/body.rb @@ -0,0 +1,58 @@ +# WSDL4R - WSDL SOAP body definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + @encodingstyle = nil if @encodingstyle.to_s.empty? + value.source + when NamespaceAttrName + @namespace = value.source + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/cgiStubCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/cgiStubCreator.rb new file mode 100644 index 00000000..f2974aae --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/cgiStubCreator.rb @@ -0,0 +1,93 @@ +# WSDL4R - Creating CGI stub code from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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, name_creator, modulepath = nil) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + end + + def dump(service_name) + warn("CGI stub can have only 1 port. Creating stub for the first port... Rests are ignored.") + services = @definitions.service(service_name) + unless services + raise RuntimeError.new("service not defined: #{service_name}") + end + ports = services.ports + if ports.empty? + raise RuntimeError.new("ports not found for #{service_name}") + end + port = ports[0] + if port.porttype.nil? + raise RuntimeError.new("porttype not found for #{port}") + end + dump_porttype(port.porttype) + end + +private + + def dump_porttype(porttype) + class_name = mapped_class_name(porttype.name, @modulepath) + defined_const = {} + result = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name) + methoddef = result[:methoddef] + wsdl_name = @definitions.name ? @definitions.name.name : 'default' + mrname = safeconstname(wsdl_name + 'MappingRegistry') + c1 = XSD::CodeGen::ClassDef.new(class_name) + c1.def_require("soap/rpc/cgistub") + c1.def_code <<-EOD +Methods = [ +#{methoddef.gsub(/^/, " ")} +] + EOD + defined_const.each do |ns, tag| + c1.def_const(tag, dq(ns)) + end + 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 = #{mrname}::EncodedRegistry + self.literal_mapping_registry = #{mrname}::LiteralRegistry + 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.rb new file mode 100644 index 00000000..743553bc --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreator.rb @@ -0,0 +1,433 @@ +# WSDL4R - Creating class definition from WSDL +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' +require 'set' + + +module WSDL +module SOAP + + +class ClassDefCreator + include ClassDefCreatorSupport + include XSD::CodeGen + + def initialize(definitions, name_creator, modulepath = nil) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + @elements = definitions.collect_elements + @elements.uniq! + @attributes = definitions.collect_attributes + @attributes.uniq! + @simpletypes = definitions.collect_simpletypes + @simpletypes.uniq! + @complextypes = definitions.collect_complextypes + @complextypes.uniq! + @modelgroups = definitions.collect_modelgroups + @modelgroups.uniq! + @faulttypes = nil + if definitions.respond_to?(:collect_faulttypes) + @faulttypes = definitions.collect_faulttypes + end + @defined_const = {} + end + + def dump(type = nil) + result = "require 'xsd/qname'\n" + # cannot use @modulepath because of multiple classes + if @modulepath + result << "\n" + result << modulepath_split(@modulepath).collect { |ele| "module #{ele}" }.join("; ") + result << "\n\n" + end + if type + result << dump_classdef(type.name, type) + else + str = dump_group + 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 + str = dump_element + unless str.empty? + result << "\n" unless result.empty? + result << str + end + str = dump_attribute + unless str.empty? + result << "\n" unless result.empty? + result << str + end + end + if @modulepath + result << "\n\n" + result << modulepath_split(@modulepath).collect { |ele| "end" }.join("; ") + result << "\n" + end + result + end + +private + + def dump_element + @elements.collect { |ele| + next if @complextypes[ele.name] + c = create_elementdef(@modulepath, ele) + c ? c.dump : nil + }.compact.join("\n") + end + + def dump_attribute + @attributes.collect { |attribute| + if attribute.local_simpletype + c = create_simpletypedef(@modulepath, attribute.name, attribute.local_simpletype) + end + c ? c.dump : nil + }.compact.join("\n") + end + + def dump_simpletype + @simpletypes.collect { |type| + c = create_simpletypedef(@modulepath, type.name, type) + c ? c.dump : nil + }.compact.join("\n") + end + + def dump_complextype + definitions = sort_dependency(@complextypes).collect { |type| + c = create_complextypedef(@modulepath, type.name, type) + c ? c.dump : nil + }.compact.join("\n") + end + + def dump_group + definitions = @modelgroups.collect { |group| + # TODO: not dumped for now but may be useful in the future + }.compact.join("\n") + end + + def create_elementdef(mpath, ele) + qualified = (ele.elementform == 'qualified') + if ele.local_complextype + create_complextypedef(mpath, ele.name, ele.local_complextype, qualified) + elsif ele.local_simpletype + create_simpletypedef(mpath, ele.name, ele.local_simpletype, qualified) + elsif ele.empty? + create_simpleclassdef(mpath, ele.name, nil) + else + # ignores type only element + nil + end + end + + def create_simpletypedef(mpath, qname, simpletype, qualified = false) + if simpletype.restriction + create_simpletypedef_restriction(mpath, qname, simpletype, qualified) + elsif simpletype.list + create_simpletypedef_list(mpath, qname, simpletype, qualified) + elsif simpletype.union + create_simpletypedef_union(mpath, qname, simpletype, qualified) + else + raise RuntimeError.new("unknown kind of simpletype: #{simpletype}") + end + end + + def create_simpletypedef_restriction(mpath, qname, typedef, qualified) + restriction = typedef.restriction + unless restriction.enumeration? + # not supported. minlength? + return nil + end + classname = mapped_class_basename(qname, mpath) + c = ClassDef.new(classname, '::String') + c.comment = "#{qname}" + define_classenum_restriction(c, classname, restriction.enumeration) + c + end + + def create_simpletypedef_list(mpath, qname, typedef, qualified) + list = typedef.list + classname = mapped_class_basename(qname, mpath) + c = ClassDef.new(classname, '::Array') + c.comment = "#{qname}" + if simpletype = list.local_simpletype + if simpletype.restriction.nil? + raise RuntimeError.new( + "unknown kind of simpletype: #{simpletype}") + end + define_stringenum_restriction(c, simpletype.restriction.enumeration) + c.comment << "\n contains list of #{classname}::*" + elsif list.itemtype + c.comment << "\n contains list of #{mapped_class_basename(list.itemtype, mpath)}::*" + else + raise RuntimeError.new("unknown kind of list: #{list}") + end + c + end + + def create_simpletypedef_union(mpath, qname, typedef, qualified) + union = typedef.union + classname = mapped_class_basename(qname, mpath) + c = ClassDef.new(classname, '::String') + c.comment = "#{qname}" + if union.member_types + # fixme + c.comment << "\n any of #{union.member_types}" + end + c + end + + def define_stringenum_restriction(c, enumeration) + const = {} + 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 + end + + def define_classenum_restriction(c, classname, enumeration) + const = {} + enumeration.each do |value| + constname = safeconstname(value) + const[constname] ||= 0 + if (const[constname] += 1) > 1 + constname += "_#{const[constname]}" + end + c.def_const(constname, "#{classname}.new(#{ndq(value)})") + end + end + + def create_simpleclassdef(mpath, qname, type_or_element) + classname = mapped_class_basename(qname, mpath) + c = ClassDef.new(classname, '::String') + c.comment = "#{qname}" + init_lines = [] + if type_or_element and !type_or_element.attributes.empty? + define_attribute(c, type_or_element.attributes) + init_lines << "@__xmlattr = {}" + end + c.def_method('initialize', '*arg') do + "super\n" + init_lines.join("\n") + end + c + end + + def create_complextypedef(mpath, qname, type, qualified = false) + case type.compoundtype + when :TYPE_STRUCT, :TYPE_EMPTY + create_structdef(mpath, qname, type, qualified) + when :TYPE_ARRAY + create_arraydef(mpath, qname, type) + when :TYPE_SIMPLE + create_simpleclassdef(mpath, qname, type) + when :TYPE_MAP + # mapped as a general Hash + nil + else + raise RuntimeError.new( + "unknown kind of complexContent: #{type.compoundtype}") + end + end + + def create_structdef(mpath, qname, typedef, qualified = false) + classname = mapped_class_basename(qname, mpath) + baseclassname = nil + if typedef.complexcontent + if base = typedef.complexcontent.base + # :TYPE_ARRAY must not be derived (#424) + basedef = @complextypes[base] + if basedef and basedef.compoundtype != :TYPE_ARRAY + # baseclass should be a toplevel complexType + baseclassname = mapped_class_basename(base, @modulepath) + end + end + end + if @faulttypes and @faulttypes.index(qname) + c = ClassDef.new(classname, '::StandardError') + else + c = ClassDef.new(classname, baseclassname) + end + c.comment = "#{qname}" + c.comment << "\nabstract" if typedef.abstract + parentmodule = mapped_class_name(qname, mpath) + init_lines, init_params = + parse_elements(c, typedef.elements, qname.namespace, parentmodule) + unless typedef.attributes.empty? + define_attribute(c, typedef.attributes) + init_lines << "@__xmlattr = {}" + end + c.def_method('initialize', *init_params) do + init_lines.join("\n") + end + c + end + + def parse_elements(c, elements, base_namespace, mpath, as_array = false) + init_lines = [] + init_params = [] + any = false + elements.each do |element| + case element + when XMLSchema::Any + # only 1 is allowed for now. + raise RuntimeError.new("duplicated 'any'") if any + any = true + attrname = '__xmlele_any' + c.def_attr(attrname, false, attrname) + c.def_method('set_any', 'elements') do + '@__xmlele_any = elements' + end + init_lines << "@__xmlele_any = nil" + when XMLSchema::Element + next if element.ref == SchemaName + name = name_element(element).name + typebase = @modulepath + if element.anonymous_type? + inner = create_elementdef(mpath, element) + unless as_array + inner.comment = "inner class for member: #{name}\n" + inner.comment + end + c.innermodule << inner + typebase = mpath + end + unless as_array + attrname = safemethodname(name) + varname = safevarname(name) + c.def_attr(attrname, true, varname) + init_lines << "@#{varname} = #{varname}" + if element.map_as_array? + init_params << "#{varname} = []" + else + init_params << "#{varname} = nil" + end + c.comment << "\n #{attrname} - #{create_type_name(typebase, element) || '(any)'}" + end + when WSDL::XMLSchema::Sequence + child_init_lines, child_init_params = + parse_elements(c, element.elements, base_namespace, mpath, as_array) + init_lines.concat(child_init_lines) + init_params.concat(child_init_params) + when WSDL::XMLSchema::Choice + child_init_lines, child_init_params = + parse_elements(c, element.elements, base_namespace, mpath, as_array) + init_lines.concat(child_init_lines) + init_params.concat(child_init_params) + when WSDL::XMLSchema::Group + if element.content.nil? + warn("no group definition found: #{element}") + next + end + child_init_lines, child_init_params = + parse_elements(c, element.content.elements, base_namespace, mpath, as_array) + init_lines.concat(child_init_lines) + init_params.concat(child_init_params) + else + raise RuntimeError.new("unknown type: #{element}") + end + end + [init_lines, init_params] + end + + def define_attribute(c, attributes) + const = {} + unless attributes.empty? + c.def_method("__xmlattr") do <<-__EOD__ + @__xmlattr ||= {} + __EOD__ + end + end + attributes.each do |attribute| + name = name_attribute(attribute) + methodname = safemethodname('xmlattr_' + name.name) + constname = 'Attr' + safeconstname(name.name) + const[constname] ||= 0 + if (const[constname] += 1) > 1 + constname += "_#{const[constname]}" + end + c.def_const(constname, dqname(name)) + c.def_method(methodname) do <<-__EOD__ + __xmlattr[#{constname}] + __EOD__ + end + c.def_method(methodname + '=', 'value') do <<-__EOD__ + __xmlattr[#{constname}] = value + __EOD__ + end + c.comment << "\n #{methodname} - #{attribute_basetype(attribute) || '(any)'}" + end + end + + def create_arraydef(mpath, qname, typedef) + classname = mapped_class_basename(qname, mpath) + c = ClassDef.new(classname, '::Array') + c.comment = "#{qname}" + parentmodule = mapped_class_name(qname, mpath) + parse_elements(c, typedef.elements, qname.namespace, parentmodule, true) + c + end + + def sort_dependency(types) + dep = {} + root = [] + types.each do |type| + if type.complexcontent and (base = type.complexcontent.base) + dep[base] ||= [] + dep[base] << type + else + root << type + end + end + sorted = [] + root.each do |type| + sorted.concat(collect_dependency(type, dep)) + end + sorted.concat(dep.values.flatten) + sorted + end + + # removes collected key from dep + def collect_dependency(type, dep) + result = [type] + return result unless dep.key?(type.name) + dep[type.name].each do |deptype| + result.concat(collect_dependency(deptype, dep)) + end + dep.delete(type.name) + result + end + + def modulepath_split(modulepath) + if modulepath.is_a?(::Array) + modulepath + else + modulepath.to_s.split('::') + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreatorSupport.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreatorSupport.rb new file mode 100644 index 00000000..f853c131 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classDefCreatorSupport.rb @@ -0,0 +1,230 @@ +# WSDL4R - Creating class code support from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + + +# requires @defined_const, @simpletypes, @name_creator +module ClassDefCreatorSupport + include XSD::CodeGen::GenSupport + + def mapped_class_name(qname, modulepath) + @name_creator.assign_name(qname, modulepath) + end + + def mapped_class_basename(qname, modulepath) + classname = @name_creator.assign_name(qname, modulepath) + classname.sub(/\A.*:/, '') + end + + def basetype_mapped_class(name) + ::SOAP::TypeMap[name] + end + + def dump_method_signature(operation, element_definitions) + name = operation.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, element_definitions).chomp} +# +# RETURNS +#{dump_inout_type(output, element_definitions).chomp} +# +__EOD__ + unless fault.empty? + str <<<<__EOD__ +# RAISES +#{dump_fault_type(fault, element_definitions)} +# +__EOD__ + end + str + end + + def dq(ele) + ele.dump + end + + def ndq(ele) + ele.nil? ? 'nil' : dq(ele) + end + + def sym(ele) + ':' + ele.id2name + end + + def nsym(ele) + ele.nil? ? 'nil' : sym(ele) + end + + def dqname(qname) + if @defined_const.key?(qname.namespace) + qname.dump(@defined_const[qname.namespace]) + else + qname.dump + end + end + + def assign_const(value, prefix = '') + return if value.nil? or @defined_const.key?(value) + name = value.scan(/[^:\/]+\/?\z/)[0] || 'C' + tag = prefix + safeconstname(name) + if @defined_const.value?(tag) + idx = 0 + while true + tag = prefix + safeconstname(name + "_#{idx}") + break unless @defined_const.value?(tag) + idx += 1 + raise RuntimeError.new("too much similar names") if idx > 100 + end + end + @defined_const[value] = tag + end + + def create_type_name(modulepath, element) + if element.type == XSD::AnyTypeName + # nil means anyType. + nil + elsif simpletype = @simpletypes[element.type] + if simpletype.restriction and simpletype.restriction.enumeration? + mapped_class_name(element.type, modulepath) + else + nil + end + elsif klass = element_basetype(element) + klass.name + elsif element.type + mapped_class_name(element.type, modulepath) + elsif element.ref + mapped_class_name(element.ref, modulepath) + elsif element.anonymous_type? + # inner class + mapped_class_name(element.name, modulepath) + else + nil + end + end + +private + + def dump_inout_type(param, element_definitions) + if param + message = param.find_message + params = "" + message.parts.each do |part| + name = safevarname(part.name) + if part.type + typename = safeconstname(part.type.name) + qname = part.type + params << add_at("# #{name}", "#{typename} - #{qname}\n", 20) + elsif part.element + ele = element_definitions[part.element] + if ele.type + typename = safeconstname(ele.type.name) + qname = ele.type + else + typename = safeconstname(ele.name.name) + qname = ele.name + end + params << add_at("# #{name}", "#{typename} - #{qname}\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 + + def dump_fault_type(fault, element_definitions) + fault.collect { |ele| + dump_inout_type(ele, element_definitions).chomp + }.join("\n") + 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 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 +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classNameCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classNameCreator.rb new file mode 100644 index 00000000..10c7e38b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/classNameCreator.rb @@ -0,0 +1,54 @@ +# WSDL4R - Class name creator. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/typeMap' +require 'xsd/codegen/gensupport' + + +module WSDL +module SOAP + + +class ClassNameCreator + include XSD::CodeGen::GenSupport + + def initialize + @classname = {} + end + + def assign_name(qname, modulepath = nil) + key = [modulepath, qname] + unless @classname.key?(key) + if klass = ::SOAP::TypeMap[qname] + name = + ::SOAP::Mapping::DefaultRegistry.find_mapped_obj_class(klass).name + else + name = safeconstname(qname.name) + if modulepath + name = [modulepath, name].join('::') + end + while @classname.value?(name) + name += '_' + end + check_classname(name) + end + @classname[key] = name.freeze + end + @classname[key] + end + + def check_classname(name) + if Object.constants.include?(name) + warn("created definition re-opens an existing toplevel class: #{name}. consider to use --module_path option of wsdl2ruby.rb") + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/clientSkeltonCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/clientSkeltonCreator.rb new file mode 100644 index 00000000..92452574 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/clientSkeltonCreator.rb @@ -0,0 +1,95 @@ +# WSDL4R - Creating client skelton code from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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, name_creator, modulepath = nil) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + end + + def dump(service_name) + services = @definitions.service(service_name) + unless services + raise RuntimeError.new("service not defined: #{service_name}") + end + result = "" + if @modulepath + result << "\n" + result << @modulepath.collect { |ele| "module #{ele}" }.join("; ") + result << "\n\n" + end + services.ports.each do |port| + result << dump_porttype(port.porttype) + result << "\n" + end + if @modulepath + result << "\n\n" + result << @modulepath.collect { |ele| "end" }.join("; ") + result << "\n" + end + result + end + +private + + def dump_porttype(porttype) + drv_name = mapped_class_basename(porttype.name, @modulepath) + + 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__ + element_definitions = @definitions.collect_elements + porttype.operations.each do |operation| + result << dump_method_signature(operation, element_definitions) + 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) }#{ 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/complexType.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/complexType.rb new file mode 100644 index 00000000..c758cf41 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/complexType.rb @@ -0,0 +1,172 @@ +# WSDL4R - SOAP complexType definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 have_any? + :TYPE_STRUCT + elsif content + if attributes.empty? and map_as_array? + if name == ::SOAP::Mapping::MapQName + :TYPE_MAP + else + :TYPE_ARRAY + end + else + :TYPE_STRUCT + end + elsif complexcontent + complexcontent.check_type + 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 + e = elements + if e.size == 1 + ele = e[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_soapenc_arytype + unless compoundtype == :TYPE_ARRAY + raise RuntimeError.new("Assert: not for array") + end + if complexcontent + if complexcontent.restriction + complexcontent.restriction.attributes.each do |attribute| + if attribute.ref == ::SOAP::AttrArrayTypeName + return attribute.arytype + end + end + end + end + end + + def find_arytype + unless compoundtype == :TYPE_ARRAY + raise RuntimeError.new("Assert: not for array") + end + if arytype = find_soapenc_arytype + return arytype + end + if map_as_array? + return element_simpletype(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 map_as_array? + return nested_elements[0] + end + nil # use default item name + end + +private + + def element_simpletype(element) + case element + when XMLSchema::Element + if element.type + element.type + elsif element.local_simpletype + element.local_simpletype.base + else + # element definition + nil + end + when XMLSchema::Any + XSD::AnyTypeName + else + nil + end + end + + def map_as_array? + e = nested_elements + e.size == 1 and e[0].map_as_array? + 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/data.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/data.rb new file mode 100644 index 00000000..56bbadf8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/data.rb @@ -0,0 +1,42 @@ +# WSDL4R - WSDL SOAP binding data definitions. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/definitions.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/definitions.rb new file mode 100644 index 00000000..e9046afe --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/definitions.rb @@ -0,0 +1,200 @@ +# WSDL4R - WSDL additional definitions for SOAP. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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.restriction = XMLSchema::ComplexRestriction.new + type.complexcontent.restriction.base = ::SOAP::ValueArrayName + attr = XMLSchema::Attribute.new + attr.ref = ::SOAP::AttrArrayTypeName + anyarray = XSD::QName.new( + XSD::AnyTypeName.namespace, + XSD::AnyTypeName.name + '[]') + attr.arytype = anyarray + type.complexcontent.restriction.attributes << attr + type + end + +=begin + + + + + + + + +=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 \"#{name}\" to have ONE part") + end + fault_part = faultparts[0] + # WS-I Basic Profile Version 1.1 (R2205) requires fault message parts + # to refer to elements rather than types + faulttype = fault_part.element + if not faulttype + warn("Fault message \"#{name}\" part \"#{fault_part.name}\" must specify an \"element\" attribute") + faulttype = fault_part.type + end + if faulttype and result.index(faulttype).nil? + result << faulttype + end + end + result + end + +private + + def get_fault_binding(op_binding, fault_name) + op_binding.fault.each do |fault| + return fault if fault.name == fault_name + end + return nil + end + + def op_binding_declares_fault(op_binding, fault_name) + return get_fault_binding(op_binding, fault_name) != nil + end + + def collect_fault_messages + result = [] + porttypes.each do |porttype| + port_binding = porttype.find_binding() + next unless port_binding + porttype.operations.each do |operation| + op_binding = port_binding.operations.find { |ele| ele.name == operation.name } + next unless op_binding + operation.fault.each do |fault| + # Make sure the operation fault has a name + if not fault.name + warn("Operation \"#{operation.name}\": fault must specify a \"name\" attribute") + next + end + # Make sure that portType fault has a corresponding soap:fault + # definition in binding section. + if not op_binding_declares_fault(op_binding, fault.name) + warn("Operation \"#{operation.name}\", fault \"#{fault.name}\": no corresponding wsdl:fault binding found with a matching \"name\" attribute") + next + end + fault_binding = get_fault_binding(op_binding, fault.name) + if fault_binding.soapfault.nil? + warn("WARNING: no soap:fault found for wsdl:fault \"#{fault_binding.name}\" in operation \"#{operation.name}\" \n\n") + next + end + if fault_binding.soapfault.name != fault_binding.name + warn("WARNING: name of soap:fault \"#{fault_binding.soapfault.name}\" doesn't match the name of wsdl:fault \"#{fault_binding.name}\" in operation \"#{operation.name}\" \n\n") + next + end + # According to WS-I (R2723): if in a wsdl:binding the use attribute + # on a contained soapbind:fault element is present, its value MUST + # be "literal". + if fault_binding.soapfault.use and fault_binding.soapfault.use != "literal" + warn("Operation \"#{operation.name}\", fault \"#{fault.name}\": soap:fault \"use\" attribute must be \"literal\"") + end + 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/driverCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/driverCreator.rb new file mode 100644 index 00000000..de7a89bc --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/driverCreator.rb @@ -0,0 +1,118 @@ +# WSDL4R - Creating driver code from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + attr_accessor :drivername_postfix + + def initialize(definitions, name_creator, modulepath = nil) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + @drivername_postfix = '' + end + + def dump(porttype = nil) + result = "require 'soap/rpc/driver'\n\n" + if @modulepath + @modulepath.each do |name| + result << "module #{name}\n" + end + result << "\n" + end + if porttype.nil? + @definitions.porttypes.each do |type| + result << dump_porttype(type.name) + result << "\n" + end + else + result << dump_porttype(porttype) + end + if @modulepath + result << "\n" + @modulepath.each do |name| + result << "end\n" + end + end + result + end + +private + + def dump_porttype(porttype) + drivername = porttype.name + @drivername_postfix + qname = XSD::QName.new(porttype.namespace, drivername) + class_name = mapped_class_basename(qname, @modulepath) + defined_const = {} + result = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype) + methoddef = result[:methoddef] + binding = @definitions.bindings.find { |item| item.type == porttype } + if binding.nil? or binding.soapbinding.nil? + # not bind or not a SOAP binding + return '' + end + address = @definitions.porttype(porttype).locations[0] + + c = XSD::CodeGen::ClassDef.new(class_name, "::SOAP::RPC::Driver") + c.def_const("DefaultEndpointUrl", ndq(address)) + c.def_code <<-EOD +Methods = [ +#{methoddef.gsub(/^/, " ")} +] + EOD + wsdl_name = @definitions.name ? @definitions.name.name : 'default' + mrname = safeconstname(wsdl_name + 'MappingRegistry') + c.def_method("initialize", "endpoint_url = nil") do + %Q[endpoint_url ||= DefaultEndpointUrl\n] + + %Q[super(endpoint_url, nil)\n] + + %Q[self.mapping_registry = #{mrname}::EncodedRegistry\n] + + %Q[self.literal_mapping_registry = #{mrname}::LiteralRegistry\n] + + %Q[init_methods] + 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 + defined_const.each do |ns, tag| + c.def_const(tag, dq(ns)) + end + c.dump + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/element.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/element.rb new file mode 100644 index 00000000..bc996ab5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/element.rb @@ -0,0 +1,33 @@ +# WSDL4R - XMLSchema element definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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? + # parent sequence / choice may be marked as maxOccurs="unbounded" + maxoccurs.nil? or maxoccurs != 1 or (parent and parent.map_as_array?) + end + + def anonymous_type? + !@ref and @name and @local_complextype + end + + def attributes + @local_complextype.attributes + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/encodedMappingRegistryCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/encodedMappingRegistryCreator.rb new file mode 100644 index 00000000..7fa5baef --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/encodedMappingRegistryCreator.rb @@ -0,0 +1,73 @@ +# WSDL4R - Creating EncodedMappingRegistry code from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/mappingRegistryCreatorSupport' + + +module WSDL +module SOAP + + +class EncodedMappingRegistryCreator + include MappingRegistryCreatorSupport + + attr_reader :definitions + + def initialize(definitions, name_creator, modulepath, defined_const) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + @simpletypes = definitions.collect_simpletypes + @simpletypes.uniq! + @complextypes = definitions.collect_complextypes + @complextypes.uniq! + @varname = nil + @defined_const = defined_const + end + + def dump(varname) + @varname = varname + result = '' + 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 + result + end + +private + + def dump_complextype + @complextypes.collect { |type| + unless type.abstract + dump_with_inner { + dump_complextypedef(@modulepath, type.name, type, nil, :encoded => true) + } + end + }.compact.join("\n") + end + + def dump_simpletype + @simpletypes.collect { |type| + dump_with_inner { + dump_simpletypedef(@modulepath, type.name, type, nil, :encoded => true) + } + }.compact.join("\n") + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/fault.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/fault.rb new file mode 100644 index 00000000..eba1d72c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/fault.rb @@ -0,0 +1,56 @@ +# WSDL4R - WSDL SOAP body definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/header.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/header.rb new file mode 100644 index 00000000..2f03ff84 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/header.rb @@ -0,0 +1,86 @@ +# WSDL4R - WSDL SOAP body definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/headerfault.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/headerfault.rb new file mode 100644 index 00000000..7b11f244 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/headerfault.rb @@ -0,0 +1,56 @@ +# WSDL4R - WSDL SOAP body definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/literalMappingRegistryCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/literalMappingRegistryCreator.rb new file mode 100644 index 00000000..1853ac18 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/literalMappingRegistryCreator.rb @@ -0,0 +1,115 @@ +# WSDL4R - Creating LiteralMappingRegistry code from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/mappingRegistryCreatorSupport' + + +module WSDL +module SOAP + + +class LiteralMappingRegistryCreator + include MappingRegistryCreatorSupport + + def initialize(definitions, name_creator, modulepath, defined_const) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + @elements = definitions.collect_elements + @elements.uniq! + @attributes = definitions.collect_attributes + @attributes.uniq! + @simpletypes = definitions.collect_simpletypes + @simpletypes.uniq! + @complextypes = definitions.collect_complextypes + @complextypes.uniq! + @varname = nil + @defined_const = defined_const + end + + def dump(varname) + @varname = varname + result = '' + 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 + str = dump_element + unless str.empty? + result << "\n" unless result.empty? + result << str + end + str = dump_attribute + unless str.empty? + result << "\n" unless result.empty? + result << str + end + result + end + +private + + def dump_element + @elements.collect { |ele| + # has the definition different from the complexType of the same name + next if ele.type.nil? and @complextypes[ele.name] + dump_with_inner { + if typedef = ele.local_complextype + dump_complextypedef(@modulepath, ele.name, typedef) + elsif typedef = ele.local_simpletype + dump_simpletypedef(@modulepath, ele.name, typedef) + elsif ele.type + if typedef = @complextypes[ele.type] + dump_complextypedef(@modulepath, ele.type, typedef, ele.name) + elsif typedef = @simpletypes[ele.type] + dump_simpletypedef(@modulepath, ele.type, typedef, ele.name) + end + end + } + }.compact.join("\n") + end + + def dump_attribute + @attributes.collect { |attr| + if attr.local_simpletype + dump_with_inner { + dump_simpletypedef(@modulepath, attr.name, attr.local_simpletype) + } + end + }.compact.join("\n") + end + + def dump_simpletype + @simpletypes.collect { |type| + dump_with_inner { + dump_simpletypedef(@modulepath, type.name, type) + } + }.compact.join("\n") + end + + def dump_complextype + @complextypes.collect { |type| + unless type.abstract + dump_with_inner { + dump_complextypedef(@modulepath, type.name, type) + } + end + }.compact.join("\n") + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreator.rb new file mode 100644 index 00000000..b619eda9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreator.rb @@ -0,0 +1,58 @@ +# WSDL4R - Creating MappingRegistry code from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 'wsdl/soap/encodedMappingRegistryCreator' +require 'wsdl/soap/literalMappingRegistryCreator' +require 'xsd/codegen/moduledef.rb' + + +module WSDL +module SOAP + + +class MappingRegistryCreator + include ClassDefCreatorSupport + + attr_reader :definitions + + def initialize(definitions, name_creator, modulepath = nil) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + end + + def dump + defined_const = {} + encoded_creator = EncodedMappingRegistryCreator.new(@definitions, @name_creator, @modulepath, defined_const) + literal_creator = LiteralMappingRegistryCreator.new(@definitions, @name_creator, @modulepath, defined_const) + wsdl_name = @definitions.name ? @definitions.name.name : 'default' + module_name = safeconstname(wsdl_name + 'MappingRegistry') + if @modulepath + module_name = [@modulepath, module_name].join('::') + end + m = XSD::CodeGen::ModuleDef.new(module_name) + m.def_require("soap/mapping") + varname = 'EncodedRegistry' + m.def_const(varname, '::SOAP::Mapping::EncodedRegistry.new') + m.def_code(encoded_creator.dump(varname)) + varname = 'LiteralRegistry' + m.def_const(varname, '::SOAP::Mapping::LiteralRegistry.new') + m.def_code(literal_creator.dump(varname)) + # + defined_const.each do |ns, tag| + m.def_const(tag, dq(ns)) + end + m.dump + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreatorSupport.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreatorSupport.rb new file mode 100644 index 00000000..b224eec0 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/mappingRegistryCreatorSupport.rb @@ -0,0 +1,376 @@ +# WSDL4R - Creating MappingRegistry support. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/soap/classDefCreatorSupport' + + +module WSDL +module SOAP + + +# requires @defined_const = {}, @dump_with_inner, @modulepath +module MappingRegistryCreatorSupport + include ClassDefCreatorSupport + include XSD::CodeGen + + def dump_with_inner + @dump_with_inner = [] + @dump_with_inner.unshift(yield) + @dump_with_inner.join("\n") + end + + def dump_complextypedef(mpath, qname, typedef, as_element = nil, opt = {}) + case typedef.compoundtype + when :TYPE_STRUCT, :TYPE_EMPTY + dump_complex_typemap(mpath, qname, typedef, as_element, opt) + when :TYPE_ARRAY + dump_array_typemap(mpath, qname, typedef, as_element, opt) + when :TYPE_SIMPLE + dump_simple_typemap(mpath, qname, typedef, as_element, opt) + when :TYPE_MAP + # mapped as a general Hash + nil + else + raise RuntimeError.new( + "unknown kind of complexContent: #{typedef.compoundtype}") + end + end + + def dump_array_typemap(mpath, qname, typedef, as_element, opt) + if typedef.find_soapenc_arytype + if opt[:encoded] + dump_encoded_array_typemap(mpath, qname, typedef, as_element, opt) + end + else + dump_literal_array_typemap(mpath, qname, typedef, as_element, opt) + end + end + + def dump_complex_typemap(mpath, qname, typedef, as_element, opt) + var = {} + define_dump_class(var, mpath, qname, typedef, as_element, opt) + schema_ns = (var[:schema_name] || var[:schema_type]).namespace + if var[:schema_type] and typedef.base + var[:schema_basetype] = typedef.base + end + parentmodule = var[:class] + parsed_element = + parse_elements(typedef.elements, qname.namespace, parentmodule, opt) + if typedef.choice? + parsed_element.unshift(:choice) + end + var[:schema_element] = dump_schema_element_definition(parsed_element, 2) + unless typedef.attributes.empty? + var[:schema_attribute] = define_attribute(typedef.attributes) + end + assign_const(schema_ns, 'Ns') + dump_entry(@varname, var) + end + + def dump_simple_typemap(mpath, qname, typedef, as_element, opt) + var = {} + define_dump_class(var, mpath, qname, typedef, as_element, opt) + schema_ns = (var[:schema_name] || var[:schema_type]).namespace + unless typedef.attributes.empty? + var[:schema_attribute] = define_attribute(typedef.attributes) + end + assign_const(schema_ns, 'Ns') + dump_entry(@varname, var) + end + + def dump_schema_element_definition(definition, indent = 0) + return '[]' if definition.empty? + sp = ' ' * indent + if definition[0] == :choice + definition.shift + "[ :choice,\n" + + dump_schema_element(definition, indent + 2) + "\n" + sp + "]" + elsif definition[0].is_a?(::Array) + "[\n" + + dump_schema_element(definition, indent + 2) + "\n" + sp + "]" + else + varname, name, type, occurrence = definition + '[' + [ + varname.dump, + dump_type(name, type), + dump_occurrence(occurrence) + ].compact.join(', ') + ']' + end + end + + def dump_schema_element(schema_element, indent = 0) + sp = ' ' * indent + delimiter = ",\n" + sp + sp + schema_element.collect { |definition| + dump_schema_element_definition(definition, indent) + }.join(delimiter) + end + + def dump_type(name, type) + if name + assign_const(name.namespace, 'Ns') + '[' + ndq(type) + ', ' + dqname(name) + ']' + else + ndq(type) + end + end + + def dump_occurrence(occurrence) + if occurrence and occurrence != [1, 1] # default + minoccurs, maxoccurs = occurrence + maxoccurs ||= 'nil' + "[#{minoccurs}, #{maxoccurs}]" + end + end + + def parse_elements(elements, base_namespace, mpath, opt) + schema_element = [] + any = false + elements.each do |element| + case element + when XMLSchema::Any + # only 1 is allowed for now. + raise RuntimeError.new("duplicated 'any'") if any + any = true + varname = 'any' # not used + eleqname = XSD::AnyTypeName + type = nil + occurrence = nil + schema_element << [varname, eleqname, type, occurrence] + when XMLSchema::Element + next if element.ref == SchemaName + typebase = @modulepath + if element.anonymous_type? + child_opt = { + :qualified => (element.elementform == 'qualified'), + :is_anonymous => true + } + @dump_with_inner << dump_complextypedef(mpath, element.name, element.local_complextype, nil, child_opt) + typebase = mpath + end + type = create_type_name(typebase, element) + name = name_element(element).name + varname = safevarname(name) + if element.map_as_array? + if type + type += '[]' + else + type = '[]' + end + end + # nil means @@schema_ns + varname + eleqname = element.name || element.ref + if eleqname && varname == name && eleqname.namespace == base_namespace + eleqname = nil + end + occurrence = [element.minoccurs, element.maxoccurs] + schema_element << [varname, eleqname, type, occurrence] + when WSDL::XMLSchema::Sequence + child_schema_element = + parse_elements(element.elements, base_namespace, mpath, opt) + schema_element << child_schema_element + when WSDL::XMLSchema::Choice + child_schema_element = + parse_elements(element.elements, base_namespace, mpath, opt) + if !element.map_as_array? + # choice + maxOccurs="unbounded" is treated just as 'all' now. + child_schema_element.unshift(:choice) + end + schema_element << child_schema_element + when WSDL::XMLSchema::Group + if element.content.nil? + warn("no group definition found: #{element}") + next + end + child_schema_element = + parse_elements(element.content.elements, base_namespace, mpath, opt) + schema_element.concat(child_schema_element) + else + raise RuntimeError.new("unknown type: #{element}") + end + end + schema_element + end + + def define_attribute(attributes) + schema_attribute = [] + attributes.each do |attribute| + name = name_attribute(attribute) + if klass = attribute_basetype(attribute) + type = klass.name + else + warn("unresolved attribute type #{attribute.type} for #{name}") + type = nil + end + schema_attribute << [name, type] + end + "{\n " + + schema_attribute.collect { |name, type| + assign_const(name.namespace, 'Ns') + dqname(name) + ' => ' + ndq(type) + }.join(",\n ") + + "\n }" + end + + def dump_entry(regname, var) + "#{regname}.register(\n " + + [ + dump_entry_item(var, :class), + dump_entry_item(var, :soap_class), + dump_entry_item(var, :schema_name, :qname), + dump_entry_item(var, :schema_type, :qname), + dump_entry_item(var, :is_anonymous), + dump_entry_item(var, :schema_basetype, :qname), + dump_entry_item(var, :schema_qualified), + dump_entry_item(var, :schema_element), + dump_entry_item(var, :schema_attribute) + ].compact.join(",\n ") + + "\n)\n" + end + + def dump_entry_item(var, key, dump_type = :none) + if var.key?(key) + case dump_type + when :none + ":#{key} => #{var[key]}" + when :string + if @defined_const.key?(var[key]) + ":#{key} => #{@defined_const[var[key]]}" + else + ":#{key} => #{ndq(var[key])}" + end + when :qname + qname = var[key] + if @defined_const.key?(qname.namespace) + ns = @defined_const[qname.namespace] + else + ns = ndq(qname.namespace) + end + ":#{key} => XSD::QName.new(#{ns}, #{ndq(qname.name)})" + else + raise "Unknown dump type: #{dump_type}" + end + end + end + + def dump_simpletypedef(mpath, qname, simpletype, as_element = nil, opt = {}) + if simpletype.restriction + dump_simpletypedef_restriction(mpath, qname, simpletype, as_element, opt) + elsif simpletype.list + dump_simpletypedef_list(mpath, qname, simpletype, as_element, opt) + elsif simpletype.union + dump_simpletypedef_union(mpath, qname, simpletype, as_element, opt) + else + raise RuntimeError.new("unknown kind of simpletype: #{simpletype}") + end + end + + def dump_simpletypedef_restriction(mpath, qname, typedef, as_element, opt) + restriction = typedef.restriction + unless restriction.enumeration? + # not supported. minlength? + return nil + end + var = {} + define_dump_class(var, mpath, qname, typedef, as_element, opt) + schema_ns = (var[:schema_name] || var[:schema_type]).namespace + assign_const(schema_ns, 'Ns') + dump_entry(@varname, var) + end + + def dump_simpletypedef_list(mpath, qname, typedef, as_element, opt) + nil + end + + def dump_simpletypedef_union(mpath, qname, typedef, as_element, opt) + nil + end + + DEFAULT_ITEM_NAME = XSD::QName.new(nil, 'item') + + def dump_literal_array_typemap(mpath, qname, typedef, as_element, opt) + var = {} + define_dump_class(var, mpath, qname, typedef, as_element, opt) + schema_ns = (var[:schema_name] || var[:schema_type]).namespace + parsed_element = + parse_elements(typedef.elements, qname.namespace, var[:class], opt) + if parsed_element.empty? + parsed_element = [create_array_element_definition(typedef, mpath)] + end + var[:schema_element] = dump_schema_element_definition(parsed_element, 2) + assign_const(schema_ns, 'Ns') + dump_entry(@varname, var) + end + + def dump_encoded_array_typemap(mpath, qname, typedef, as_element, opt) + arytype = typedef.find_arytype || XSD::AnyTypeName + type = XSD::QName.new(arytype.namespace, arytype.name.sub(/\[(?:,)*\]$/, '')) + return <<__EOD__ +#{@varname}.set( + #{mapped_class_name(qname, mpath)}, + ::SOAP::SOAPArray, + ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory, + { :type => #{dqname(type)} } +) +__EOD__ + end + + # used when "soapenc:arrayType" definition + def create_array_element_definition(typedef, mpath) + child_type = typedef.child_type + child_element = typedef.find_aryelement + if child_type == XSD::AnyTypeName + type = nil + elsif child_element + if klass = element_basetype(child_element) + type = klass.name + else + typename = child_element.type || child_element.name + type = mapped_class_name(typename, mpath) + end + elsif child_type + type = mapped_class_name(child_type, mpath) + else + type = nil + end + occurrence = [0, nil] + if child_element and child_element.name + if child_element.map_as_array? + type << '[]' if type + occurrence = [child_element.minoccurs, child_element.maxoccurs] + end + child_element_name = child_element.name + else + child_element_name = DEFAULT_ITEM_NAME + end + [child_element_name.name, child_element_name, type, occurrence] + end + + def define_dump_class(var, mpath, qname, typedef, as_element, opt) + var[:class] = mapped_class_name(qname, mpath) + if as_element + var[:schema_name] = as_element + schema_ns = as_element.namespace + elsif typedef.name.nil? + var[:schema_name] = qname + schema_ns = qname.namespace + else + var[:schema_type] = qname + schema_ns = qname.namespace + end + var[:is_anonymous] = opt[:is_anonymous] if opt.key?(:is_anonymous) + # true, false, or nil + if opt.key?(:qualified) + var[:schema_qualified] = opt[:qualified].to_s + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/methodDefCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/methodDefCreator.rb new file mode 100644 index 00000000..ddea2539 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/methodDefCreator.rb @@ -0,0 +1,263 @@ +# WSDL4R - Creating driver code from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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, name_creator, modulepath, defined_const) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + @simpletypes = @definitions.collect_simpletypes + @complextypes = @definitions.collect_complextypes + @elements = @definitions.collect_elements + @types = [] + @encoded = false + @literal = false + @defined_const = defined_const + end + + def dump(name) + @types.clear + @encoded = false + @literal = false + methoddef = "" + porttype = @definitions.porttype(name) + binding = porttype.find_binding + if binding + binding.operations.each do |op_bind| + next unless op_bind # no binding is defined + next unless op_bind.soapoperation # not a SOAP operation binding + op = op_bind.find_operation + methoddef << ",\n" unless methoddef.empty? + methoddef << dump_method(op, op_bind).chomp + end + end + result = { + :methoddef => methoddef, + :types => @types, + :encoded => @encoded, + :literal => @literal + } + result + 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)) + end + operation.outputparts.each do |output| + param << param_set(::SOAP::RPC::SOAPMethod::OUT, output.name, + documentdefinedtype(output)) + end + param + end + +private + + def dump_method(operation, binding) + op_faults = {} + binding.fault.each do |fault| + op_fault = {} + soapfault = fault.soapfault + next if soapfault.nil? + faultclass = mapped_class_name(fault.name, @modulepath) + op_fault[:ns] = fault.name.namespace + op_fault[:name] = fault.name.name + op_fault[:namespace] = soapfault.namespace + op_fault[:use] = soapfault.use || "literal" + op_fault[:encodingstyle] = soapfault.encodingstyle || "document" + op_faults[faultclass] = op_fault + end + op_faults_str = op_faults.inspect + + name = safemethodname(operation.name) + name_as = operation.name + style = binding.soapoperation_style + inputuse = binding.soapbody_use_input + outputuse = binding.soapbody_use_output + if style == :rpc + qname = binding.soapoperation_name + 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 => #{nsym(style)}, :request_use => #{nsym(inputuse)}, + :response_style => #{nsym(style)}, :response_use => #{nsym(outputuse)}, + :faults => #{op_faults_str} } +__EOD__ + if inputuse == :encoded or outputuse == :encoded + @encoded = true + end + if inputuse == :literal or outputuse == :literal + @literal = true + end + if style == :rpc + assign_const(qname.namespace, 'Ns') + return <<__EOD__ +[ #{dqname(qname)}, + #{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] + [nil, definedtype.name.namespace, definedtype.name.name] + elsif definedtype = @elements[part.element] + [nil, part.element.namespace, part.element.name] + elsif definedtype = @complextypes[part.type] + case definedtype.compoundtype + when :TYPE_STRUCT, :TYPE_EMPTY, :TYPE_ARRAY, :TYPE_SIMPLE + type = mapped_class_name(part.type, @modulepath) + [type, part.type.namespace, part.type.name] + when :TYPE_MAP + [Hash.name, part.type.namespace, part.type.name] + else + raise NotImplementedError.new("must not reach here: #{definedtype.compoundtype}") + end + elsif part.type == XSD::AnyTypeName + [nil] + 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] + if definedtype.base + ['::' + basetype_mapped_class(definedtype.base).name, nil, part.name] + else + raise RuntimeError.new("unsupported simpleType: #{definedtype}") + end + 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 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] + collect_elements_type(@complextypes[type].elements) + end + + def collect_elements_type(elements) + elements.each do |element| + case element + when WSDL::XMLSchema::Any + # nothing to do + when WSDL::XMLSchema::Element + collect_type(element.type) + when WSDL::XMLSchema::Sequence, WSDL::XMLSchema::Choice + collect_elements_type(element.elements) + else + raise RuntimeError.new("unknown type: #{element}") + end + 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 + "[#{ndq(type[0])}]" + else + "[#{ndq(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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/operation.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/operation.rb new file mode 100644 index 00000000..446ef4d7 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/operation.rb @@ -0,0 +1,122 @@ +# WSDL4R - WSDL SOAP operation definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 :encodingstyle + attr_reader :headerparts + attr_reader :bodyparts + attr_reader :faultpart + attr_reader :soapaction + + def initialize(style, use, encodingstyle, op_name, optype_name, + headerparts, bodyparts, faultpart, soapaction) + @style = style + @use = use + @encodingstyle = encodingstyle + @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_style = operation_style() + op_use = param.soapbody_use + op_encodingstyle = param.soapbody_encodingstyle + 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.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(op_style, op_use, op_encodingstyle, op_name, optype_name, + headerparts, bodyparts, faultpart, parent.soapaction) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servantSkeltonCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servantSkeltonCreator.rb new file mode 100644 index 00000000..bcf96982 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servantSkeltonCreator.rb @@ -0,0 +1,80 @@ +# WSDL4R - Creating servant skelton code from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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, name_creator, modulepath = nil) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + end + + def dump(porttype = nil) + result = "" + if @modulepath + result << "\n" + result << @modulepath.collect { |ele| "module #{ele}" }.join("; ") + result << "\n\n" + end + if porttype.nil? + @definitions.porttypes.each do |type| + result << dump_porttype(type.name) + result << "\n" + end + else + result << dump_porttype(porttype) + end + if @modulepath + result << "\n\n" + result << @modulepath.collect { |ele| "end" }.join("; ") + result << "\n" + end + result + end + +private + + def dump_porttype(name) + class_name = mapped_class_basename(name, @modulepath) + c = XSD::CodeGen::ClassDef.new(class_name) + element_definitions = @definitions.collect_elements + operations = @definitions.porttype(name).operations + operations.each do |operation| + name = safemethodname(operation.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, element_definitions) + c.add_method(m) + end + c.dump + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servletStubCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servletStubCreator.rb new file mode 100644 index 00000000..4037b959 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/servletStubCreator.rb @@ -0,0 +1,107 @@ +# WSDL4R - Creating servlet stub code from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 ServletStubCreator + include ClassDefCreatorSupport + + attr_reader :definitions + + def initialize(definitions, name_creator, modulepath = nil) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + end + + def dump(service_name) + warn("- Servlet stub can have only 1 port for now. So creating stub for the first port and rests are ignored.") + services = @definitions.service(service_name) + unless services + raise RuntimeError.new("service not defined: #{service_name}") + end + ports = services.ports + if ports.empty? + raise RuntimeError.new("ports not found for #{service_name}") + end + port = ports[0] + if port.porttype.nil? + raise RuntimeError.new("porttype not found for #{port}") + end + dump_porttype(port.porttype) + end + +private + + def dump_porttype(porttype) + class_name = mapped_class_name(porttype.name, @modulepath) + defined_const = {} + result = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name) + methoddef = result[:methoddef] + + wsdl_name = @definitions.name ? @definitions.name.name : 'default' + mrname = safeconstname(wsdl_name + 'MappingRegistry') + + c1 = XSD::CodeGen::ClassDef.new(class_name) + c1.def_require("soap/rpc/soaplet") + c1.def_code <<-EOD +Methods = [ +#{methoddef.gsub(/^/, " ")} +] + EOD + defined_const.each do |ns, tag| + c1.def_const(tag, dq(ns)) + end + c2 = XSD::CodeGen::ClassDef.new(class_name + "Servlet", + "::SOAP::RPC::SOAPlet") + c2.def_method("initialize", "router = nil") do + <<-EOD + super(router) + 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 + @router.mapping_registry = #{mrname}::EncodedRegistry + @router.literal_mapping_registry = #{mrname}::LiteralRegistry + EOD + end + c1.dump + "\n" + c2.dump + format(<<-EOD) + + if $0 == __FILE__ + require 'webrick' + server = WEBrick::HTTPServer.new( + :BindAddress => "0.0.0.0", + :Port => 10080, + :DocumentRoot => "." + ) + server.mount("/", #{c2.name}.new) + trap(:INT) do + server.shutdown + end + server.start + end + EOD + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/standaloneServerStubCreator.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/standaloneServerStubCreator.rb new file mode 100644 index 00000000..c194a69f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/standaloneServerStubCreator.rb @@ -0,0 +1,103 @@ +# WSDL4R - Creating standalone server stub code from WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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, name_creator, modulepath = nil) + @definitions = definitions + @name_creator = name_creator + @modulepath = modulepath + 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.") + services = @definitions.service(service_name) + unless services + raise RuntimeError.new("service not defined: #{service_name}") + end + ports = services.ports + if ports.empty? + raise RuntimeError.new("ports not found for #{service_name}") + end + port = ports[0] + if port.porttype.nil? + raise RuntimeError.new("porttype not found for #{port}") + end + dump_porttype(port.porttype) + end + +private + + def dump_porttype(porttype) + class_name = mapped_class_name(porttype.name, @modulepath) + defined_const = {} + result = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype.name) + methoddef = result[:methoddef] + + wsdl_name = @definitions.name ? @definitions.name.name : 'default' + mrname = safeconstname(wsdl_name + 'MappingRegistry') + + c1 = XSD::CodeGen::ClassDef.new(class_name) + c1.def_require("soap/rpc/standaloneServer") + c1.def_code <<-EOD +Methods = [ +#{methoddef.gsub(/^/, " ")} +] + EOD + defined_const.each do |ns, tag| + c1.def_const(tag, dq(ns)) + end + 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 = #{mrname}::EncodedRegistry + self.literal_mapping_registry = #{mrname}::LiteralRegistry + 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/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb new file mode 100644 index 00000000..6b63322d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb @@ -0,0 +1,217 @@ +# WSDL4R - WSDL to ruby mapping library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/servletStubCreator' +require 'wsdl/soap/cgiStubCreator' +require 'wsdl/soap/classNameCreator' + + +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) + if @opt['classdef'] + @name = @opt['classdef'] + else + @name = @wsdl.name ? @wsdl.name.name : 'default' + end + create_file + end + +private + + def initialize + @modulepath = nil + @location = nil + @opt = {} + @logger = Logger.new(STDERR) + @basedir = nil + @wsdl = nil + @name = nil + @classdef_filename = nil + @mr_filename = nil + @name_creator = ClassNameCreator.new + end + + def create_file + @modulepath = @opt['module_path'] + create_classdef if @opt.key?('classdef') + create_mapping_registry if @opt.key?('mapping_registry') + 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_servlet_stub(@opt['servlet_stub']) if @opt.key?('servlet_stub') + create_driver(@opt['driver'], @opt['drivername_postfix'] || '') 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, @name_creator, @modulepath).dump + end + end + + def create_mapping_registry + @logger.info { "Creating mapping registry definition." } + @mr_filename = @name + 'MappingRegistry.rb' + check_file(@mr_filename) or return + write_file(@mr_filename) do |f| + f << "require '#{@classdef_filename}'\n" if @classdef_filename + f << WSDL::SOAP::MappingRegistryCreator.new(@wsdl, @name_creator, @modulepath).dump + end + end + + def create_client_skelton(servicename) + return if @wsdl.services.empty? + @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, @name_creator, @modulepath).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, @name_creator, @modulepath).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" + f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename + f << "require '#{@mr_filename}'\n" if @mr_filename + f << WSDL::SOAP::CGIStubCreator.new(@wsdl, @name_creator, @modulepath).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" if @servant_skelton_filename + f << "require '#{@mr_filename}'\n" if @mr_filename + f << WSDL::SOAP::StandaloneServerStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename)) + end + end + + def create_servlet_stub(servicename) + @logger.info { "Creating servlet stub." } + servicename ||= @wsdl.services[0].name.name + @servlet_stub_filename = servicename + 'Servlet.rb' + check_file(@servlet_stub_filename) or return + write_file(@servlet_stub_filename) do |f| + f << shbang << "\n" + f << "require '#{@servant_skelton_filename}'\n" if @servant_skelton_filename + f << "require '#{@mr_filename}'\n" if @mr_filename + f << WSDL::SOAP::ServletStubCreator.new(@wsdl, @name_creator, @modulepath).dump(create_name(servicename)) + end + end + + def create_driver(porttypename, drivername_postfix) + @logger.info { "Creating driver." } + @driver_filename = (porttypename || @name) + 'Driver.rb' + creator = WSDL::SOAP::DriverCreator.new(@wsdl, @name_creator, @modulepath) + creator.drivername_postfix = drivername_postfix + check_file(@driver_filename) or return + write_file(@driver_filename) do |f| + f << "require '#{@classdef_filename}'\n" if @classdef_filename + f << "require '#{@mr_filename}'\n" if @mr_filename + f << creator.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 + + +if __FILE__ == $0 + warn("WARNING: #{File.expand_path(__FILE__)} is a library file used by bin/wsdl2ruby.rb. Find bin/wsdl2ruby.rb from tarball version of soap4r or install soap4r via gem.") +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/types.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/types.rb new file mode 100644 index 00000000..0b77997a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/types.rb @@ -0,0 +1,44 @@ +# WSDL4R - WSDL types definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + o.location = parent.location + @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/vendor/gems/soap4r-1.5.8/lib/wsdl/wsdl.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/wsdl.rb new file mode 100644 index 00000000..f9356c82 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/wsdl.rb @@ -0,0 +1,24 @@ +# WSDL4R - Base definitions. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/nestedexception' + + +module WSDL + + +Version = '0.0.2' + +Namespace = 'http://schemas.xmlsoap.org/wsdl/' +SOAPBindingNamespace ='http://schemas.xmlsoap.org/wsdl/soap/' + +class Error < StandardError; include ::SOAP::NestedException; end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/all.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/all.rb new file mode 100644 index 00000000..5e987592 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/all.rb @@ -0,0 +1,24 @@ +# WSDL4R - XMLSchema complexType definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/content' + + +module WSDL +module XMLSchema + + +class All < Content + def initialize + super() + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/annotation.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/annotation.rb new file mode 100644 index 00000000..4e2341a8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/annotation.rb @@ -0,0 +1,34 @@ +# WSDL4R - WSDL SOAP documentation element. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/any.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/any.rb new file mode 100644 index 00000000..59322d26 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/any.rb @@ -0,0 +1,61 @@ +# WSDL4R - XMLSchema any definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + if value.source == 'unbounded' + @maxoccurs = nil + else + @maxoccurs = Integer(value.source) + end + value.source + when MinOccursAttrName + @minoccurs = Integer(value.source) + when NamespaceAttrName + @namespace = value.source + when ProcessContentsAttrName + @process_contents = value.source + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/anyAttribute.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/anyAttribute.rb new file mode 100644 index 00000000..12da3952 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/anyAttribute.rb @@ -0,0 +1,48 @@ +# WSDL4R - XMLSchema anyAttribute definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 AnyAttribute < Info + attr_accessor :namespace + attr_accessor :processcontents + + def initialize + super() + @namespace = '##any' + @processcontents = 'strict' + end + + def targetnamespace + parent.targetnamespace + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when NamespaceAttrName + @namespace = value.source + when ProcessContentsAttrName + @processcontents = value.source + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attribute.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attribute.rb new file mode 100644 index 00000000..13b53b2b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attribute.rb @@ -0,0 +1,123 @@ +# WSDL4R - XMLSchema attribute definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 = value + else + nil + end + end + +private + + def directelement? + parent.is_a?(Schema) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attributeGroup.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attributeGroup.rb new file mode 100644 index 00000000..2658ce91 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/attributeGroup.rb @@ -0,0 +1,86 @@ +# WSDL4R - XMLSchema attributeGroup definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 AttributeGroup < 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 :attributes + + attr_reader_ref :name + attr_reader_ref :attributes + + attr_accessor :ref + + def initialize + super + @name = nil + @attributes = nil + @ref = nil + @refelement = nil + end + + def refelement + @refelement ||= root.collect_attributegroups[@ref] + end + + def targetnamespace + parent.targetnamespace + end + + def parse_element(element) + case element + when AttributeName + @attributes ||= XSD::NamedElements.new + o = Attribute.new + @attributes << o + o + end + end + + def parse_attr(attr, value) + case attr + when NameAttrName + @name = XSD::QName.new(targetnamespace, value.source) + when RefAttrName + @ref = value + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/choice.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/choice.rb new file mode 100644 index 00000000..062b6fa2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/choice.rb @@ -0,0 +1,58 @@ +# WSDL4R - XMLSchema complexType definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/content' + + +module WSDL +module XMLSchema + + +class Choice < Content + attr_reader :any + + def initialize + super() + @any = nil + end + + def have_any? + !!@any + end + + def choice? + true + end + + def parse_element(element) + case element + when SequenceName + o = Sequence.new + @elements << o + o + when ChoiceName + o = Choice.new + @elements << o + o + when GroupName + o = Group.new + @elements << o + o + when AnyName + @any = Any.new + @elements << @any + @any + else + super(element) + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexContent.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexContent.rb new file mode 100644 index 00000000..34a3a61f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexContent.rb @@ -0,0 +1,97 @@ +# WSDL4R - XMLSchema complexContent definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 :restriction + attr_accessor :extension + attr_accessor :mixed + + def initialize + super + @restriction = nil + @extension = nil + @mixed = false + end + + def targetnamespace + parent.targetnamespace + end + + def elementformdefault + parent.elementformdefault + end + + def content + @extension || @restriction + end + + def base + content ? content.base : nil + end + + def have_any? + content ? content.have_any? : nil + end + + def choice? + content ? content.choice? : nil + end + + def elements + content ? content.elements : XSD::NamedElements::Empty + end + + def attributes + content ? content.attributes : XSD::NamedElements::Empty + end + + def nested_elements + # restrict and extension does not have particle. + content ? content.nested_elements : XSD::NamedElements::Empty + end + + def check_type + if content + content.check_type + else + raise ArgumentError.new("incomplete complexContent") + end + end + + def parse_element(element) + case element + when RestrictionName + raise ArgumentError.new("incomplete complexContent") if content + @restriction = ComplexRestriction.new + when ExtensionName + raise ArgumentError.new("incomplete complexContent") if content + @extension = ComplexExtension.new + end + end + + def parse_attr(attr, value) + case attr + when MixedAttrName + @mixed = to_boolean(value) + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexExtension.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexExtension.rb new file mode 100644 index 00000000..a211ca8b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexExtension.rb @@ -0,0 +1,119 @@ +# WSDL4R - XMLSchema complexType extension definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 ComplexExtension < Info + attr_accessor :base + attr_reader :content + + def initialize + super + @base = nil + @basetype = nil + @content = nil + @attributes = XSD::NamedElements.new + end + + def targetnamespace + parent.targetnamespace + end + + def elementformdefault + parent.elementformdefault + end + + def have_any? + basetype.have_any? or (content && content.have_any?) + end + + def choice? + content and content.choice? + end + + def elements + result = XSD::NamedElements.new + result.concat(basetype.elements) + result.concat(content.elements) if content + result + end + + def nested_elements + result = XSD::NamedElements.new + result.concat(basetype.nested_elements) + result.concat(content.nested_elements) if content + result + end + + def attributes + basetype.attributes + @attributes + end + + def check_type + if @base == ::SOAP::ValueArrayName + :TYPE_ARRAY + elsif content or !@attributes.empty? + :TYPE_STRUCT + else + basetype.check_type + end + end + + def parse_element(element) + case element + when AllName + @content = All.new + @content + when SequenceName + @content = Sequence.new + @content + when ChoiceName + @content = Choice.new + @content + when AttributeName + o = Attribute.new + @attributes << o + o + when AttributeGroupName + o = AttributeGroup.new + @attributes << o + o + when AnyAttributeName + o = AnyAttribute.new + @attributes << o + o + end + end + + def parse_attr(attr, value) + case attr + when BaseAttrName + @base = value + end + end + +private + + def basetype + @basetype ||= root.collect_complextypes[@base] + unless @basetype + raise RuntimeError.new("base type definition not found: #{@base}") + end + @basetype + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexRestriction.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexRestriction.rb new file mode 100644 index 00000000..b1cc086c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexRestriction.rb @@ -0,0 +1,104 @@ +# WSDL4R - XMLSchema complexType restriction definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 ComplexRestriction < Info + attr_accessor :base + attr_reader :content + attr_reader :attributes + + def initialize + super + @base = nil + @basetype = nil + @content = nil + @attributes = XSD::NamedElements.new + end + + def targetnamespace + parent.targetnamespace + end + + def elementformdefault + parent.elementformdefault + end + + def have_any? + @content and @content.have_any? + end + + def choice? + @content and @content.choice? + end + + def elements + @content ? @content.elements : XSD::NamedElements::Empty + end + + def nested_elements + @content ? @content.nested_elements : XSD::NamedElements::Empty + end + + def check_type + if @base == ::SOAP::ValueArrayName + :TYPE_ARRAY + else + basetype.check_type if basetype + end + end + + def parse_element(element) + case element + when AllName + @content = All.new + @content + when SequenceName + @content = Sequence.new + @content + when ChoiceName + @content = Choice.new + @content + when AttributeName + o = Attribute.new + @attributes << o + o + when AttributeGroupName + o = AttributeGroup.new + @attributes << o + o + when AnyAttributeName + o = AnyAttribute.new + @attributes << o + o + end + end + + def parse_attr(attr, value) + case attr + when BaseAttrName + @base = value + end + end + +private + + def basetype + @basetype ||= root.collect_complextypes[@base] + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexType.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexType.rb new file mode 100644 index 00000000..79374f7c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/complexType.rb @@ -0,0 +1,193 @@ +# WSDL4R - XMLSchema complexType definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/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_accessor :abstract + + def initialize(name = nil) + super() + @name = name + @complexcontent = nil + @simplecontent = nil + @content = nil + @final = nil + @mixed = false + @abstract = 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 + + def have_any? + if c = @complexcontent || @content + c.have_any? + else + false + end + end + + def choice? + if c = @complexcontent || @content + c.choice? + else + false + end + end + + def base + if c = @complexcontent || @simplecontent + c.base + end + end + + def elements + if c = @complexcontent || @content + c.elements + else + XSD::NamedElements::Empty + end + end + + def attributes + attrs = nil + if @complexcontent + attrs = @complexcontent.attributes + @attributes + elsif @simplecontent + attrs = @simplecontent.attributes + @attributes + else + attrs = @attributes + end + found = XSD::NamedElements.new + attrs.each do |attr| + case attr + when Attribute + found << attr + when AttributeGroup + if attr.attributes + found.concat(attr.attributes) + end + when AnyAttribute + # ignored + else + warn("unknown attribute: #{attr}") + end + end + found + end + + def nested_elements + if c = @complexcontent || @content + c.nested_elements + else + XSD::NamedElements::Empty + end + end + + def find_element(name) + return nil if name.nil? + elements.each do |element| + return element if name == element.name + end + nil + end + + def find_element_by_name(name) + return nil if name.nil? + elements.each do |element| + return element if name == element.name.name + 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 GroupName + @content = Group.new + when ComplexContentName + @complexcontent = ComplexContent.new + when SimpleContentName + @simplecontent = SimpleContent.new + when AttributeName + o = Attribute.new + @attributes << o + o + when AttributeGroupName + o = AttributeGroup.new + @attributes << o + o + when AnyAttributeName + o = AnyAttribute.new + @attributes << o + o + else + nil + end + end + + def parse_attr(attr, value) + case attr + when AbstractAttrName + @abstract = to_boolean(value) + when FinalAttrName + @final = value.source + when MixedAttrName + @mixed = to_boolean(value) + when NameAttrName + @name = XSD::QName.new(targetnamespace, value.source) + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/content.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/content.rb new file mode 100644 index 00000000..2583ddb0 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/content.rb @@ -0,0 +1,95 @@ +# WSDL4R - XMLSchema content base definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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_reader :minoccurs + attr_reader :maxoccurs + attr_reader :elements + + def initialize + super() + @minoccurs = 1 + @maxoccurs = 1 + @elements = XSD::NamedElements.new + end + + def targetnamespace + parent.targetnamespace + end + + def elementformdefault + parent.elementformdefault + end + + def have_any? + false + end + + def choice? + false + end + + def map_as_array? + maxoccurs.nil? or maxoccurs != 1 + end + + def nested_elements + elements = XSD::NamedElements.new + @elements.each do |ele| + if ele.respond_to?(:nested_elements) + elements.concat(ele.nested_elements) + else + elements << ele + end + end + elements + end + + def <<(element) + @elements << element + end + + def parse_element(element) + case element + when ElementName + o = Element.new + o.form = elementformdefault + @elements << o + o + else + nil + end + end + + def parse_attr(attr, value) + case attr + when MaxOccursAttrName + if value.source == 'unbounded' + @maxoccurs = nil + else + @maxoccurs = Integer(value.source) + end + value.source + when MinOccursAttrName + @minoccurs = Integer(value.source) + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/data.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/data.rb new file mode 100644 index 00000000..bf2dd62e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/data.rb @@ -0,0 +1,116 @@ +# WSDL4R - XMLSchema data definitions. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/complexRestriction' +require 'wsdl/xmlSchema/complexExtension' +require 'wsdl/xmlSchema/simpleContent' +require 'wsdl/xmlSchema/any' +require 'wsdl/xmlSchema/anyAttribute' +require 'wsdl/xmlSchema/element' +require 'wsdl/xmlSchema/all' +require 'wsdl/xmlSchema/choice' +require 'wsdl/xmlSchema/sequence' +require 'wsdl/xmlSchema/list' +require 'wsdl/xmlSchema/attribute' +require 'wsdl/xmlSchema/union' +require 'wsdl/xmlSchema/unique' +require 'wsdl/xmlSchema/group' +require 'wsdl/xmlSchema/attributeGroup' + +require 'wsdl/xmlSchema/length' +require 'wsdl/xmlSchema/minlength' +require 'wsdl/xmlSchema/maxlength' +require 'wsdl/xmlSchema/pattern' +require 'wsdl/xmlSchema/enumeration' +require 'wsdl/xmlSchema/whitespace' +require 'wsdl/xmlSchema/maxinclusive' +require 'wsdl/xmlSchema/maxexclusive' +require 'wsdl/xmlSchema/minexclusive' +require 'wsdl/xmlSchema/mininclusive' +require 'wsdl/xmlSchema/totaldigits' +require 'wsdl/xmlSchema/fractiondigits' + +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') +AnyAttributeName = XSD::QName.new(XSD::Namespace, 'anyAttribute') +AttributeName = XSD::QName.new(XSD::Namespace, 'attribute') +AttributeGroupName = XSD::QName.new(XSD::Namespace, 'attributeGroup') +ChoiceName = XSD::QName.new(XSD::Namespace, 'choice') +ComplexContentName = XSD::QName.new(XSD::Namespace, 'complexContent') +ComplexTypeName = XSD::QName.new(XSD::Namespace, 'complexType') +ElementName = XSD::QName.new(XSD::Namespace, 'element') +ExtensionName = XSD::QName.new(XSD::Namespace, 'extension') +GroupName = XSD::QName.new(XSD::Namespace, 'group') +ImportName = XSD::QName.new(XSD::Namespace, 'import') +IncludeName = XSD::QName.new(XSD::Namespace, 'include') +ListName = XSD::QName.new(XSD::Namespace, 'list') +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') +UnionName = XSD::QName.new(XSD::Namespace, 'union') +UniqueName = XSD::QName.new(XSD::Namespace, 'unique') + +LengthName = XSD::QName.new(XSD::Namespace, 'length') +MinLengthName = XSD::QName.new(XSD::Namespace, 'minLength') +MaxLengthName = XSD::QName.new(XSD::Namespace, 'maxLength') +PatternName = XSD::QName.new(XSD::Namespace, 'pattern') +EnumerationName = XSD::QName.new(XSD::Namespace, 'enumeration') +WhiteSpaceName = XSD::QName.new(XSD::Namespace, 'whiteSpace') +MaxInclusiveName = XSD::QName.new(XSD::Namespace, 'maxInclusive') +MaxExclusiveName = XSD::QName.new(XSD::Namespace, 'maxExclusive') +MinExclusiveName = XSD::QName.new(XSD::Namespace, 'minExclusive') +MinInclusiveName = XSD::QName.new(XSD::Namespace, 'minInclusive') +TotalDigitsName = XSD::QName.new(XSD::Namespace, 'totalDigits') +FractionDigitsName = XSD::QName.new(XSD::Namespace, 'fractionDigits') + +AbstractAttrName = XSD::QName.new(nil, 'abstract') +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') +ItemTypeAttrName = XSD::QName.new(nil, 'itemType') +MaxOccursAttrName = XSD::QName.new(nil, 'maxOccurs') +MemberTypesAttrName = XSD::QName.new(nil, 'memberTypes') +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') +VersionAttrName = XSD::QName.new(nil, 'version') + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/element.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/element.rb new file mode 100644 index 00000000..2ef07f59 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/element.rb @@ -0,0 +1,173 @@ +# WSDL4R - XMLSchema element definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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_accessor :maxoccurs + attr_accessor :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 :nillable + attr_reader_ref :default + attr_reader_ref :abstract + + 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 + @default = nil + @abstract = false + @ref = nil + @refelement = nil + end + + def empty? + !(local_simpletype || local_complextype || constraint || type) + 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 + if @form != 'qualified' and @name.namespace + @name = XSD::QName.new(nil, @name.name) + end + @form + when TypeAttrName + @type = value + when RefAttrName + @ref = value + when MaxOccursAttrName + if parent.is_a?(All) + if value.source != '1' + raise Parser::AttributeConstraintError.new( + "cannot parse #{value} for #{attr}") + end + end + if value.source == 'unbounded' + @maxoccurs = nil + else + @maxoccurs = Integer(value.source) + end + value.source + when MinOccursAttrName + if parent.is_a?(All) + unless ['0', '1'].include?(value.source) + raise Parser::AttributeConstraintError.new( + "cannot parse #{value} for #{attr}") + end + end + @minoccurs = Integer(value.source) + when NillableAttrName + @nillable = to_boolean(value) + when DefaultAttrName + @default = value.source + when AbstractAttrName + @abstract = to_boolean(value) + else + nil + end + end + +private + + def directelement? + parent.is_a?(Schema) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/enumeration.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/enumeration.rb new file mode 100644 index 00000000..592c2c2f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/enumeration.rb @@ -0,0 +1,36 @@ +# WSDL4R - XMLSchema enumeration definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/fractiondigits.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/fractiondigits.rb new file mode 100644 index 00000000..d0c5a2c7 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/fractiondigits.rb @@ -0,0 +1,37 @@ +# WSDL4R - XMLSchema fractionDigits definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 FractionDigits < Info + def initialize + super + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when FixedAttrName + parent.fixed[:fractiondigits] = to_boolean(value) + when ValueAttrName + parent.fractiondigits = to_int(value) + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/group.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/group.rb new file mode 100644 index 00000000..a5702844 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/group.rb @@ -0,0 +1,118 @@ +# WSDL4R - XMLSchema group definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 Group < 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_accessor :maxoccurs + attr_accessor :minoccurs + attr_writer :content + + attr_reader_ref :name + attr_reader_ref :content + + attr_accessor :ref + + def initialize(name = nil) + super() + @name = name + @maxoccurs = 1 + @minoccurs = 1 + @content = nil + @ref = nil + @refelement = nil + end + + def refelement + @refelement ||= (@ref ? root.collect_modelgroups[@ref] : nil) + end + + def targetnamespace + parent.targetnamespace + end + + def elementformdefault + parent.elementformdefault + end + + def parse_element(element) + case element + when AllName + @content = All.new + when SequenceName + @content = Sequence.new + when ChoiceName + @content = Choice.new + else + nil + end + end + + def parse_attr(attr, value) + case attr + when NameAttrName + @name = XSD::QName.new(targetnamespace, value.source) + when RefAttrName + @ref = value + when MaxOccursAttrName + if parent.is_a?(All) + if value.source != '1' + raise Parser::AttributeConstraintError.new( + "cannot parse #{value} for #{attr}") + end + end + if value.source == 'unbounded' + @maxoccurs = nil + else + @maxoccurs = Integer(value.source) + end + value.source + when MinOccursAttrName + if parent.is_a?(All) + unless ['0', '1'].include?(value.source) + raise Parser::AttributeConstraintError.new( + "cannot parse #{value} for #{attr}") + end + end + @minoccurs = Integer(value.source) + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/import.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/import.rb new file mode 100644 index 00000000..b17d3a5a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/import.rb @@ -0,0 +1,53 @@ +# WSDL4R - XMLSchema import definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' +require 'wsdl/xmlSchema/importHandler' + + +module WSDL +module XMLSchema + + +class Import < Info + attr_reader :namespace + + def initialize + super + @namespace = nil + @handler = ImportHandler.new + end + + def schemalocation + @handler.schemalocation + end + + def content + @handler.content + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when NamespaceAttrName + @namespace = value.source + when SchemaLocationAttrName + @handler.parse_schemalocation(value.source, root, parent) + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importHandler.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importHandler.rb new file mode 100644 index 00000000..b6fb39da --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importHandler.rb @@ -0,0 +1,45 @@ +# WSDL4R - XMLSchema import handler. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 ImportHandler + attr_reader :schemalocation + attr_reader :content + + def initialize + @schemalocation = nil + @content = nil + end + + def parse_schemalocation(location, root, parent) + @schemalocation = URI.parse(location) + 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 = Importer.import(@schemalocation, root) + root.importedschema[@schemalocation] = @content + end + @schemalocation + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb new file mode 100644 index 00000000..20e5eda6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb @@ -0,0 +1,102 @@ +# WSDL4R - XSD importer library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' +require 'wsdl/xmlSchema/parser' + + +module WSDL +module XMLSchema + + +class Importer + DO_NOT_IMPORT = [::SOAP::EncodingNamespace] + + def self.import(location, originalroot = nil) + new.import(location, originalroot) + end + + def initialize + @web_client = nil + end + + def import(location, originalroot = nil) + if DO_NOT_IMPORT.include?(location.to_s) + return nil + end + unless location.is_a?(URI) + location = URI.parse(location) + end + source, normalizedlocation = fetch(location) + content = parse(source, normalizedlocation, originalroot) + content.location = normalizedlocation + 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 + normalizedlocation = location + if location.scheme == 'file' or + (location.relative? and FileTest.exist?(location.path)) + content = File.open(location.path).read + normalizedlocation = URI.parse('file://' + File.expand_path(location.path)) + 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) + http_opt = opt["client.protocol.http"] + ::SOAP::HTTPConfigLoader.set_options(client, http_opt) if http_opt + end + content = client.get_content(location) + end + return content, normalizedlocation + end + + def web_client + return @web_client if @web_client + begin + require 'httpclient' + @web_client = HTTPClient + rescue LoadError + begin + require 'http-access2' + if HTTPAccess2::VERSION < "2.0" + raise LoadError.new("http-access/2.0 or later is required.") + end + @web_client = HTTPAccess2::Client + rescue LoadError + warn("Loading http-access2 failed. Net/http is used.") if $DEBUG + require 'soap/netHttpClient' + @web_client = ::SOAP::NetHttpClient + end + end + @web_client + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/include.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/include.rb new file mode 100644 index 00000000..13dfa518 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/include.rb @@ -0,0 +1,48 @@ +# WSDL4R - XMLSchema include definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' +require 'wsdl/xmlSchema/importHandler' + + +module WSDL +module XMLSchema + + +class Include < Info + def initialize + super + @handler = ImportHandler.new + end + + def schemalocation + @handler.schemalocation + end + + def content + @handler.content + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when SchemaLocationAttrName + @handler.parse_schemalocation(value.source, root, parent) + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/length.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/length.rb new file mode 100644 index 00000000..71fba884 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/length.rb @@ -0,0 +1,37 @@ +# WSDL4R - XMLSchema length definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 FixedAttrName + parent.fixed[:length] = to_boolean(value) + when ValueAttrName + parent.length = to_int(value) + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/list.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/list.rb new file mode 100644 index 00000000..7d5ecece --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/list.rb @@ -0,0 +1,48 @@ +# WSDL4R - XMLSchema list definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 List < Info + attr_reader :itemtype + attr_reader :local_simpletype + + def initialize + super() + @itemtype = nil + @local_simpletype = nil + end + + def parse_element(element) + case element + when SimpleTypeName + @local_simpletype = SimpleType.new + @local_simpletype + else + nil + end + end + + def parse_attr(attr, value) + case attr + when ItemTypeAttrName + @itemtype = value + else + nil + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxexclusive.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxexclusive.rb new file mode 100644 index 00000000..41df4967 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxexclusive.rb @@ -0,0 +1,37 @@ +# WSDL4R - XMLSchema maxExclusive definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 MaxExclusive < Info + def initialize + super + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when FixedAttrName + parent.fixed[:maxexclusive] = to_boolean(value) + when ValueAttrName + parent.maxexclusive = value.source + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxinclusive.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxinclusive.rb new file mode 100644 index 00000000..3be8e2c9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxinclusive.rb @@ -0,0 +1,37 @@ +# WSDL4R - XMLSchema maxInclusive definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 MaxInclusive < Info + def initialize + super + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when FixedAttrName + parent.fixed[:maxinclusive] = to_boolean(value) + when ValueAttrName + parent.maxinclusive = value.source + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxlength.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxlength.rb new file mode 100644 index 00000000..d35e01b2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/maxlength.rb @@ -0,0 +1,37 @@ +# WSDL4R - XMLSchema maxLength definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 MaxLength < Info + def initialize + super + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when FixedAttrName + parent.fixed[:maxlength] = to_boolean(value) + when ValueAttrName + parent.maxlength = to_int(value) + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minexclusive.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minexclusive.rb new file mode 100644 index 00000000..8621349d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minexclusive.rb @@ -0,0 +1,37 @@ +# WSDL4R - XMLSchema minExclusive definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 MinExclusive < Info + def initialize + super + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when FixedAttrName + parent.fixed[:minexclusive] = to_boolean(value) + when ValueAttrName + parent.minexclusive = value.source + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/mininclusive.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/mininclusive.rb new file mode 100644 index 00000000..2a3f68de --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/mininclusive.rb @@ -0,0 +1,37 @@ +# WSDL4R - XMLSchema minInclusive definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 MinInclusive < Info + def initialize + super + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when FixedAttrName + parent.fixed[:mininclusive] = to_boolean(value) + when ValueAttrName + parent.mininclusive = value.source + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minlength.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minlength.rb new file mode 100644 index 00000000..e10a1f1a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/minlength.rb @@ -0,0 +1,37 @@ +# WSDL4R - XMLSchema minLength definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 MinLength < Info + def initialize + super + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when FixedAttrName + parent.fixed[:minlength] = to_boolean(value) + when ValueAttrName + parent.minlength = to_int(value) + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/parser.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/parser.rb new file mode 100644 index 00000000..746b6bb0 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/parser.rb @@ -0,0 +1,167 @@ +# WSDL4R - WSDL XML Instance parser library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + parent = lastframe.node + else + ns = XSD::NS.new + parent = nil + end + # ns might be the same + ns, 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 + if o.nil? + 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, false) + value_ele.source = value # for recovery; value may not be a QName + if attr_ele == IdAttrName + o.id = value_ele + else + if o.parse_attr(attr_ele, value_ele).nil? + 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/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/pattern.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/pattern.rb new file mode 100644 index 00000000..160636cc --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/pattern.rb @@ -0,0 +1,36 @@ +# WSDL4R - XMLSchema pattern definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/schema.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/schema.rb new file mode 100644 index 00000000..841f6a9a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/schema.rb @@ -0,0 +1,178 @@ +# WSDL4R - XMLSchema schema definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 :modelgroups + attr_reader :attributegroups + attr_reader :imports + attr_accessor :attributeformdefault + attr_accessor :elementformdefault + attr_accessor :version + + attr_reader :importedschema + + def initialize + super + @targetnamespace = nil + @complextypes = XSD::NamedElements.new + @simpletypes = XSD::NamedElements.new + @elements = XSD::NamedElements.new + @attributes = XSD::NamedElements.new + @modelgroups = XSD::NamedElements.new + @attributegroups = XSD::NamedElements.new + @imports = [] + @attributeformdefault = "unqualified" + @elementformdefault = "unqualified" + @importedschema = {} + @location = nil + @root = self + @version = nil + 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 + o.form = 'qualified' # root element is qualified + @elements << o + o + when AttributeName + o = Attribute.new + @attributes << o + o + when GroupName + o = Group.new + @modelgroups << o + o + when AttributeGroupName + o = AttributeGroup.new + @attributegroups << 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 + when VersionAttrName + @version = 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_modelgroups + result = XSD::NamedElements.new + result.concat(@modelgroups) + @imports.each do |import| + result.concat(import.content.collect_modelgroups) if import.content + end + result + end + + def collect_attributegroups + result = XSD::NamedElements.new + result.concat(@attributegroups) + @imports.each do |import| + result.concat(import.content.collect_attributegroups) 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/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/sequence.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/sequence.rb new file mode 100644 index 00000000..a1835ddb --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/sequence.rb @@ -0,0 +1,54 @@ +# WSDL4R - XMLSchema complexType definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/content' + + +module WSDL +module XMLSchema + + +class Sequence < Content + attr_reader :any + + def initialize + super() + @any = nil + end + + def have_any? + !!@any + end + + def parse_element(element) + case element + when SequenceName + o = Sequence.new + @elements << o + o + when ChoiceName + o = Choice.new + @elements << o + o + when GroupName + o = Group.new + @elements << o + o + when AnyName + @any = Any.new + @elements << @any + @any + else + super(element) + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleContent.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleContent.rb new file mode 100644 index 00000000..9740d3e3 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleContent.rb @@ -0,0 +1,69 @@ +# WSDL4R - XMLSchema simpleContent definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 attributes + content.attributes + 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/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleExtension.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleExtension.rb new file mode 100644 index 00000000..4a63deb4 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleExtension.rb @@ -0,0 +1,62 @@ +# WSDL4R - XMLSchema simpleType extension definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + when AttributeGroupName + o = AttributeGroup.new + @attributes << o + o + when AnyAttributeName + o = AnyAttribute.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/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleRestriction.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleRestriction.rb new file mode 100644 index 00000000..6a7914ec --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleRestriction.rb @@ -0,0 +1,132 @@ +# WSDL4R - XMLSchema simpleContent restriction definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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_accessor :length + attr_accessor :minlength + attr_accessor :maxlength + attr_accessor :pattern + attr_reader :enumeration + attr_accessor :whitespace + attr_accessor :maxinclusive + attr_accessor :maxexlusive + attr_accessor :minexlusive + attr_accessor :mininclusive + attr_accessor :totaldigits + attr_accessor :fractiondigits + attr_reader :fixed + attr_reader :attributes + + def initialize + super + @base = nil + @enumeration = [] # NamedElements? + @length = nil + @maxlength = nil + @minlength = nil + @pattern = nil + @fixed = {} + @attributes = XSD::NamedElements.new + end + + def valid?(value) + return false unless check_restriction(value) + return false unless check_length(value) + return false unless check_maxlength(value) + return false unless check_minlength(value) + return false unless check_pattern(value) + true + end + + def enumeration? + !@enumeration.empty? + end + + def parse_element(element) + case element + when LengthName + Length.new + when MinLengthName + MinLength.new + when MaxLengthName + MaxLength.new + when PatternName + Pattern.new + when EnumerationName + Enumeration.new + when WhiteSpaceName + WhiteSpace.new + when MaxInclusiveName + MaxInclusive.new + when MaxExclusiveName + MaxExlusive.new + when MinExclusiveName + MinExlusive.new + when MinInclusiveName + MinInclusive.new + when TotalDigitsName + TotalDigits.new + when FractionDigitsName + FractionDigits.new + when AttributeName + o = Attribute.new + @attributes << o + o + when AttributeGroupName + o = AttributeGroup.new + @attributes << o + o + when AnyAttributeName + o = AnyAttribute.new + @attributes << o + o + 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_maxlength(value) + @maxlength.nil? or value.size <= @maxlength + end + + def check_minlength(value) + @minlength.nil? or value.size >= @minlength + end + + def check_pattern(value) + @pattern.nil? or @pattern =~ value + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleType.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleType.rb new file mode 100644 index 00000000..a10420dd --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/simpleType.rb @@ -0,0 +1,87 @@ +# WSDL4R - XMLSchema simpleType definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + attr_reader :list + attr_reader :union + + def check_lexical_format(value) + if @restriction + check_restriction(value) + elsif @list + # TODO: check + elsif @union + # TODO: check + else + raise ArgumentError.new("incomplete simpleType") + end + end + + def base + if @restriction + @restriction.base + else + nil + end + end + + def initialize(name = nil) + super() + @name = name + @restriction = nil + @list = nil + @union = nil + end + + def targetnamespace + parent.targetnamespace + end + + def parse_element(element) + case element + when RestrictionName + @restriction = SimpleRestriction.new + @restriction + when ListName + @list = List.new + @list + when UnionName + @union = Union.new + @union + 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/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/totaldigits.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/totaldigits.rb new file mode 100644 index 00000000..46694736 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/totaldigits.rb @@ -0,0 +1,37 @@ +# WSDL4R - XMLSchema totalDigits definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 TotalDigits < Info + def initialize + super + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when FixedAttrName + parent.fixed[:totaldigits] = to_boolean(value) + when ValueAttrName + parent.totaldigits = to_int(value) + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/union.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/union.rb new file mode 100644 index 00000000..57fdd465 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/union.rb @@ -0,0 +1,35 @@ +# WSDL4R - XMLSchema union definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 Union < Info + attr_reader :member_types + + def initialize + super + @member_types = nil + end + + def parse_attr(attr, value) + case attr + when MemberTypesAttrName + @member_types = value.source + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/unique.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/unique.rb new file mode 100644 index 00000000..d872a435 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/unique.rb @@ -0,0 +1,34 @@ +# WSDL4R - XMLSchema unique element. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/whitespace.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/whitespace.rb new file mode 100644 index 00000000..54f14708 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/whitespace.rb @@ -0,0 +1,37 @@ +# WSDL4R - XMLSchema whiteSpace definition for WSDL. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 WhiteSpace < Info + def initialize + super + end + + def parse_element(element) + nil + end + + def parse_attr(attr, value) + case attr + when FixedAttrName + parent.fixed[:whitespace] = to_boolean(value) + when ValueAttrName + parent.whitespace = value.source + end + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/xsd2ruby.rb b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/xsd2ruby.rb new file mode 100644 index 00000000..69db7760 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/xsd2ruby.rb @@ -0,0 +1,174 @@ +# XSD4R - XSD to ruby mapping library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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' +require 'wsdl/soap/classDefCreatorSupport' +require 'wsdl/soap/literalMappingRegistryCreator' +require 'wsdl/soap/classNameCreator' +require 'logger' + + +module WSDL +module XMLSchema + + +class XSD2Ruby + include WSDL::SOAP::ClassDefCreatorSupport + + 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 = @opt['classdef'] || create_classname(@xsd) + create_file + end + +private + + def initialize + @location = nil + @opt = {} + @logger = Logger.new(STDERR) + @basedir = nil + @xsd = nil + @name = nil + @name_creator = WSDL::SOAP::ClassNameCreator.new + end + + def create_file + @modulepath = @opt['module_path'] + create_classdef if @opt.key?('classdef') + create_mapping_registry if @opt.key?('mapping_registry') + create_mapper if @opt.key?('mapper') + 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, @name_creator, @modulepath).dump + end + end + + def create_mapping_registry + @logger.info { "Creating mapping registry definition." } + @mr_filename = @name + '_mapping_registry.rb' + check_file(@mr_filename) or return + write_file(@mr_filename) do |f| + f << dump_mapping_registry + end + end + + def create_mapper + @logger.info { "Creating mapper definition." } + @mapper_filename = @name + '_mapper.rb' + check_file(@mapper_filename) or return + write_file(@mapper_filename) do |f| + f << dump_mapper + end + end + + def dump_mapping_registry + defined_const = {} + creator = WSDL::SOAP::LiteralMappingRegistryCreator.new(@xsd, @name_creator, @modulepath, defined_const) + module_name = XSD::CodeGen::GenSupport.safeconstname(@name + 'MappingRegistry') + if @modulepath + module_name = [@modulepath, module_name].join('::') + end + m = XSD::CodeGen::ModuleDef.new(module_name) + m.def_require("xsd/mapping") + m.def_require("#{@classdef_filename}") + varname = 'Registry' + m.def_const(varname, '::SOAP::Mapping::LiteralRegistry.new') + m.def_code(creator.dump(varname)) + # + defined_const.each do |ns, tag| + m.def_const(tag, dq(ns)) + end + m.dump + end + + def dump_mapper + class_name = XSD::CodeGen::GenSupport.safeconstname(@name + 'Mapper') + if @modulepath + class_name = [@modulepath, class_name].join('::') + end + mr_name = XSD::CodeGen::GenSupport.safeconstname(@name + 'MappingRegistry') + c = XSD::CodeGen::ClassDef.new(class_name, 'XSD::Mapping::Mapper') + c.def_require("#{@mr_filename}") + c.def_method("initialize") do + "super(#{mr_name}::Registry)" + end + c.dump + 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 + + +if __FILE__ == $0 + warn("WARNING: #{File.expand_path(__FILE__)} is a library file used by bin/xsd2ruby.rb. Find bin/xsd2ruby.rb from tarball version of soap4r or install soap4r via gem.") +end diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/charset.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/charset.rb new file mode 100644 index 00000000..7bee2004 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/charset.rb @@ -0,0 +1,189 @@ +# XSD4R - Charset handling library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 = $KCODE + + 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_ISO_8859_1']] = + Proc.new { |str| str.unpack('U*').pack('C*') } + EncodingConvertMap[['X_ISO_8859_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, + } + + CharsetStrCache = {} + + + ### + ## 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) + CharsetStrCache[label] ||= CharsetMap.key(label.downcase) || 'X_UNKNOWN' + else + CharsetStrCache[label] ||= 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 = @internal_encoding) + 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/vendor/gems/soap4r-1.5.8/lib/xsd/codegen.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen.rb new file mode 100644 index 00000000..4f71f0ee --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen.rb @@ -0,0 +1,12 @@ +# XSD4R - Generating code library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/classdef.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/classdef.rb new file mode 100644 index 00000000..00eaaad8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/classdef.rb @@ -0,0 +1,208 @@ +# XSD4R - Generating class definition code +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 @innermodule.empty? + buf << dump_emptyline # always add 1 empty line + spacer = true + buf << dump_innermodule + 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/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/commentdef.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/commentdef.rb new file mode 100644 index 00000000..13b074b6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/commentdef.rb @@ -0,0 +1,34 @@ +# XSD4R - Generating comment definition code +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb new file mode 100644 index 00000000..4a2f8dd0 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/gensupport.rb @@ -0,0 +1,273 @@ +# XSD4R - Code generation support +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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. +KEYWORDS = {} +%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| KEYWORDS[k] = nil } + +# from Module.constants from 1.8 & 1.9 +CONSTANTS = {} +%w( +ARGF +ARGV +ArgumentError +Array +BasicObject +Bignum +Binding +Class +Comparable +Continuation +Data +Dir +ENV +EOFError +Enumerable +Errno +Exception +FALSE +FalseClass +File +FileTest +Fixnum +Float +FloatDomainError +GC +Hash +IO +IOError +IndexError +Integer +Interrupt +Kernel +KeyError +LoadError +LocalJumpError +Marshal +MatchData +MatchingData +Math +Method +Module +Mutex +NIL +NameError +NilClass +NoMemoryError +NoMethodError +NotImplementedError +Numeric +Object +ObjectSpace +PLATFORM +Precision +Proc +Process +RELEASE_DATE +RUBY_PATCHLEVEL +RUBY_PLATFORM +RUBY_RELEASE_DATE +RUBY_VERSION +Range +RangeError +Regexp +RegexpError +RuntimeError +STDERR +STDIN +STDOUT +ScriptError +SecurityError +Signal +SignalException +StandardError +String +Struct +Symbol +SyntaxError +SystemCallError +SystemExit +SystemStackError +TOPLEVEL_BINDING +TRUE +Thread +ThreadError +ThreadGroup +Time +TrueClass +TypeError +UnboundMethod +VERSION +VM +ZeroDivisionError +).each { |c| CONSTANTS[c] = nil } + + +module GenSupport + def capitalize(target) + target.sub(/^([a-z])/) { $1.upcase } + end + module_function :capitalize + + def uncapitalize(target) + target.sub(/^([A-Z])/) { $1.downcase } + end + module_function :uncapitalize + + def safeconstname(name) + safename = name.scan(/[a-zA-Z0-9_]+/).collect { |ele| + GenSupport.capitalize(ele) + }.join + if /\A[A-Z]/ !~ safename or keyword?(safename) or constant?(safename) + "C_#{safename}" + else + safename + end + 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) + postfix = name[/[=?!]$/] + safename = name.scan(/[a-zA-Z0-9_]+/).join('_') + safename = uncapitalize(safename) + safename += postfix if postfix + if /\A[a-z]/ !~ safename or keyword?(safename) + "m_#{safename}" + else + safename + end + end + module_function :safemethodname + + def safemethodname?(name) + /\A[a-zA-Z_][a-zA-Z0-9_]*[=!?]?\z/ =~ name and !keyword?(name) + end + module_function :safemethodname? + + def safevarname(name) + safename = uncapitalize(name.scan(/[a-zA-Z0-9_]+/).join('_')) + if /\A[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) + KEYWORDS.key?(word) + end + module_function :keyword? + + def constant?(word) + CONSTANTS.key?(word) + end + module_function :constant? + + 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.collect { |line| + line.sub(/\r?\n\z/, "") + "\n" + }.join + end + + def trim_indent(str) + indent = nil + str = str.collect { |line| untab(line) }.join + str.each do |line| + head = line.index(/\S/) + if !head.nil? and (indent.nil? or head < indent) + indent = head + end + end + return str unless indent + str.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/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/methoddef.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/methoddef.rb new file mode 100644 index 00000000..72d24a6c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/methoddef.rb @@ -0,0 +1,70 @@ +# XSD4R - Generating method definition code +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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) + klass, mname = name.split('.', 2) + if mname.nil? + mname, klass = klass, mname + end + unless safemethodname?(mname) + raise ArgumentError.new("name '#{name}' seems to be unsafe") + end + if klass and klass != 'self' and !safeconstname(klass) + 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/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/moduledef.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/moduledef.rb new file mode 100644 index 00000000..abea6259 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/codegen/moduledef.rb @@ -0,0 +1,208 @@ +# XSD4R - Generating module definition code +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + + attr_reader :name + attr_reader :innermodule + + def initialize(name) + @name = name + @comment = nil + @const = [] + @code = [] + @requirepath = [] + @methoddef = [] + @innermodule = [] + 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 @innermodule.empty? + buf << dump_emptyline # always add 1 empty line + spacer = true + buf << dump_innermodule + 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_innermodule + dump_static( + @innermodule.collect { |moduledef| + moduledef.dump + }.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/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes.rb new file mode 100644 index 00000000..d5ef2ccc --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes.rb @@ -0,0 +1,1466 @@ +# XSD4R - XML Schema Datatype implementation. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 'soap/nestedexception' +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' +TokenLiteral = 'token' +LanguageLiteral = 'language' +NMTOKENLiteral = 'NMTOKEN' +NMTOKENSLiteral = 'NMTOKENS' +NameLiteral = 'Name' +NCNameLiteral = 'NCName' +IDLiteral = 'ID' +IDREFLiteral = 'IDREF' +IDREFSLiteral = 'IDREFS' +ENTITYLiteral = 'ENTITY' +ENTITIESLiteral = '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; include ::SOAP::NestedException; 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 + + @@strict_ces_validation = false + + def self.strict_ces_validation=(strict_ces_validation) + @@strict_ces_validation = strict_ces_validation + end + + def self.strict_ces_validation + @@strict_ces_validation + end + +private + + def screen_data(value) + if ::XSD::XSDString.strict_ces_validation + externalces = XSD::Charset.encoding + unless XSD::Charset.is_ces(value, externalces) + raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.") + end + 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 !$6 and !$7 and !$8 + # allows durations lower than a day such as 'PT5S'. + 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 + unless r.empty? + str << "T" << r + end + if l.empty? and r.empty? + str << "0D" + end + str + end +end + + +require 'rational' +require 'date' + +module XSDDateTimeImpl + DayInSec = 86400 # 24 * 60 * 60 + DayInMicro = 86400_000_000 + + 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 * DayInSec == Time.now.utc_offset + d = @data + usec = (d.sec_fraction * DayInMicro).round + Time.local(d.year, d.month, d.mday, d.hour, d.min, d.sec, usec) + else + d = @data.newof + usec = (d.sec_fraction * DayInMicro).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 / DayInMicro + of = t.utc_offset.to_r / DayInSec + 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) / DayInSec + 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 * DayInSec).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) / DayInSec + 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 * DayInSec).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) + super + if /[\t\r\n]/ =~ value + raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.") + end + value + end +end + +class XSDToken < XSDNormalizedString + Type = QName.new(Namespace, TokenLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + super + if /\A / =~ value or / \Z/ =~ value or value.index(' ') + raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.") + end + value + end +end + +class XSDLanguage < XSDToken + Type = QName.new(Namespace, LanguageLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + super + # RFC 3066 syntax check + if /\A[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})?\z/ !~ value + raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.") + end + value + end +end + +class XSDNMTOKEN < XSDToken + Type = QName.new(Namespace, NMTOKENLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + super + # TODO: check lexical space and convert to a value + value + end +end + +class XSDNMTOKENS < XSDNMTOKEN + Type = QName.new(Namespace, NMTOKENSLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + # derived by list + # TODO: check lexical space and convert to a value + value + end +end + +class XSDName < XSDToken + Type = QName.new(Namespace, NameLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + super + # TODO: check lexical space and convert to a value + value + end +end + +class XSDNCName < XSDName + Type = QName.new(Namespace, NCNameLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + super + # TODO: check lexical space and convert to a value + value + end +end + +class XSDID < XSDNCName + Type = QName.new(Namespace, IDLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + super + # TODO: check lexical space and convert to a value + value + end +end + +class XSDIDREF < XSDNCName + Type = QName.new(Namespace, IDREFLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + super + # TODO: check lexical space and convert to a value + value + end +end + +class XSDIDREFS < XSDIDREF + Type = QName.new(Namespace, IDREFSLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + # derived by list + # TODO: check lexical space and convert to a value + value + end +end + +class XSDENTITY < XSDNCName + Type = QName.new(Namespace, ENTITYLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + super + # TODO: check lexical space and convert to a value + value + end +end + +class XSDENTITIES < XSDENTITY + Type = QName.new(Namespace, ENTITIESLiteral) + + def initialize(value = nil) + init(Type, value) + end + +private + + def screen_data(value) + # derived by list + # TODO: check lexical space and convert to a value + value + 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/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes1999.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes1999.rb new file mode 100644 index 00000000..5387ce02 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/datatypes1999.rb @@ -0,0 +1,20 @@ +# XSD4R - XML Schema Datatype 1999 support +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/xsd/iconvcharset.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/iconvcharset.rb new file mode 100644 index 00000000..57733a82 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/iconvcharset.rb @@ -0,0 +1,33 @@ +# XSD4R - Charset handling with iconv. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/xsd/mapping.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/mapping.rb new file mode 100644 index 00000000..1cba775d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/mapping.rb @@ -0,0 +1,67 @@ +# XSD4R - XML Mapping for Ruby +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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::LiteralRegistry.new + + def self.obj2xml(obj, elename = nil, io = nil) + Mapper.new(MappingRegistry).obj2xml(obj, elename, io) + end + + def self.xml2obj(stream, klass = nil) + Mapper.new(MappingRegistry).xml2obj(stream, klass) + end + + class Mapper + MAPPING_OPT = { + :default_encodingstyle => SOAP::LiteralNamespace, + :root_type_hint => true + }.freeze + + def initialize(registry) + @registry = registry + end + + def obj2xml(obj, elename = nil, io = nil) + opt = MAPPING_OPT.dup + unless elename + if definition = @registry.elename_schema_definition_from_class(obj.class) + elename = definition.elename + opt[:root_type_hint] = false + end + end + elename = SOAP::Mapping.to_qname(elename) if elename + soap = SOAP::Mapping.obj2soap(obj, @registry, elename, opt) + if soap.elename.nil? or soap.elename == XSD::QName::EMPTY + soap.elename = + XSD::QName.new(nil, SOAP::Mapping.name2elename(obj.class.to_s)) + end + generator = SOAP::Generator.new(opt) + generator.generate(soap, io) + end + + def xml2obj(stream, klass = nil) + parser = SOAP::Parser.new(MAPPING_OPT) + soap = parser.parse(stream) + SOAP::Mapping.soap2obj(soap, @registry, klass) + end + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/namedelements.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/namedelements.rb new file mode 100644 index 00000000..e7900d30 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/namedelements.rb @@ -0,0 +1,132 @@ +# XSD4R - WSDL named element collection. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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) + rv = @elements.delete(rhs) + @cache.clear + rv + end + + def +(rhs) + o = NamedElements.new + o.elements = @elements + rhs.elements + @cache.clear + o + end + + def concat(rhs) + @elements.concat(rhs.elements) + @cache.clear + self + end + + def uniq + o = NamedElements.new + o.elements = uniq_elements + o + end + + def uniq! + @elements.replace(uniq_elements) + @cache.clear + end + + def find_all + o = NamedElements.new + each do |ele| + o << ele if yield(ele) + end + o + end + + Empty = NamedElements.new.freeze + +protected + + def elements=(rhs) + @elements = rhs + end + + def elements + @elements + end + +private + + def uniq_elements + dict = {} + elements = [] + @elements.each do |ele| + unless dict.key?(ele.name) + dict[ele.name] = ele + elements << ele + end + end + elements + end +end + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/ns.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/ns.rb new file mode 100644 index 00000000..f4daf811 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/ns.rb @@ -0,0 +1,182 @@ +# XSD4R - XML Schema Namespace library +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + Namespace = 'http://www.w3.org/XML/1998/namespace' + + KNOWN_TAG = { + XSD::Namespace => 'xsd', + XSD::InstanceNamespace => 'xsi', + } + + class Assigner + attr_reader :known_tag + + def initialize(known_tag) + @known_tag = known_tag.dup + @count = 0 + end + + def assign(ns) + if @known_tag.key?(ns) + return @known_tag[ns] + end + @count += 1 + "n#{@count}" + end + end + + attr_reader :default_namespace + + class FormatError < Error; end + +public + + def initialize(tag2ns = nil) + @tag2ns = tag2ns || ns_default + @ns2tag = @tag2ns.invert + @assigner = nil + @default_namespace = nil + end + + def known_tag + @assigner ||= Assigner.new(default_known_tag) + @assigner.known_tag + end + + def assign(ns, tag = nil) + if tag == '' + if ns.empty? + @default_namespace = nil + else + @default_namespace = ns + end + tag + else + @assigner ||= Assigner.new(default_known_tag) + 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_as_tagged?(ns) + @ns2tag.key?(ns) + end + + def assigned_tag?(tag) + @tag2ns.key?(tag) + end + + def clone_ns + cloned = self.class.new(@tag2ns.dup) + cloned.assigner = @assigner + cloned.assign(@default_namespace, '') if @default_namespace + cloned + end + + def name(qname) + if qname.namespace == @default_namespace + qname.name + elsif tag = @ns2tag[qname.namespace] + "#{tag}:#{qname.name}" + else + raise FormatError.new("namespace: #{qname.namespace} not defined yet") + end + end + + # no default namespace + def name_attr(qname) + if tag = @ns2tag[qname.namespace] + "#{tag}:#{qname.name}" + else + raise FormatError.new("namespace: #{qname.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('\A([^:]+)(?::(.+))?\z', nil, 'NONE') + + 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 + # + # => + # {}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 + +private + + def ns_default + {'xml' => Namespace} + end + + def default_known_tag + KNOWN_TAG + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/qname.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/qname.rb new file mode 100644 index 00000000..aeef79a2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/qname.rb @@ -0,0 +1,79 @@ +# XSD4R - XML QName definition. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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_reader :namespace + attr_reader :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(predefined_ns = nil) + ns = predefined_ns + 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/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb new file mode 100644 index 00000000..07b978bd --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb @@ -0,0 +1,75 @@ +# XSD4R - XML Instance parser library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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:?(.*)$', nil, 'NONE') + + def filter_ns(ns, attrs) + ns_updated = false + if attrs.nil? or attrs.empty? + return [ns, attrs] + end + newattrs = {} + attrs.each do |key, value| + if NSParseRegexp =~ key + unless ns_updated + ns = ns.clone_ns + ns_updated = true + end + # tag == '' means 'default namespace' + # value == '' means 'no default namespace' + tag = $1 || '' + ns.assign(value, tag) + else + newattrs[key] = value + end + end + return [ns, 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 + # XXX: for a workaround of rubygems' require inconsistency + # XXX: MUST BE REMOVED IN THE FUTURE + name = lib.sub(/^.*\//, '') + raise LoadError unless XSD::XMLParser.constants.find { |c| + c.downcase == name + } + loaded = true + break + rescue LoadError + end +end +unless loaded + raise RuntimeError.new("XML processor module not found.") +end diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/parser.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/parser.rb new file mode 100644 index 00000000..4bdd895f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/parser.rb @@ -0,0 +1,100 @@ +# XSD4R - XML Instance parser library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 + class ParserError < ParseError; end + + @@parser_factory = nil + + def self.factory + @@parser_factory + end + + def self.create_parser(host, opt = {}) + unless @@parser_factory + raise ParserError.new("illegal XML parser configuration") + end + @@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 ParserError.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/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/rexmlparser.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/rexmlparser.rb new file mode 100644 index 00000000..76ac75c8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/rexmlparser.rb @@ -0,0 +1,58 @@ +# XSD4R - REXMLParser XML parser library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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 cdata(content) + characters(content) + end + + def xmldecl(version, encoding, standalone) + # Version should be checked. + end + + add_factory(self) +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlparser.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlparser.rb new file mode 100644 index 00000000..c7a9f65a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlparser.rb @@ -0,0 +1,50 @@ +# XSD4R - XMLParser XML parser library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlscanner.rb b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlscanner.rb new file mode 100644 index 00000000..ed0d7d02 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/lib/xsd/xmlparser/xmlscanner.rb @@ -0,0 +1,149 @@ +# XSD4R - XMLScan XML parser library. +# Copyright (C) 2000-2007 NAKAMURA, Hiroshi . + +# 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) + characters(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/vendor/gems/soap4r-1.5.8/test/16runner.rb b/vendor/gems/soap4r-1.5.8/test/16runner.rb new file mode 100644 index 00000000..e714c92d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/16runner.rb @@ -0,0 +1,68 @@ +require 'test/unit/testsuite' +require 'test/unit/testcase' + +$KCODE = 'UTF8' + +rcsid = %w$Id: 16runner.rb 1541 2005-05-10 11:28:20Z nahi $ +Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze +Release = rcsid[3].freeze + +module Test + module Unit + module Assertions + alias assert_raise assert_raises + end + end +end + +class BulkTestSuite < Test::Unit::TestSuite + def self.suite + suite = Test::Unit::TestSuite.new + ObjectSpace.each_object(Class) do |klass| + suite << klass.suite if (Test::Unit::TestCase > klass) + end + suite + end +end + +runners_map = { + 'console' => proc do |suite| + require 'test/unit/ui/console/testrunner' + passed = Test::Unit::UI::Console::TestRunner.run(suite).passed? + exit(passed ? 0 : 1) + end, + 'gtk' => proc do |suite| + require 'test/unit/ui/gtk/testrunner' + Test::Unit::UI::GTK::TestRunner.run(suite) + end, + 'fox' => proc do |suite| + require 'test/unit/ui/fox/testrunner' + Test::Unit::UI::Fox::TestRunner.run(suite) + end, +} + +def test_require(list) + list.each do |tc_name| + if File.directory?(tc_name) + newlist = Dir.glob(File.join(tc_name, "**", "test_*.rb")).sort + test_require(newlist) + else + dir = File.expand_path(File.dirname(tc_name)) + backup = $:.dup + $:.push(dir) + require tc_name + $:.replace(backup) + end + end +end + +argv = ARGV +if argv.empty? + argv = Dir.glob(File.join(File.dirname(__FILE__), "**", "test_*.rb")).sort +end + +test_require(argv) + +runner = 'console' +GC.start +runners_map[runner].call(BulkTestSuite.suite) diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTest.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTest.rb new file mode 100644 index 00000000..51de2bb2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTest.rb @@ -0,0 +1,83 @@ +require 'xsd/qname' + +# {http://soapinterop.org/xsd}ArrayOfstring +class ArrayOfstring < ::Array + @@schema_type = "string" + @@schema_ns = "http://www.w3.org/2001/XMLSchema" +end + +# {http://soapinterop.org/xsd}ArrayOfint +class ArrayOfint < ::Array + @@schema_type = "int" + @@schema_ns = "http://www.w3.org/2001/XMLSchema" +end + +# {http://soapinterop.org/xsd}ArrayOffloat +class ArrayOffloat < ::Array + @@schema_type = "float" + @@schema_ns = "http://www.w3.org/2001/XMLSchema" +end + +# {http://soapinterop.org/xsd}ArrayOfSOAPStruct +class ArrayOfSOAPStruct < ::Array + @@schema_type = "SOAPStruct" + @@schema_ns = "http://soapinterop.org/xsd" +end + +# {http://soapinterop.org/xsd}SOAPStruct +class SOAPStruct + @@schema_type = "SOAPStruct" + @@schema_ns = "http://soapinterop.org/xsd" + @@schema_element = [["varString", "String"], ["varInt", "Int"], ["varFloat", "Float"]] + + attr_accessor :varString + attr_accessor :varInt + attr_accessor :varFloat + + def initialize(varString = nil, varInt = nil, varFloat = nil) + @varString = varString + @varInt = varInt + @varFloat = varFloat + end +end + +# {http://soapinterop.org/xsd}ArrayOfstring +class ArrayOfstring < ::Array + @@schema_type = "string" + @@schema_ns = "http://www.w3.org/2001/XMLSchema" +end + +# {http://soapinterop.org/xsd}ArrayOfint +class ArrayOfint < ::Array + @@schema_type = "int" + @@schema_ns = "http://www.w3.org/2001/XMLSchema" +end + +# {http://soapinterop.org/xsd}ArrayOffloat +class ArrayOffloat < ::Array + @@schema_type = "float" + @@schema_ns = "http://www.w3.org/2001/XMLSchema" +end + +# {http://soapinterop.org/xsd}ArrayOfSOAPStruct +class ArrayOfSOAPStruct < ::Array + @@schema_type = "SOAPStruct" + @@schema_ns = "http://soapinterop.org/xsd" +end + +# {http://soapinterop.org/xsd}SOAPStruct +class SOAPStruct + @@schema_type = "SOAPStruct" + @@schema_ns = "http://soapinterop.org/xsd" + @@schema_element = [["varString", "String"], ["varInt", "Int"], ["varFloat", "Float"]] + + attr_accessor :varString + attr_accessor :varInt + attr_accessor :varFloat + + def initialize(varString = nil, varInt = nil, varFloat = nil) + @varString = varString + @varInt = varInt + @varFloat = varFloat + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTest.wsdl b/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTest.wsdl new file mode 100644 index 00000000..21b57024 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTest.wsdl @@ -0,0 +1,315 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTestC.wsdl b/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTestC.wsdl new file mode 100644 index 00000000..1f1335af --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTestC.wsdl @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTestDriver.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTestDriver.rb new file mode 100644 index 00000000..6c579e1a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/InteropTestDriver.rb @@ -0,0 +1,327 @@ +require 'InteropTest.rb' + +require 'soap/rpc/driver' + +class InteropTestPortType < ::SOAP::RPC::Driver + DefaultEndpointUrl = "http://dev.ctor.org/soapsrv" + MappingRegistry = ::SOAP::Mapping::Registry.new + + MappingRegistry.set( + ArrayOfstring, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") } + ) + MappingRegistry.set( + ArrayOfint, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "int") } + ) + MappingRegistry.set( + ArrayOffloat, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "float") } + ) + MappingRegistry.set( + SOAPStruct, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://soapinterop.org/xsd", "SOAPStruct") } + ) + MappingRegistry.set( + ArrayOfSOAPStruct, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://soapinterop.org/xsd", "SOAPStruct") } + ) + + Methods = [ + ["echoString", "echoString", + [ + ["in", "inputString", ["::SOAP::SOAPString"]], + ["retval", "return", ["::SOAP::SOAPString"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoStringArray", "echoStringArray", + [ + ["in", "inputStringArray", ["String[]", "http://www.w3.org/2001/XMLSchema", "string"]], + ["retval", "return", ["String[]", "http://www.w3.org/2001/XMLSchema", "string"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoInteger", "echoInteger", + [ + ["in", "inputInteger", ["::SOAP::SOAPInt"]], + ["retval", "return", ["::SOAP::SOAPInt"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoIntegerArray", "echoIntegerArray", + [ + ["in", "inputIntegerArray", ["Integer[]", "http://www.w3.org/2001/XMLSchema", "int"]], + ["retval", "return", ["Integer[]", "http://www.w3.org/2001/XMLSchema", "int"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoFloat", "echoFloat", + [ + ["in", "inputFloat", ["::SOAP::SOAPFloat"]], + ["retval", "return", ["::SOAP::SOAPFloat"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoFloatArray", "echoFloatArray", + [ + ["in", "inputFloatArray", ["Float[]", "http://www.w3.org/2001/XMLSchema", "float"]], + ["retval", "return", ["Float[]", "http://www.w3.org/2001/XMLSchema", "float"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoStruct", "echoStruct", + [ + ["in", "inputStruct", ["SOAPStruct", "http://soapinterop.org/xsd", "SOAPStruct"]], + ["retval", "return", ["SOAPStruct", "http://soapinterop.org/xsd", "SOAPStruct"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoStructArray", "echoStructArray", + [ + ["in", "inputStructArray", ["SOAPStruct[]", "http://soapinterop.org/xsd", "SOAPStruct"]], + ["retval", "return", ["SOAPStruct[]", "http://soapinterop.org/xsd", "SOAPStruct"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoVoid", "echoVoid", + [], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoBase64", "echoBase64", + [ + ["in", "inputBase64", ["::SOAP::SOAPBase64"]], + ["retval", "return", ["::SOAP::SOAPBase64"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoDate", "echoDate", + [ + ["in", "inputDate", ["::SOAP::SOAPDateTime"]], + ["retval", "return", ["::SOAP::SOAPDateTime"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoHexBinary", "echoHexBinary", + [ + ["in", "inputHexBinary", ["::SOAP::SOAPHexBinary"]], + ["retval", "return", ["::SOAP::SOAPHexBinary"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoDecimal", "echoDecimal", + [ + ["in", "inputDecimal", ["::SOAP::SOAPDecimal"]], + ["retval", "return", ["::SOAP::SOAPDecimal"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoBoolean", "echoBoolean", + [ + ["in", "inputBoolean", ["::SOAP::SOAPBoolean"]], + ["retval", "return", ["::SOAP::SOAPBoolean"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ] + ] + + 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 |name_as, name, params, soapaction, namespace, style| + qname = XSD::QName.new(namespace, name_as) + if style == :document + @proxy.add_document_method(soapaction, name, params) + add_document_method_interface(name, params) + else + @proxy.add_rpc_method(qname, soapaction, name, params) + add_rpc_method_interface(name, params) + end + if name_as != name and name_as.capitalize == name.capitalize + ::SOAP::Mapping.define_singleton_method(self, name_as) do |*arg| + __send__(name, *arg) + end + end + end + end +end + +require 'soap/rpc/driver' + +class InteropTestPortType < ::SOAP::RPC::Driver + DefaultEndpointUrl = "http://dev.ctor.org/soapsrv" + MappingRegistry = ::SOAP::Mapping::Registry.new + + MappingRegistry.set( + ArrayOfstring, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") } + ) + MappingRegistry.set( + ArrayOfint, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "int") } + ) + MappingRegistry.set( + ArrayOffloat, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "float") } + ) + MappingRegistry.set( + SOAPStruct, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://soapinterop.org/xsd", "SOAPStruct") } + ) + MappingRegistry.set( + ArrayOfSOAPStruct, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://soapinterop.org/xsd", "SOAPStruct") } + ) + + Methods = [ + ["echoString", "echoString", + [ + ["in", "inputString", ["::SOAP::SOAPString"]], + ["retval", "return", ["::SOAP::SOAPString"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoStringArray", "echoStringArray", + [ + ["in", "inputStringArray", ["String[]", "http://www.w3.org/2001/XMLSchema", "string"]], + ["retval", "return", ["String[]", "http://www.w3.org/2001/XMLSchema", "string"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoInteger", "echoInteger", + [ + ["in", "inputInteger", ["::SOAP::SOAPInt"]], + ["retval", "return", ["::SOAP::SOAPInt"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoIntegerArray", "echoIntegerArray", + [ + ["in", "inputIntegerArray", ["Integer[]", "http://www.w3.org/2001/XMLSchema", "int"]], + ["retval", "return", ["Integer[]", "http://www.w3.org/2001/XMLSchema", "int"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoFloat", "echoFloat", + [ + ["in", "inputFloat", ["::SOAP::SOAPFloat"]], + ["retval", "return", ["::SOAP::SOAPFloat"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoFloatArray", "echoFloatArray", + [ + ["in", "inputFloatArray", ["Float[]", "http://www.w3.org/2001/XMLSchema", "float"]], + ["retval", "return", ["Float[]", "http://www.w3.org/2001/XMLSchema", "float"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoStruct", "echoStruct", + [ + ["in", "inputStruct", ["SOAPStruct", "http://soapinterop.org/xsd", "SOAPStruct"]], + ["retval", "return", ["SOAPStruct", "http://soapinterop.org/xsd", "SOAPStruct"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoStructArray", "echoStructArray", + [ + ["in", "inputStructArray", ["SOAPStruct[]", "http://soapinterop.org/xsd", "SOAPStruct"]], + ["retval", "return", ["SOAPStruct[]", "http://soapinterop.org/xsd", "SOAPStruct"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoVoid", "echoVoid", + [], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoBase64", "echoBase64", + [ + ["in", "inputBase64", ["::SOAP::SOAPBase64"]], + ["retval", "return", ["::SOAP::SOAPBase64"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoDate", "echoDate", + [ + ["in", "inputDate", ["::SOAP::SOAPDateTime"]], + ["retval", "return", ["::SOAP::SOAPDateTime"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoHexBinary", "echoHexBinary", + [ + ["in", "inputHexBinary", ["::SOAP::SOAPHexBinary"]], + ["retval", "return", ["::SOAP::SOAPHexBinary"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoDecimal", "echoDecimal", + [ + ["in", "inputDecimal", ["::SOAP::SOAPDecimal"]], + ["retval", "return", ["::SOAP::SOAPDecimal"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ], + ["echoBoolean", "echoBoolean", + [ + ["in", "inputBoolean", ["::SOAP::SOAPBoolean"]], + ["retval", "return", ["::SOAP::SOAPBoolean"]] + ], + "http://soapinterop.org/", "http://soapinterop.org/", :rpc + ] + ] + + 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 |name_as, name, params, soapaction, namespace, style| + qname = XSD::QName.new(namespace, name_as) + if style == :document + @proxy.add_document_method(soapaction, name, params) + add_document_method_interface(name, params) + else + @proxy.add_rpc_method(qname, soapaction, name, params) + add_rpc_method_interface(name, params) + end + if name_as != name and name_as.capitalize == name.capitalize + ::SOAP::Mapping.define_singleton_method(self, name_as) do |*arg| + __send__(name, *arg) + end + end + end + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/README.txt b/vendor/gems/soap4r-1.5.8/test/interopR2/README.txt new file mode 100644 index 00000000..bca58a2a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/README.txt @@ -0,0 +1,2 @@ +Clients/Server for SOAPBuilders Interoperability Lab "Round 2" +http://www.whitemesa.com/interop.htm diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2.wsdl b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2.wsdl new file mode 100644 index 00000000..a7785d41 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2.wsdl @@ -0,0 +1,461 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2GroupB.wsdl b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2GroupB.wsdl new file mode 100644 index 00000000..e87eaacd --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2GroupB.wsdl @@ -0,0 +1,20 @@ + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2GroupCClient.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2GroupCClient.rb new file mode 100644 index 00000000..dc755b22 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAP4R_SOAPBuildersInteropTest_R2GroupCClient.rb @@ -0,0 +1,176 @@ +#!/usr/bin/env ruby +require 'InteropTestDriver.rb' + +endpoint_url = ARGV.shift +obj = InteropTestPortType.new(endpoint_url) + +# Uncomment the below line to see SOAP wiredumps. +# obj.wiredump_dev = STDERR + +# SYNOPSIS +# echoString(inputString) +# +# ARGS +# inputString String - {http://www.w3.org/2001/XMLSchema}string +# +# RETURNS +# v_return String - {http://www.w3.org/2001/XMLSchema}string +# +inputString = nil +puts obj.echoString(inputString) + +# SYNOPSIS +# echoStringArray(inputStringArray) +# +# ARGS +# inputStringArray ArrayOfstring - {http://soapinterop.org/xsd}ArrayOfstring +# +# RETURNS +# v_return ArrayOfstring - {http://soapinterop.org/xsd}ArrayOfstring +# +inputStringArray = nil +puts obj.echoStringArray(inputStringArray) + +# SYNOPSIS +# echoInteger(inputInteger) +# +# ARGS +# inputInteger Int - {http://www.w3.org/2001/XMLSchema}int +# +# RETURNS +# v_return Int - {http://www.w3.org/2001/XMLSchema}int +# +inputInteger = nil +puts obj.echoInteger(inputInteger) + +# SYNOPSIS +# echoIntegerArray(inputIntegerArray) +# +# ARGS +# inputIntegerArray ArrayOfint - {http://soapinterop.org/xsd}ArrayOfint +# +# RETURNS +# v_return ArrayOfint - {http://soapinterop.org/xsd}ArrayOfint +# +inputIntegerArray = nil +puts obj.echoIntegerArray(inputIntegerArray) + +# SYNOPSIS +# echoFloat(inputFloat) +# +# ARGS +# inputFloat Float - {http://www.w3.org/2001/XMLSchema}float +# +# RETURNS +# v_return Float - {http://www.w3.org/2001/XMLSchema}float +# +inputFloat = nil +puts obj.echoFloat(inputFloat) + +# SYNOPSIS +# echoFloatArray(inputFloatArray) +# +# ARGS +# inputFloatArray ArrayOffloat - {http://soapinterop.org/xsd}ArrayOffloat +# +# RETURNS +# v_return ArrayOffloat - {http://soapinterop.org/xsd}ArrayOffloat +# +inputFloatArray = nil +puts obj.echoFloatArray(inputFloatArray) + +# SYNOPSIS +# echoStruct(inputStruct) +# +# ARGS +# inputStruct SOAPStruct - {http://soapinterop.org/xsd}SOAPStruct +# +# RETURNS +# v_return SOAPStruct - {http://soapinterop.org/xsd}SOAPStruct +# +inputStruct = nil +puts obj.echoStruct(inputStruct) + +# SYNOPSIS +# echoStructArray(inputStructArray) +# +# ARGS +# inputStructArray ArrayOfSOAPStruct - {http://soapinterop.org/xsd}ArrayOfSOAPStruct +# +# RETURNS +# v_return ArrayOfSOAPStruct - {http://soapinterop.org/xsd}ArrayOfSOAPStruct +# +inputStructArray = nil +puts obj.echoStructArray(inputStructArray) + +# SYNOPSIS +# echoVoid +# +# ARGS +# N/A +# +# RETURNS +# N/A +# + +puts obj.echoVoid + +# SYNOPSIS +# echoBase64(inputBase64) +# +# ARGS +# inputBase64 Base64Binary - {http://www.w3.org/2001/XMLSchema}base64Binary +# +# RETURNS +# v_return Base64Binary - {http://www.w3.org/2001/XMLSchema}base64Binary +# +inputBase64 = nil +puts obj.echoBase64(inputBase64) + +# SYNOPSIS +# echoDate(inputDate) +# +# ARGS +# inputDate DateTime - {http://www.w3.org/2001/XMLSchema}dateTime +# +# RETURNS +# v_return DateTime - {http://www.w3.org/2001/XMLSchema}dateTime +# +inputDate = nil +puts obj.echoDate(inputDate) + +# SYNOPSIS +# echoHexBinary(inputHexBinary) +# +# ARGS +# inputHexBinary HexBinary - {http://www.w3.org/2001/XMLSchema}hexBinary +# +# RETURNS +# v_return HexBinary - {http://www.w3.org/2001/XMLSchema}hexBinary +# +inputHexBinary = nil +puts obj.echoHexBinary(inputHexBinary) + +# SYNOPSIS +# echoDecimal(inputDecimal) +# +# ARGS +# inputDecimal Decimal - {http://www.w3.org/2001/XMLSchema}decimal +# +# RETURNS +# v_return Decimal - {http://www.w3.org/2001/XMLSchema}decimal +# +inputDecimal = nil +puts obj.echoDecimal(inputDecimal) + +# SYNOPSIS +# echoBoolean(inputBoolean) +# +# ARGS +# inputBoolean Boolean - {http://www.w3.org/2001/XMLSchema}boolean +# +# RETURNS +# v_return Boolean - {http://www.w3.org/2001/XMLSchema}boolean +# +inputBoolean = nil +puts obj.echoBoolean(inputBoolean) diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/SOAPBuildersInterop_R2.wsdl b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAPBuildersInterop_R2.wsdl new file mode 100644 index 00000000..a7785d41 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAPBuildersInterop_R2.wsdl @@ -0,0 +1,461 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/SOAPBuildersInterop_R2GrB.wsdl b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAPBuildersInterop_R2GrB.wsdl new file mode 100644 index 00000000..61209c75 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAPBuildersInterop_R2GrB.wsdl @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/SOAPBuildersInterop_R2GrC.wsdl b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAPBuildersInterop_R2GrC.wsdl new file mode 100644 index 00000000..337a548d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/SOAPBuildersInterop_R2GrC.wsdl @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/base.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/base.rb new file mode 100644 index 00000000..e53162eb --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/base.rb @@ -0,0 +1,288 @@ +require 'soap/soap' +require 'soap/mapping' + + +InterfaceNS = 'http://soapinterop.org/' +TypeNS = 'http://soapinterop.org/xsd' +ApacheNS = 'http://xml.apache.org/xml-soap' + + +module SOAPBuildersInterop +extend SOAP + + +MethodsBase = [ + ['echoVoid'], + ['echoString', + ['in', 'inputString', nil], ['retval', 'return', nil]], + ['echoStringArray', + ['in', 'inputStringArray', nil], ['retval', 'return', nil]], + ['echoInteger', + ['in', 'inputInteger', nil], ['retval', 'return', nil]], + ['echoIntegerArray', + ['in', 'inputIntegerArray', nil], ['retval', 'return', nil]], + ['echoFloat', + ['in', 'inputFloat', nil], ['retval', 'return', nil]], + ['echoFloatArray', + ['in', 'inputFloatArray', nil], ['retval', 'return', nil]], + ['echoStruct', + ['in', 'inputStruct', nil], ['retval', 'return', nil]], + ['echoStructArray', + ['in', 'inputStructArray', nil], ['retval', 'return', nil]], + ['echoDate', + ['in', 'inputDate', nil], ['retval', 'return', nil]], + ['echoBase64', + ['in', 'inputBase64', nil], ['retval', 'return', nil]], + ['echoHexBinary', + ['in', 'inputHexBinary', nil], ['retval', 'return', nil]], + ['echoBoolean', + ['in', 'inputBoolean', nil], ['retval', 'return', nil]], + ['echoDecimal', + ['in', 'inputDecimal', nil], ['retval', 'return', nil]], + ['echoMap', + ['in', 'inputMap', nil], ['retval', 'return', nil]], + ['echoMapArray', + ['in', 'inputMapArray', nil], ['retval', 'return', nil]], + + ['echoDouble', + ['in', 'inputDouble', nil], ['retval', 'return', nil]], + ['echoXSDDateTime', + ['in', 'inputXSDDateTime', nil], ['retval', 'return', nil]], + ['echoXSDDate', + ['in', 'inputXSDDate', nil], ['retval', 'return', nil]], + ['echoXSDTime', + ['in', 'inputXSDTime', nil], ['retval', 'return', nil]], +] + +MethodsGroupB = [ + ['echoStructAsSimpleTypes', + ['in', 'inputStruct', nil], ['out', 'outputString', nil], ['out', 'outputInteger', nil], ['out', 'outputFloat', nil]], + ['echoSimpleTypesAsStruct', + ['in', 'inputString', nil], ['in', 'inputInteger', nil], ['in', 'inputFloat', nil], ['retval', 'return', nil]], + ['echo2DStringArray', + ['in', 'input2DStringArray', nil], ['retval', 'return', nil]], + ['echoNestedStruct', + ['in', 'inputStruct', nil], ['retval', 'return', nil]], + ['echoNestedArray', + ['in', 'inputStruct', nil], ['retval', 'return', nil]], +] + +MethodsPolyMorph = [ + ['echoPolyMorph', + ['in', 'inputPolyMorph', nil], ['retval', 'return', nil]], + ['echoPolyMorphStruct', + ['in', 'inputPolyMorphStruct', nil], ['retval', 'return', nil]], + ['echoPolyMorphArray', + ['in', 'inputPolyMorphArray', nil], ['retval', 'return', nil]], +] + + +module FloatSupport + def floatEquals( lhs, rhs ) + lhsVar = lhs.is_a?( SOAP::SOAPFloat )? lhs.data : lhs + rhsVar = rhs.is_a?( SOAP::SOAPFloat )? rhs.data : rhs + lhsVar == rhsVar + end +end + +class SOAPStruct + include SOAP::Marshallable + include FloatSupport + + attr_accessor :varInt, :varFloat, :varString + + def initialize( varInt, varFloat, varString ) + @varInt = varInt + @varFloat = varFloat ? SOAP::SOAPFloat.new( varFloat ) : nil + @varString = varString + end + + def ==( rhs ) + r = if rhs.is_a?( self.class ) + ( self.varInt == rhs.varInt && + floatEquals( self.varFloat, rhs.varFloat ) && + self.varString == rhs.varString ) + else + false + end + r + end + + def to_s + "#{ varInt }:#{ varFloat }:#{ varString }" + end +end + + +class SOAPStructStruct + include SOAP::Marshallable + include FloatSupport + + attr_accessor :varInt, :varFloat, :varString, :varStruct + + def initialize( varInt, varFloat, varString, varStruct = nil ) + @varInt = varInt + @varFloat = varFloat ? SOAP::SOAPFloat.new( varFloat ) : nil + @varString = varString + @varStruct = varStruct + end + + def ==( rhs ) + r = if rhs.is_a?( self.class ) + ( self.varInt == rhs.varInt && + floatEquals( self.varFloat, rhs.varFloat ) && + self.varString == rhs.varString && + self.varStruct == rhs.varStruct ) + else + false + end + r + end + + def to_s + "#{ varInt }:#{ varFloat }:#{ varString }:#{ varStruct }" + end +end + + +class PolyMorphStruct + include SOAP::Marshallable + + attr_reader :varA, :varB, :varC + + def initialize( varA, varB, varC ) + @varA = varA + @varB = varB + @varC = varC + end + + def ==( rhs ) + r = if rhs.is_a?( self.class ) + ( self.varA == rhs.varA && + self.varB == rhs.varB && + self.varC == rhs.varC ) + else + false + end + r + end + + def to_s + "#{ varA }:#{ varB }:#{ varC }" + end +end + + +class SOAPArrayStruct + include SOAP::Marshallable + include FloatSupport + + attr_accessor :varInt, :varFloat, :varString, :varArray + + def initialize( varInt, varFloat, varString, varArray = nil ) + @varInt = varInt + @varFloat = varFloat ? SOAP::SOAPFloat.new( varFloat ) : nil + @varString = varString + @varArray = varArray + end + + def ==( rhs ) + r = if rhs.is_a?( self.class ) + ( self.varInt == rhs.varInt && + floatEquals( self.varFloat, rhs.varFloat ) && + self.varString == rhs.varString && + self.varArray == rhs.varArray ) + else + false + end + r + end + + def to_s + "#{ varInt }:#{ varFloat }:#{ varString }:#{ varArray }" + end +end + + +class StringArray < Array; end +class IntArray < Array; end +class FloatArray < Array; end +class SOAPStructArray < Array; end +class SOAPMapArray < Array; end +class ArrayOfanyType < Array; end + + +MappingRegistry = SOAP::Mapping::Registry.new + +MappingRegistry.set( + ::SOAPBuildersInterop::SOAPStruct, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new( TypeNS, "SOAPStruct" ) } +) + +MappingRegistry.set( + ::SOAPBuildersInterop::SOAPStructStruct, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new( TypeNS, "SOAPStructStruct" ) } +) + +MappingRegistry.set( + ::SOAPBuildersInterop::PolyMorphStruct, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new( TypeNS, "PolyMorphStruct" ) } +) + +MappingRegistry.set( + ::SOAPBuildersInterop::SOAPArrayStruct, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new( TypeNS, "SOAPArrayStruct" ) } +) + +MappingRegistry.set( + ::SOAPBuildersInterop::StringArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new( XSD::Namespace, XSD::StringLiteral ) } +) + +MappingRegistry.set( + ::SOAPBuildersInterop::IntArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new( XSD::Namespace, XSD::IntLiteral ) } +) + +MappingRegistry.set( + ::SOAPBuildersInterop::FloatArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new( XSD::Namespace, XSD::FloatLiteral ) } +) + +MappingRegistry.set( + ::SOAPBuildersInterop::SOAPStructArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new( TypeNS, 'SOAPStruct' ) } +) + +MappingRegistry.set( + ::SOAPBuildersInterop::SOAPMapArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new( ApacheNS, 'Map' ) } +) + +MappingRegistry.set( + ::SOAPBuildersInterop::ArrayOfanyType, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::AnyTypeName } +) + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/client.NetRemoting.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/client.NetRemoting.rb new file mode 100644 index 00000000..1403d87c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/client.NetRemoting.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +$serverName = 'dotNetRemotingWebServices' +$serverBase = 'http://www.mssoapinterop.org/remoting/ServiceA.soap' +$serverGroupB = 'http://www.mssoapinterop.org/remoting/ServiceB.soap' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/client.log b/vendor/gems/soap4r-1.5.8/test/interopR2/client.log new file mode 100644 index 00000000..d859cb3e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/client.log @@ -0,0 +1,4 @@ +File: client.log - Wiredumps for SOAP4R client / localhsot server. +Date: Wed Jul 04 23:08:41 +0900 2007 + +==== test_echoMapArray_multibyte_char ======================================== diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/client.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/client.rb new file mode 100644 index 00000000..8bf77290 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/client.rb @@ -0,0 +1,1234 @@ +$KCODE = 'EUC' + +require 'test/unit' +require 'soap/rpc/driver' +require 'soap/mapping' +require 'base' +require 'interopResultBase' +require 'xsd/xmlparser/rexmlparser' +#XSD::Charset.encoding = 'EUC' + +class Float + Precision = 5 + def ==(rhs) + if rhs.is_a?(Float) + if self.nan? and rhs.nan? + true + elsif self.infinite? == rhs.infinite? + true + elsif (rhs - self).abs <= (10 ** (- Precision)) + true + else + false + end + else + false + end + end +end + +class FakeFloat < SOAP::SOAPFloat + def initialize(str) + super() + @data = str + end + + def to_s + @data.to_s + end +end + +class FakeDateTime < SOAP::SOAPDateTime + def initialize(str) + super() + @data = str + end + + def to_s + @data.to_s + end +end + +class FakeDecimal < SOAP::SOAPDecimal + def initialize(str) + super() + @data = str + end + + def to_s + @data.to_s + end +end + +class FakeInt < SOAP::SOAPInt + def initialize(str) + super() + @data = str + end + + def to_s + @data.to_s + end +end + +class SOAPBuildersTest < Test::Unit::TestCase + include SOAP + include SOAPBuildersInterop + + NegativeZero = (-1.0 / (1.0 / 0.0)) + + class << self + include SOAP + def setup(name, location) + setup_log(name) + setup_drv(location) + end + + def teardown + end + + private + + def setup_log(name) + filename = File.basename($0).sub(/\.rb$/, '') << '.log' + @@log = File.open(filename, 'w') + @@log << "File: #{ filename } - Wiredumps for SOAP4R client / #{ name } server.\n" + @@log << "Date: #{ Time.now }\n\n" + end + + def setup_drv(location) + namespace = InterfaceNS + soap_action = InterfaceNS + @@drv = RPC::Driver.new(location, namespace, soap_action) + @@drv.mapping_registry = SOAPBuildersInterop::MappingRegistry + if $DEBUG + @@drv.wiredump_dev = STDOUT + else + @@drv.wiredump_dev = @@log + end + method_def(@@drv, soap_action) + end + + def method_def(drv, soap_action = nil) + do_method_def(drv, SOAPBuildersInterop::MethodsBase, soap_action) + do_method_def(drv, SOAPBuildersInterop::MethodsGroupB, soap_action) + end + + def do_method_def(drv, defs, soap_action = nil) + defs.each do |name, *params| + drv.add_rpc_operation( + XSD::QName.new(InterfaceNS, name), soap_action, name, params) + end + end + end + + def setup + end + + def teardown + end + + def drv + @@drv + end + + def log_test + /`([^']+)'/ =~ caller(1)[0] + title = $1 + title = "==== " + title + " " << "=" * (title.length > 72 ? 0 : (72 - title.length)) + @@log << "#{title}\n\n" + end + + def assert_exception(klass_or_module) + begin + yield + assert(false, "Exception was not raised.") + rescue Exception => e + if klass_or_module.is_a?(Module) + assert_kind_of(klass_or_module, e) + elsif klass_or_module.is_a?(Class) + assert_instance_of(klass_or_module, e) + else + assert(false, "Must be a klass or a mogule.") + end + end + end + + def inspect_with_id(obj) + case obj + when Array + obj.collect { |ele| inspect_with_id(ele) } + else + # String#== compares content of args. + "#{ obj.class }##{ obj.__id__ }" + end + end + + def dump_result(title, result, resultStr) + @@test_result.add( + SOAPBuildersInteropResult::TestResult.new( + title, + result, + resultStr, + $wireDumpDev.dup + ) + ) + $wireDumpLogFile << "Result: #{ resultStr || 'OK' }\n\n" + $wireDumpLogFile << $wireDumpDev + $wireDumpLogFile << "\n" + + $wireDumpDev.replace('') + end + + def test_echoVoid + log_test + var = drv.echoVoid() + assert_equal(nil, var) + end + + def test_echoString + log_test + arg = "SOAP4R Interoperability Test" + var = drv.echoString(arg) + assert_equal(arg, var) + end + + def test_echoString_Entity_reference + log_test + arg = "<>\"& <>"& &&><<<" + var = drv.echoString(arg) + assert_equal(arg, var) + end + + def test_echoString_haracter_reference + log_test + arg = "\x20 \040 \x7f\177" + tobe = " \177\177\177\177" + var = drv.echoString(SOAP::SOAPRawString.new(arg)) + assert_equal(tobe, var) + end + + def test_echoString_Leading_and_trailing_whitespace + log_test + arg = " SOAP4R\nInteroperability\nTest " + var = drv.echoString(arg) + assert_equal(arg, var) + end + + def test_echoString_EUC_encoded + log_test + arg = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + var = drv.echoString(arg) + assert_equal(arg, var) + end + + def test_echoString_EUC_encoded_again + log_test + arg = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + var = drv.echoString(arg) + assert_equal(arg, var) + end + + def test_echoString_SJIS_encoded + log_test + arg = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + require 'nkf' + arg = NKF.nkf("-sm0", arg) + drv.options["soap.mapping.external_ces"] = 'SJIS' + begin + var = drv.echoString(arg) + assert_equal(arg, var) + ensure + drv.options["soap.mapping.external_ces"] = nil + end + end + + def test_echoString_empty + log_test + arg = '' + var = drv.echoString(arg) + assert_equal(arg, var) + end + + def test_echoString_space + log_test + arg = ' ' + var = drv.echoString(arg) + assert_equal(arg, var) + end + + def test_echoString_whitespaces + log_test + arg = "\r \n \t \r \n \t" + var = drv.echoString(arg) + assert_equal(arg, var) + end + + def test_echoStringArray + log_test + arg = StringArray["SOAP4R\n", " Interoperability ", "\tTest\t"] + var = drv.echoStringArray(arg) + assert_equal(arg, var) + end + + def test_echoStringArray_multi_ref + log_test + str1 = "SOAP4R" + str2 = "SOAP4R" + arg = StringArray[str1, str2, str1] + var = drv.echoStringArray(arg) + assert_equal(arg, var) + end + + def test_echoStringArray_multi_ref_idmatch + log_test + str1 = "SOAP4R" + str2 = "SOAP4R" + arg = StringArray[str1, str2, str1] + var = drv.echoStringArray(arg) + assert_equal(inspect_with_id(var[0]), inspect_with_id(var[2])) + end + + def test_echoStringArray_empty_multi_ref_idmatch + log_test + str1 = "" + str2 = "" + arg = StringArray[str1, str2, str1] + var = drv.echoStringArray(arg) + assert_equal(inspect_with_id(var[0]), inspect_with_id(var[2])) + end + + def test_echoInteger_123 + log_test + arg = 123 + var = drv.echoInteger(arg) + assert_equal(arg, var) + end + + def test_echoInteger_2147483647 + log_test + arg = 2147483647 + var = drv.echoInteger(arg) + assert_equal(arg, var) + end + + def test_echoInteger_negative_2147483648 + log_test + arg = -2147483648 + var = drv.echoInteger(arg) + assert_equal(arg, var) + end + + def test_echoInteger_2147483648_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeInt.new("2147483648") + var = drv.echoInteger(arg) + end + end + + def test_echoInteger_negative_2147483649_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeInt.new("-2147483649") + var = drv.echoInteger(arg) + end + end + + def test_echoInteger_0_0_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeInt.new("0.0") + var = drv.echoInteger(arg) + end + end + + def test_echoInteger_negative_5_2_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeInt.new("-5.2") + var = drv.echoInteger(arg) + end + end + + def test_echoInteger_0_000000000a_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeInt.new("0.000000000a") + var = drv.echoInteger(arg) + end + end + + def test_echoInteger_plus_minus_5_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeInt.new("+-5") + var = drv.echoInteger(arg) + end + end + + def test_echoIntegerArray + log_test + arg = IntArray[1, 2, 3] + var = drv.echoIntegerArray(arg) + assert_equal(arg, var) + end + + def test_echoIntegerArray_empty + log_test + arg = SOAP::SOAPArray.new(SOAP::ValueArrayName, 1, XSD::XSDInt::Type) + var = drv.echoIntegerArray(arg) + assert_equal([], var) + end + + def test_echoFloat + log_test + arg = 3.14159265358979 + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(arg, var) + end + + def test_echoFloat_scientific_notation + log_test + arg = 12.34e36 + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(arg, var) + end + + def test_echoFloat_scientific_notation_2 + log_test + arg = FakeFloat.new("12.34e36") + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(12.34e36, var) + end + + def test_echoFloat_scientific_notation_3 + log_test + arg = FakeFloat.new("12.34E+36") + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(12.34e36, var) + end + + def test_echoFloat_scientific_notation_4 + log_test + arg = FakeFloat.new("-1.4E") + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(1.4, var) + end + + def test_echoFloat_positive_lower_boundary + log_test + arg = 1.4e-45 + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(arg, var) + end + + def test_echoFloat_negative_lower_boundary + log_test + arg = -1.4e-45 + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(arg, var) + end + + def test_echoFloat_special_values_positive_0 + log_test + arg = 0.0 + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(arg, var) + end + + def test_echoFloat_special_values_negative_0 + log_test + arg = NegativeZero + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(arg, var) + end + + def test_echoFloat_special_values_NaN + log_test + arg = 0.0/0.0 + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(arg, var) + end + + def test_echoFloat_special_values_positive_INF + log_test + arg = 1.0/0.0 + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(arg, var) + end + + def test_echoFloat_special_values_negative_INF + log_test + arg = -1.0/0.0 + var = drv.echoFloat(SOAPFloat.new(arg)) + assert_equal(arg, var) + end + + def test_echoFloat_0_000a_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeFloat.new("0.0000000000000000a") + var = drv.echoFloat(arg) + end + end + + def test_echoFloat_00a_0001_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeFloat.new("00a.000000000000001") + var = drv.echoFloat(arg) + end + end + + def test_echoFloat_plus_minus_5_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeFloat.new("+-5") + var = drv.echoFloat(arg) + end + end + + def test_echoFloat_5_0_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeFloat.new("5_0") + var = drv.echoFloat(arg) + end + end + + def test_echoFloatArray + log_test + arg = FloatArray[SOAPFloat.new(0.0001), SOAPFloat.new(1000.0), + SOAPFloat.new(0.0)] + var = drv.echoFloatArray(arg) + assert_equal(arg.collect { |ele| ele.data }, var) + end + + def test_echoFloatArray_special_values_NaN_positive_INF_negative_INF + log_test + nan = SOAPFloat.new(0.0/0.0) + inf = SOAPFloat.new(1.0/0.0) + inf_ = SOAPFloat.new(-1.0/0.0) + arg = FloatArray[nan, inf, inf_] + var = drv.echoFloatArray(arg) + assert_equal(arg.collect { |ele| ele.data }, var) + end + + def test_echoStruct + log_test + arg = SOAPStruct.new(1, 1.1, "a") + var = drv.echoStruct(arg) + assert_equal(arg, var) + end + + def test_echoStruct_nil_members + log_test + arg = SOAPStruct.new(nil, nil, nil) + var = drv.echoStruct(arg) + assert_equal(arg, var) + end + + def test_echoStructArray + log_test + s1 = SOAPStruct.new(1, 1.1, "a") + s2 = SOAPStruct.new(2, 2.2, "b") + s3 = SOAPStruct.new(3, 3.3, "c") + arg = SOAPStructArray[s1, s2, s3] + var = drv.echoStructArray(arg) + assert_equal(arg, var) + end + + def test_echoStructArray_anyType_Array + log_test + s1 = SOAPStruct.new(1, 1.1, "a") + s2 = SOAPStruct.new(2, 2.2, "b") + s3 = SOAPStruct.new(3, 3.3, "c") + arg = [s1, s2, s3] + var = drv.echoStructArray(arg) + assert_equal(arg, var) + end + + def test_echoStructArray_multi_ref + log_test + s1 = SOAPStruct.new(1, 1.1, "a") + s2 = SOAPStruct.new(2, 2.2, "b") + arg = SOAPStructArray[s1, s1, s2] + var = drv.echoStructArray(arg) + assert_equal(arg, var) + end + + def test_echoStructArray_multi_ref_idmatch + log_test + s1 = SOAPStruct.new(1, 1.1, "a") + s2 = SOAPStruct.new(2, 2.2, "b") + arg = SOAPStructArray[s1, s1, s2] + var = drv.echoStructArray(arg) + assert_equal(inspect_with_id(var[0]), inspect_with_id(var[1])) + end + + def test_echoStructArray_anyType_Array_multi_ref_idmatch + log_test + s1 = SOAPStruct.new(1, 1.1, "a") + s2 = SOAPStruct.new(2, 2.2, "b") + arg = [s1, s2, s2] + var = drv.echoStructArray(arg) + assert_equal(inspect_with_id(var[1]), inspect_with_id(var[2])) + end + + def test_echoStructArray_multi_ref_idmatch_varString_of_elem1_varString_of_elem2 + log_test + str1 = "a" + str2 = "a" + s1 = SOAPStruct.new(1, 1.1, str1) + s2 = SOAPStruct.new(2, 2.2, str1) + s3 = SOAPStruct.new(3, 3.3, str2) + arg = SOAPStructArray[s1, s2, s3] + var = drv.echoStructArray(arg) + assert_equal(inspect_with_id(var[0].varString), inspect_with_id(var[1].varString)) + end + + def test_echoStructArray_anyType_Array_multi_ref_idmatch_varString_of_elem2_varString_of_elem3 + log_test + str1 = "b" + str2 = "b" + s1 = SOAPStruct.new(1, 1.1, str2) + s2 = SOAPStruct.new(2, 2.2, str1) + s3 = SOAPStruct.new(3, 3.3, str1) + arg = [s1, s2, s3] + var = drv.echoStructArray(arg) + assert_equal(inspect_with_id(var[1].varString), inspect_with_id(var[2].varString)) + end + + def test_echoDate_now + log_test + t = Time.now.gmtime + arg = DateTime.new(t.year, t.mon, t.mday, t.hour, t.min, t.sec) + var = drv.echoDate(arg) + assert_equal(arg.to_s, var.to_s) + end + + def test_echoDate_before_1970 + log_test + t = Time.now.gmtime + arg = DateTime.new(1, 1, 1, 0, 0, 0) + var = drv.echoDate(arg) + assert_equal(arg.to_s, var.to_s) + end + + def test_echoDate_after_2038 + log_test + t = Time.now.gmtime + arg = DateTime.new(2038, 12, 31, 0, 0, 0) + var = drv.echoDate(arg) + assert_equal(arg.to_s, var.to_s) + end + + def test_echoDate_negative_10_01_01T00_00_00Z + log_test + t = Time.now.gmtime + arg = DateTime.new(-10, 1, 1, 0, 0, 0) + var = drv.echoDate(arg) + assert_equal(arg.to_s, var.to_s) + end + + def test_echoDate_time_precision_msec + log_test + arg = SOAP::SOAPDateTime.new('2001-06-16T18:13:40.012') + argDate = arg.data + var = drv.echoDate(arg) + assert_equal(argDate, var) + end + + def test_echoDate_time_precision_long + log_test + arg = SOAP::SOAPDateTime.new('2001-06-16T18:13:40.0000000000123456789012345678900000000000') + argDate = arg.data + var = drv.echoDate(arg) + assert_equal(argDate, var) + end + + def test_echoDate_positive_TZ + log_test + arg = SOAP::SOAPDateTime.new('2001-06-17T01:13:40+07:00') + argNormalized = DateTime.new(2001, 6, 16, 18, 13, 40) + var = drv.echoDate(arg) + assert_equal(argNormalized, var) + end + + def test_echoDate_negative_TZ + log_test + arg = SOAP::SOAPDateTime.new('2001-06-16T18:13:40-07:00') + argNormalized = DateTime.new(2001, 6, 17, 1, 13, 40) + var = drv.echoDate(arg) + assert_equal(argNormalized, var) + end + + def test_echoDate_positive_00_00_TZ + log_test + arg = SOAP::SOAPDateTime.new('2001-06-17T01:13:40+00:00') + argNormalized = DateTime.new(2001, 6, 17, 1, 13, 40) + var = drv.echoDate(arg) + assert_equal(argNormalized, var) + end + + def test_echoDate_negative_00_00_TZ + log_test + arg = SOAP::SOAPDateTime.new('2001-06-17T01:13:40-00:00') + argNormalized = DateTime.new(2001, 6, 17, 1, 13, 40) + var = drv.echoDate(arg) + assert_equal(argNormalized, var) + end + + def test_echoDate_min_TZ + log_test + arg = SOAP::SOAPDateTime.new('2001-06-16T00:00:01+00:01') + argNormalized = DateTime.new(2001, 6, 15, 23, 59, 1) + var = drv.echoDate(arg) + assert_equal(argNormalized, var) + end + + def test_echoDate_year_9999 + log_test + arg = SOAP::SOAPDateTime.new('10000-06-16T18:13:40-07:00') + argNormalized = DateTime.new(10000, 6, 17, 1, 13, 40) + var = drv.echoDate(arg) + assert_equal(argNormalized, var) + end + + def test_echoDate_year_0 + log_test + arg = SOAP::SOAPDateTime.new('-0001-06-16T18:13:40-07:00') + argNormalized = DateTime.new(0, 6, 17, 1, 13, 40) + var = drv.echoDate(arg) + assert_equal(argNormalized, var) + end + + def test_echoDate_year_4713 + log_test + arg = SOAP::SOAPDateTime.new('-4713-01-01T12:00:00') + argNormalized = DateTime.new(-4712, 1, 1, 12, 0, 0) + var = drv.echoDate(arg) + assert_equal(argNormalized, var) + end + + def test_echoDate_year_0000_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeDateTime.new("0000-05-18T16:52:20Z") + var = drv.echoDate(arg) + end + end + + def test_echoDate_year_nn_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeDateTime.new("05-05-18T16:52:20Z") + var = drv.echoDate(arg) + end + end + + def test_echoDate_no_day_part_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeDateTime.new("2002-05T16:52:20Z") + var = drv.echoDate(arg) + end + end + + def test_echoDate_no_sec_part_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeDateTime.new("2002-05-18T16:52Z") + var = drv.echoDate(arg) + end + end + + def test_echoDate_empty_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeDateTime.new("") + var = drv.echoDate(arg) + end + end + + def test_echoBase64_xsd_base64Binary + log_test + str = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + arg = SOAP::SOAPBase64.new(str) + arg.as_xsd # Force xsd:base64Binary instead of soap-enc:base64 + var = drv.echoBase64(arg) + assert_equal(str, var) + end + + def test_echoBase64_xsd_base64Binary_empty + log_test + str = "" + arg = SOAP::SOAPBase64.new(str) + arg.as_xsd # Force xsd:base64Binary instead of soap-enc:base64 + var = drv.echoBase64(arg) + assert_equal(str, var) + end + + def test_echoBase64_SOAP_ENC_base64 + log_test + str = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + arg = SOAP::SOAPBase64.new(str) + var = drv.echoBase64(arg) + assert_equal(str, var) + end + + def test_echoBase64_0 + log_test + str = "\0" + arg = SOAP::SOAPBase64.new(str) + var = drv.echoBase64(arg) + assert_equal(str, var) + end + + def test_echoBase64_0a_0 + log_test + str = "a\0b\0\0c\0\0\0" + arg = SOAP::SOAPBase64.new(str) + var = drv.echoBase64(arg) + assert_equal(str, var) + end + + def test_echoBase64_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = SOAP::SOAPBase64.new("dummy") + arg.instance_eval { @data = '-' } + var = drv.echoBase64(arg) + end + end + + def test_echoHexBinary + log_test + str = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + arg = SOAP::SOAPHexBinary.new(str) + var = drv.echoHexBinary(arg) + assert_equal(str, var) + end + + def test_echoHexBinary_empty + log_test + str = "" + arg = SOAP::SOAPHexBinary.new(str) + var = drv.echoHexBinary(arg) + assert_equal(str, var) + end + + def test_echoHexBinary_0 + log_test + str = "\0" + arg = SOAP::SOAPHexBinary.new(str) + var = drv.echoHexBinary(arg) + assert_equal(str, var) + end + + def test_echoHexBinary_0a_0 + log_test + str = "a\0b\0\0c\0\0\0" + arg = SOAP::SOAPHexBinary.new(str) + var = drv.echoHexBinary(arg) + assert_equal(str, var) + end + + def test_echoHexBinary_lower_case + log_test + str = "lower case" + arg = SOAP::SOAPHexBinary.new + arg.set_encoded((str.unpack("H*")[0]).tr('A-F', 'a-f')) + var = drv.echoHexBinary(arg) + assert_equal(str, var) + end + + def test_echoHexBinary_0FG7_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = SOAP::SOAPHexBinary.new("dummy") + arg.instance_eval { @data = '0FG7' } + var = drv.echoHexBinary(arg) + end + end + + def test_echoBoolean_true + log_test + arg = true + var = drv.echoBoolean(arg) + assert_equal(arg, var) + end + + def test_echoBoolean_false + log_test + arg = false + var = drv.echoBoolean(arg) + assert_equal(arg, var) + end + + def test_echoBoolean_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = SOAP::SOAPBoolean.new(true) + arg.instance_eval { @data = 'junk' } + var = drv.echoBoolean(arg) + end + end + + def test_echoDecimal_123456 + log_test + arg = "123456789012345678" + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + normalized = arg + assert_equal(normalized, var) + end + + def test_echoDecimal_0_123 + log_test + arg = "+0.12345678901234567" + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + normalized = arg.sub(/0$/, '').sub(/^\+/, '') + assert_equal(normalized, var) + end + + def test_echoDecimal_00000123 + log_test + arg = ".00000123456789012" + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + normalized = '0' << arg.sub(/0$/, '') + assert_equal(normalized, var) + end + + def test_echoDecimal_negative_00000123 + log_test + arg = "-.00000123456789012" + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + normalized = '-0' << arg.sub(/0$/, '').sub(/-/, '') + assert_equal(normalized, var) + end + + def test_echoDecimal_123_456 + log_test + arg = "-123456789012345.008" + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + assert_equal(arg, var) + end + + def test_echoDecimal_123 + log_test + arg = "-12345678901234567." + normalized = arg.sub(/\.$/, '') + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + assert_equal(normalized, var) + end + + def test_echoDecimal_0_000a_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeDecimal.new("0.0000000000000000a") + var = drv.echoDecimal(arg) + end + end + + def test_echoDecimal_00a_0001_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeDecimal.new("00a.000000000000001") + var = drv.echoDecimal(arg) + end + end + + def test_echoDecimal_plus_minus_5_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeDecimal.new("+-5") + var = drv.echoDecimal(arg) + end + end + + def test_echoDecimal_5_0_junk + log_test + assert_exception(SOAP::RPC::ServerException) do + arg = FakeDecimal.new("5_0") + var = drv.echoDecimal(arg) + end + end + + def test_echoMap + log_test + arg = { "a" => 1, "b" => 2 } + var = drv.echoMap(arg) + assert_equal(arg, var) + end + + def test_echoMap_boolean_base64_nil_float + log_test + arg = { true => "\0", "\0" => nil, nil => 0.0001, 0.0001 => false } + var = drv.echoMap(arg) + assert_equal(arg, var) + end + + def test_echoMap_multibyte_char + log_test + arg = { "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" => 1, 1 => "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" } + var = drv.echoMap(arg) + assert_equal(arg, var) + end + + def test_echoMap_Struct + log_test + obj = SOAPStruct.new(1, 1.1, "a") + arg = { 1 => obj, 2 => obj } + var = drv.echoMap(arg) + assert_equal(arg, var) + end + + def test_echoMap_multi_ref_idmatch_value_for_key_a + log_test + value = "c" + arg = { "a" => value, "b" => value } + var = drv.echoMap(arg) + assert_equal(inspect_with_id(var["a"]), inspect_with_id(var["b"])) + end + + def test_echoMap_Struct_multi_ref_idmatch_varString_of_a_key + log_test + str = "" + obj = SOAPStruct.new(1, 1.1, str) + arg = { obj => "1", "1" => obj } + var = drv.echoMap(arg) + assert_equal(inspect_with_id(var.index("1").varString), inspect_with_id(var.fetch("1").varString)) + end + + def test_echoMapArray + log_test + map1 = { "a" => 1, "b" => 2 } + map2 = { "a" => 1, "b" => 2 } + map3 = { "a" => 1, "b" => 2 } + arg = [map1, map2, map3] + var = drv.echoMapArray(arg) + assert_equal(arg, var) + end + + def test_echoMapArray_boolean_base64_nil_float + log_test + map1 = { true => "\0", "\0" => nil, nil => 0.0001, 0.0001 => false } + map2 = { true => "\0", "\0" => nil, nil => 0.0001, 0.0001 => false } + map3 = { true => "\0", "\0" => nil, nil => 0.0001, 0.0001 => false } + arg = [map1, map2, map3] + var = drv.echoMapArray(arg) + assert_equal(arg, var) + end + + def test_echoMapArray_multibyte_char + log_test + map1 = { "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" => 1, 1 => "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" } + map2 = { "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" => 1, 1 => "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" } + map3 = { "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" => 1, 1 => "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" } + arg = [map1, map2, map3] + var = drv.echoMapArray(arg) + assert_equal(arg, var) + end + + def test_echoMapArray_multi_ref_idmatch + log_test + map1 = { "a" => 1, "b" => 2 } + map2 = { "a" => 1, "b" => 2 } + arg = [map1, map1, map2] + var = drv.echoMapArray(arg) + assert_equal(inspect_with_id(var[0]), inspect_with_id(var[1])) + end + + def test_echoStructAsSimpleTypes + log_test + arg = SOAPStruct.new(1, 1.1, "a") + ret, out1, out2 = drv.echoStructAsSimpleTypes(arg) + var = SOAPStruct.new(out1, out2, ret) + assert_equal(arg, var) + end + + def test_echoStructAsSimpleTypes_nil + log_test + arg = SOAPStruct.new(nil, nil, nil) + ret, out1, out2 = drv.echoStructAsSimpleTypes(arg) + var = SOAPStruct.new(out1, out2, ret) + assert_equal(arg, var) + end + + def test_echoSimpleTypesAsStruct + log_test + arg = SOAPStruct.new(1, 1.1, "a") + var = drv.echoSimpleTypesAsStruct(arg.varString, arg.varInt, arg.varFloat) + assert_equal(arg, var) + end + + def test_echoSimpleTypesAsStruct_nil + log_test + arg = SOAPStruct.new(nil, nil, nil) + var = drv.echoSimpleTypesAsStruct(arg.varString, arg.varInt, arg.varFloat) + assert_equal(arg, var) + end + + def test_echo2DStringArray + log_test +# arg = SOAP::SOAPArray.new(SOAP::ValueArrayName, 2, XSD::XSDString::Type) +# arg[0, 0] = obj2soap('r0c0') +# arg[1, 0] = obj2soap('r1c0') +# arg[2, 0] = obj2soap('r2c0') +# arg[0, 1] = obj2soap('r0c1') +# arg[1, 1] = obj2soap('r1c1') +# arg[2, 1] = obj2soap('r2c1') +# arg[0, 2] = obj2soap('r0c2') +# arg[1, 2] = obj2soap('r1c2') +# arg[2, 2] = obj2soap('r2c2') + + arg = SOAP::SOAPArray.new(XSD::QName.new('http://soapinterop.org/xsd', 'ArrayOfString2D'), 2, XSD::XSDString::Type) + arg.size = [3, 3] + arg.size_fixed = true + arg.add(SOAP::Mapping.obj2soap('r0c0', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r1c0', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r2c0', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r0c1', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r1c1', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r2c1', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r0c2', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r1c2', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r2c2', SOAPBuildersInterop::MappingRegistry)) + argNormalized = [ + ['r0c0', 'r1c0', 'r2c0'], + ['r0c1', 'r1c1', 'r2c1'], + ['r0c2', 'r1c2', 'r2c2'], + ] + + var = drv.echo2DStringArray(arg) + assert_equal(argNormalized, var) + end + + def test_echo2DStringArray_anyType_array + log_test + # ary2md converts Arry ((of Array)...) into M-D anyType Array + arg = [ + ['r0c0', 'r0c1', 'r0c2'], + ['r1c0', 'r1c1', 'r1c2'], + ['r2c0', 'r0c1', 'r2c2'], + ] + + paramArg = SOAP::Mapping.ary2md(arg, 2, XSD::Namespace, XSD::AnyTypeLiteral, SOAPBuildersInterop::MappingRegistry) + paramArg.type = XSD::QName.new('http://soapinterop.org/xsd', 'ArrayOfString2D') + var = drv.echo2DStringArray(paramArg) + assert_equal(arg, var) + end + + def test_echo2DStringArray_multi_ref + log_test + arg = SOAP::SOAPArray.new(XSD::QName.new('http://soapinterop.org/xsd', 'ArrayOfString2D'), 2, XSD::XSDString::Type) + arg.size = [3, 3] + arg.size_fixed = true + + item = 'item' + arg.add('r0c0') + arg.add('r1c0') + arg.add(item) + arg.add('r0c1') + arg.add('r1c1') + arg.add('r2c1') + arg.add(item) + arg.add('r1c2') + arg.add('r2c2') + argNormalized = [ + ['r0c0', 'r1c0', 'item'], + ['r0c1', 'r1c1', 'r2c1'], + ['item', 'r1c2', 'r2c2'], + ] + + var = drv.echo2DStringArray(arg) + assert_equal(argNormalized, var) + end + + def test_echo2DStringArray_multi_ref_idmatch + log_test + arg = SOAP::SOAPArray.new(XSD::QName.new('http://soapinterop.org/xsd', 'ArrayOfString2D'), 2, XSD::XSDString::Type) + arg.size = [3, 3] + arg.size_fixed = true + + item = 'item' + arg.add('r0c0') + arg.add('r1c0') + arg.add(item) + arg.add('r0c1') + arg.add('r1c1') + arg.add('r2c1') + arg.add(item) + arg.add('r1c2') + arg.add('r2c2') + + var = drv.echo2DStringArray(arg) + assert_equal(inspect_with_id(var[2][0]), inspect_with_id(var[0][2])) + end + + def test_echoNestedStruct + log_test + arg = SOAPStructStruct.new(1, 1.1, "a", + SOAPStruct.new(2, 2.2, "b") + ) + var = drv.echoNestedStruct(arg) + assert_equal(arg, var) + end + + def test_echoNestedStruct_nil + log_test + arg = SOAPStructStruct.new(nil, nil, nil, + SOAPStruct.new(nil, nil, nil) + ) + var = drv.echoNestedStruct(arg) + assert_equal(arg, var) + end + + def test_echoNestedStruct_multi_ref_idmatch + log_test + str1 = "" + arg = SOAPStructStruct.new(1, 1.1, str1, + SOAPStruct.new(2, 2.2, str1) + ) + var = drv.echoNestedStruct(arg) + assert_equal(inspect_with_id(var.varString), inspect_with_id(var.varStruct.varString)) + end + + def test_echoNestedArray + log_test + arg = SOAPArrayStruct.new(1, 1.1, "a", StringArray["2", "2.2", "b"]) + var = drv.echoNestedArray(arg) + assert_equal(arg, var) + end + + def test_echoNestedArray_anyType_array + log_test + arg = SOAPArrayStruct.new(1, 1.1, "a", ["2", "2.2", "b"]) + var = drv.echoNestedArray(arg) + assert_equal(arg, var) + end + + def test_echoNestedArray_multi_ref + log_test + str = "" + arg = SOAPArrayStruct.new(1, 1.1, str, StringArray["2", str, "b"]) + var = drv.echoNestedArray(arg) + assert_equal(arg, var) + end + + def test_echoNestedArray_multi_ref_idmatch + log_test + str = "" + arg = SOAPArrayStruct.new(1, 1.1, str, StringArray["2", str, "b"]) + var = drv.echoNestedArray(arg) + assert_equal(inspect_with_id(var.varString), inspect_with_id(var.varArray[1])) + end +end + +if $0 == __FILE__ + #name = ARGV.shift || 'localhost' + #location = ARGV.shift || 'http://localhost:10080/' + name = 'localhsot'; location = 'http://localhost:10080/' + SOAPBuildersTest.setup(name, location) +end diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/client4S4C.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/client4S4C.rb new file mode 100644 index 00000000..cbc940be --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/client4S4C.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +$serverName = '4S4C' +$server = 'http://soap.4s4c.com/ilab/soap.asp' +$noEchoMap = true + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) + +methodDef(drv) + +doTestBase(drv) +doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/client4S4C2.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/client4S4C2.rb new file mode 100644 index 00000000..8bb67fbf --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/client4S4C2.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +$serverName = '4S4C2' +$server = 'http://soap.4s4c.com/ilab2/soap.asp' + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) + +methodDef(drv) + +doTestBase(drv) +doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientASP.NET.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientASP.NET.rb new file mode 100644 index 00000000..aa65325d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientASP.NET.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +$serverName = 'MSASPdotNETWebServices' +$serverBase = 'http://www.mssoapinterop.org/asmx/simple.asmx' +$serverGroupB = 'http://www.mssoapinterop.org/asmx/simpleB.asmx' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientApacheAxis.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientApacheAxis.rb new file mode 100644 index 00000000..da4b7693 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientApacheAxis.rb @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby + +$serverName = 'ApacheAxis' +$server = 'http://nagoya.apache.org:5049/axis/services/echo' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientApacheSOAP.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientApacheSOAP.rb new file mode 100644 index 00000000..7740a0bf --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientApacheSOAP.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +$serverName = 'ApacheSOAP2.2' +$serverBase = 'http://nagoya.apache.org:5049/soap/servlet/rpcrouter' +$serverGroupB = 'None' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase( drvBase ) + +#drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +#methodDefGroupB( drvGroupB ) + +doTestBase( drvBase ) +#doTestGroupB( drvGroupB ) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientBEAWebLogic.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientBEAWebLogic.rb new file mode 100644 index 00000000..8513e4c5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientBEAWebLogic.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +$serverName = 'BEAWebLogic8.1' +$serverBase = 'http://webservice.bea.com:7001/base/SoapInteropBaseService' +$serverGroupB = 'http://webservice.bea.com:7001/groupb/SoapInteropGroupBService' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientBase.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientBase.rb new file mode 100644 index 00000000..b1377eea --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientBase.rb @@ -0,0 +1,1967 @@ +$KCODE = 'EUC' + +require 'logger' +require 'soap/rpc/driver' +require 'soap/mapping' +require 'base' +require 'interopResultBase' + +include SOAP +include SOAPBuildersInterop + +$soapAction = 'http://soapinterop.org/' +$testResultServer = 'http://dev.ctor.org/soapsrv' +$testResultDrv = SOAP::RPC::Driver.new($testResultServer, + SOAPBuildersInteropResult::InterfaceNS) + +SOAPBuildersInteropResult::Methods.each do |name, *params| + $testResultDrv.add_rpc_operation( + XSD::QName.new(SOAPBuildersInteropResult::InterfaceNS, name), + nil, name, params) +end + +client = SOAPBuildersInteropResult::Endpoint.new +client.processorName = 'SOAP4R' +client.processorVersion = '1.5' +client.uri = '*:*' +client.wsdl = "#{$wsdlBase} #{$wsdlGroupB}" + +server = SOAPBuildersInteropResult::Endpoint.new +server.endpointName = $serverName +server.uri = $server || "#{ $serverBase }, #{ $serverGroupB }" +server.wsdl = "#{$wsdlBase} #{$wsdlGroupB}" + +$testResults = SOAPBuildersInteropResult::InteropResults.new(client, server) + +$wireDumpDev = '' +def $wireDumpDev.close; end + +$wireDumpLogFile = STDERR + + +### +## Method definition. +# +def methodDef(drv) + drv.soapaction = $soapAction + methodDefBase(drv) + methodDefGroupB(drv) +end + +def methodDefBase(drv) + SOAPBuildersInterop::MethodsBase.each do |name, *params| + drv.add_rpc_operation( + XSD::QName.new(InterfaceNS, name), $soapAction, name, params) + end +end + +def methodDefGroupB(drv) + SOAPBuildersInterop::MethodsGroupB.each do |name, *params| + drv.add_rpc_operation( + XSD::QName.new(InterfaceNS, name), $soapAction, name, params) + end +end + + +### +## Helper function +# +class Float + Precision = 5 + + def ==(rhs) + if rhs.is_a?(Float) + if self.nan? and rhs.nan? + true + elsif self.infinite? == rhs.infinite? + true + elsif (rhs - self).abs <= (10 ** (- Precision)) + true + else + false + end + else + false + end + end +end + +def assert(expected, actual) + if expected == actual + 'OK' + else + "Expected = " << expected.inspect << " // Actual = " << actual.inspect + end +end + +def setWireDumpLogFile(postfix = "") + logFilename = File.basename($0).sub(/\.rb$/, '') << postfix << '.log' + f = File.open(logFilename, 'w') + f << "File: #{ logFilename } - Wiredumps for SOAP4R client / #{ $serverName } server.\n" + f << "Date: #{ Time.now }\n\n" + $wireDumpLogFile = f +end + +def getWireDumpLogFileBase(postfix = "") + File.basename($0).sub(/\.rb$/, '') + postfix +end + +def getIdObj(obj) + case obj + when Array + obj.collect { |ele| + getIdObj(ele) + } + else + # String#== compares content of args. + "#{ obj.class }##{ obj.__id__ }" + end +end + +def dumpTitle(title) + p title + $wireDumpLogFile << "##########\n# " << title << "\n\n" +end + +def dumpNormal(title, expected, actual) + result = assert(expected, actual) + if result == 'OK' + dumpResult(title, true, nil) + else + dumpResult(title, false, result) + end +end + +def dumpException(title) + result = "Exception: #{ $! } (#{ $!.class})\n" << $@.join("\n") + dumpResult(title, false, result) +end + +def dumpResult(title, result, resultStr) + $testResults.add( + SOAPBuildersInteropResult::TestResult.new( + title, + result, + resultStr, + $wireDumpDev.dup + ) + ) + $wireDumpLogFile << "Result: #{ resultStr || 'OK' }\n\n" + $wireDumpLogFile << $wireDumpDev + $wireDumpLogFile << "\n" + + $wireDumpDev.replace('') +end + +def submitTestResult + $testResultDrv.addResults($testResults) +end + +class FakeFloat < SOAP::SOAPFloat + def initialize(str) + super() + @data = str + end + + def to_s + @data.to_s + end +end + +class FakeDateTime < SOAP::SOAPDateTime + def initialize(str) + super() + @data = str + end + + def to_s + @data.to_s + end +end + +class FakeDecimal < SOAP::SOAPDecimal + def initialize(str) + super() + @data = str + end + + def to_s + @data.to_s + end +end + +class FakeInt < SOAP::SOAPInt + def initialize(str) + super() + @data = str + end + + def to_s + @data.to_s + end +end + + +### +## Invoke methods. +# +def doTest(drv) + doTestBase(drv) + doTestGroupB(drv) +end + +def doTestBase(drv) + setWireDumpLogFile('_Base') + drv.wiredump_dev = $wireDumpDev +# drv.wiredump_filebase = getWireDumpLogFileBase('_Base') + + drv.mapping_registry = SOAPBuildersInterop::MappingRegistry + + title = 'echoVoid' + dumpTitle(title) + begin + var = drv.echoVoid() + dumpNormal(title, nil, var) + rescue Exception + dumpException(title) + end + + title = 'echoString' + dumpTitle(title) + begin + arg = "SOAP4R Interoperability Test" + var = drv.echoString(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoString (Entity reference)' + dumpTitle(title) + begin + arg = "<>\"& <>"& &&><<<" + var = drv.echoString(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoString (Character reference)' + dumpTitle(title) + begin + arg = "\x20 \040 \x7f\177" + tobe = " \177\177\177\177" + var = drv.echoString(SOAP::SOAPRawString.new(arg)) + dumpNormal(title, tobe, var) + rescue Exception + dumpException(title) + end + + title = 'echoString (Leading and trailing whitespace)' + dumpTitle(title) + begin + arg = " SOAP4R\nInteroperability\nTest " + var = drv.echoString(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoString (EUC encoded)' + dumpTitle(title) + begin + arg = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + var = drv.echoString(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoString (EUC encoded) again' + dumpTitle(title) + begin + arg = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + var = drv.echoString(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoString (empty)' + dumpTitle(title) + begin + arg = '' + var = drv.echoString(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoString (space)' + dumpTitle(title) + begin + arg = ' ' + var = drv.echoString(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoString (whitespaces:\r \n \t \r \n \t)' + dumpTitle(title) + begin + arg = "\r \n \t \r \n \t" + var = drv.echoString(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoStringArray' + dumpTitle(title) + begin + arg = StringArray["SOAP4R\n", " Interoperability ", "\tTest\t"] + var = drv.echoStringArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + +# title = 'echoStringArray (sparse)' +# dumpTitle(title) +# begin +# arg = [nil, "SOAP4R\n", nil, " Interoperability ", nil, "\tTest\t", nil] +# soapAry = SOAP::Mapping.ary2soap(arg, XSD::Namespace, XSD::StringLiteral, SOAPBuildersInterop::MappingRegistry) +# soapAry.sparse = true +# var = drv.echoStringArray(soapAry) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echoStringArray (multi-ref)' + dumpTitle(title) + begin + str1 = "SOAP4R" + str2 = "SOAP4R" + arg = StringArray[str1, str2, str1] + var = drv.echoStringArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoStringArray (multi-ref: elem1 == elem3)' + dumpTitle(title) + begin + str1 = "SOAP4R" + str2 = "SOAP4R" + arg = StringArray[str1, str2, str1] + var = drv.echoStringArray(arg) + dumpNormal(title, getIdObj(var[0]), getIdObj(var[2])) + rescue Exception + dumpException(title) + end + + title = 'echoStringArray (empty, multi-ref: elem1 == elem3)' + dumpTitle(title) + begin + str1 = "" + str2 = "" + arg = StringArray[str1, str2, str1] + var = drv.echoStringArray(arg) + dumpNormal(title, getIdObj(var[0]), getIdObj(var[2])) + rescue Exception + dumpException(title) + end + +# title = 'echoStringArray (sparse, multi-ref)' +# dumpTitle(title) +# begin +# str = "SOAP4R" +# arg = StringArray[nil, nil, nil, nil, nil, str, nil, str] +# soapAry = SOAP::Mapping.ary2soap(arg, XSD::Namespace, XSD::StringLiteral, SOAPBuildersInterop::MappingRegistry) +# soapAry.sparse = true +# var = drv.echoStringArray(soapAry) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echoInteger (Int: 123)' + dumpTitle(title) + begin + arg = 123 + var = drv.echoInteger(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoInteger (Int: 2147483647)' + dumpTitle(title) + begin + arg = 2147483647 + var = drv.echoInteger(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoInteger (Int: -2147483648)' + dumpTitle(title) + begin + arg = -2147483648 + var = drv.echoInteger(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoInteger (2147483648: junk)' + dumpTitle(title) + begin + begin + arg = FakeInt.new("2147483648") + var = drv.echoInteger(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoInteger (-2147483649: junk)' + dumpTitle(title) + begin + begin + arg = FakeInt.new("-2147483649") + var = drv.echoInteger(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoInteger (0.0: junk)' + dumpTitle(title) + begin + begin + arg = FakeInt.new("0.0") + var = drv.echoInteger(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoInteger (-5.2: junk)' + dumpTitle(title) + begin + begin + arg = FakeInt.new("-5.2") + var = drv.echoInteger(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoInteger (0.000000000a: junk)' + dumpTitle(title) + begin + begin + arg = FakeInt.new("0.000000000a") + var = drv.echoInteger(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoInteger (+-5: junk)' + dumpTitle(title) + begin + begin + arg = FakeInt.new("+-5") + var = drv.echoInteger(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoIntegerArray' + dumpTitle(title) + begin + arg = IntArray[1, 2, 3] + var = drv.echoIntegerArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + +# title = 'echoIntegerArray (nil)' +# dumpTitle(title) +# begin +# arg = IntArray[nil, nil, nil] +# var = drv.echoIntegerArray(arg) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echoIntegerArray (empty)' + dumpTitle(title) + begin + arg = SOAP::SOAPArray.new(SOAP::ValueArrayName, 1, XSD::XSDInt::Type) + var = drv.echoIntegerArray(arg) + dumpNormal(title, [], var) + rescue Exception + dumpException(title) + end + +# title = 'echoIntegerArray (sparse)' +# dumpTitle(title) +# begin +# arg = [nil, 1, nil, 2, nil, 3, nil] +# soapAry = SOAP::Mapping.ary2soap(arg, XSD::Namespace, XSD::XSDInt::Type, SOAPBuildersInterop::MappingRegistry) +# soapAry.sparse = true +# var = drv.echoIntegerArray(soapAry) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echoFloat' + dumpTitle(title) + begin + arg = 3.14159265358979 + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (scientific notation)' + dumpTitle(title) + begin + arg = 12.34e36 + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (scientific notation 2)' + dumpTitle(title) + begin + arg = FakeFloat.new("12.34e36") + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, 12.34e36, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (scientific notation 3)' + dumpTitle(title) + begin + arg = FakeFloat.new("12.34E+36") + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, 12.34e36, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (scientific notation 4)' + dumpTitle(title) + begin + arg = FakeFloat.new("-1.4E") + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, 1.4, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (positive lower boundary)' + dumpTitle(title) + begin + arg = 1.4e-45 + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (negative lower boundary)' + dumpTitle(title) + begin + arg = -1.4e-45 + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (special values: +0)' + dumpTitle(title) + begin + arg = 0.0 + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (special values: -0)' + dumpTitle(title) + begin + arg = (-1.0 / (1.0 / 0.0)) + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (special values: NaN)' + dumpTitle(title) + begin + arg = 0.0/0.0 + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (special values: INF)' + dumpTitle(title) + begin + arg = 1.0/0.0 + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (special values: -INF)' + dumpTitle(title) + begin + arg = -1.0/0.0 + var = drv.echoFloat(SOAPFloat.new(arg)) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloat (0.000a: junk)' + dumpTitle(title) + begin + begin + arg = FakeFloat.new("0.0000000000000000a") + var = drv.echoFloat(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoFloat (00a.0001: junk)' + dumpTitle(title) + begin + begin + arg = FakeFloat.new("00a.000000000000001") + var = drv.echoFloat(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoFloat (+-5: junk)' + dumpTitle(title) + begin + begin + arg = FakeFloat.new("+-5") + var = drv.echoFloat(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoFloat (5_0: junk)' + dumpTitle(title) + begin + begin + arg = FakeFloat.new("5_0") + var = drv.echoFloat(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoFloatArray' + dumpTitle(title) + begin + arg = FloatArray[SOAPFloat.new(0.0001), SOAPFloat.new(1000.0), SOAPFloat.new(0.0)] + var = drv.echoFloatArray(arg) + dumpNormal(title, arg.collect { |ele| ele.data }, var) + rescue Exception + dumpException(title) + end + + title = 'echoFloatArray (special values: NaN, INF, -INF)' + dumpTitle(title) + begin + nan = SOAPFloat.new(0.0/0.0) + inf = SOAPFloat.new(1.0/0.0) + inf_ = SOAPFloat.new(-1.0/0.0) + arg = FloatArray[nan, inf, inf_] + var = drv.echoFloatArray(arg) + dumpNormal(title, arg.collect { |ele| ele.data }, var) + rescue Exception + dumpException(title) + end + +# title = 'echoFloatArray (sparse)' +# dumpTitle(title) +# begin +# arg = [nil, nil, 0.0001, 1000.0, 0.0, nil, nil] +# soapAry = SOAP::Mapping.ary2soap(arg, XSD::Namespace, XSD::FloatLiteral, SOAPBuildersInterop::MappingRegistry) +# soapAry.sparse = true +# var = drv.echoFloatArray(soapAry) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echoStruct' + dumpTitle(title) + begin + arg = SOAPStruct.new(1, 1.1, "a") + var = drv.echoStruct(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoStruct (nil members)' + dumpTitle(title) + begin + arg = SOAPStruct.new(nil, nil, nil) + var = drv.echoStruct(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoStructArray' + dumpTitle(title) + begin + s1 = SOAPStruct.new(1, 1.1, "a") + s2 = SOAPStruct.new(2, 2.2, "b") + s3 = SOAPStruct.new(3, 3.3, "c") + arg = SOAPStructArray[s1, s2, s3] + var = drv.echoStructArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoStructArray (anyType Array)' + dumpTitle(title) + begin + s1 = SOAPStruct.new(1, 1.1, "a") + s2 = SOAPStruct.new(2, 2.2, "b") + s3 = SOAPStruct.new(3, 3.3, "c") + arg = [s1, s2, s3] + var = drv.echoStructArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + +# title = 'echoStructArray (sparse)' +# dumpTitle(title) +# begin +# s1 = SOAPStruct.new(1, 1.1, "a") +# s2 = SOAPStruct.new(2, 2.2, "b") +# s3 = SOAPStruct.new(3, 3.3, "c") +# arg = [nil, s1, s2, s3] +# soapAry = SOAP::Mapping.ary2soap(arg, TypeNS, "SOAPStruct", SOAPBuildersInterop::MappingRegistry) +# soapAry.sparse = true +# var = drv.echoStructArray(soapAry) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echoStructArray (multi-ref)' + dumpTitle(title) + begin + s1 = SOAPStruct.new(1, 1.1, "a") + s2 = SOAPStruct.new(2, 2.2, "b") + arg = SOAPStructArray[s1, s1, s2] + var = drv.echoStructArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoStructArray (multi-ref: elem1 == elem2)' + dumpTitle(title) + begin + s1 = SOAPStruct.new(1, 1.1, "a") + s2 = SOAPStruct.new(2, 2.2, "b") + arg = SOAPStructArray[s1, s1, s2] + var = drv.echoStructArray(arg) + dumpNormal(title, getIdObj(var[0]), getIdObj(var[1])) + rescue Exception + dumpException(title) + end + + title = 'echoStructArray (anyType Array, multi-ref: elem2 == elem3)' + dumpTitle(title) + begin + s1 = SOAPStruct.new(1, 1.1, "a") + s2 = SOAPStruct.new(2, 2.2, "b") + arg = [s1, s2, s2] + var = drv.echoStructArray(arg) + dumpNormal(title, getIdObj(var[1]), getIdObj(var[2])) + rescue Exception + dumpException(title) + end + +# title = 'echoStructArray (sparse, multi-ref)' +# dumpTitle(title) +# begin +# s1 = SOAPStruct.new(1, 1.1, "a") +# s2 = SOAPStruct.new(2, 2.2, "b") +# arg = [nil, s1, nil, nil, s2, nil, s2] +# soapAry = SOAP::Mapping.ary2soap(arg, TypeNS, "SOAPStruct", SOAPBuildersInterop::MappingRegistry) +# soapAry.sparse = true +# var = drv.echoStructArray(soapAry) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + +# title = 'echoStructArray (sparse, multi-ref: elem5 == elem7)' +# dumpTitle(title) +# begin +# s1 = SOAPStruct.new(1, 1.1, "a") +# s2 = SOAPStruct.new(2, 2.2, "b") +# arg = [nil, s1, nil, nil, s2, nil, s2] +# soapAry = SOAP::Mapping.ary2soap(arg, TypeNS, "SOAPStruct", SOAPBuildersInterop::MappingRegistry) +# soapAry.sparse = true +# var = drv.echoStructArray(soapAry) +# dumpNormal(title, getIdObj(var[4]), getIdObj(var[6])) +# rescue Exception +# dumpException(title) +# end + + title = 'echoStructArray (multi-ref: varString of elem1 == varString of elem2)' + dumpTitle(title) + begin + str1 = "a" + str2 = "a" + s1 = SOAPStruct.new(1, 1.1, str1) + s2 = SOAPStruct.new(2, 2.2, str1) + s3 = SOAPStruct.new(3, 3.3, str2) + arg = SOAPStructArray[s1, s2, s3] + var = drv.echoStructArray(arg) + dumpNormal(title, getIdObj(var[0].varString), getIdObj(var[1].varString)) + rescue Exception + dumpException(title) + end + + title = 'echoStructArray (anyType Array, multi-ref: varString of elem2 == varString of elem3)' + dumpTitle(title) + begin + str1 = "b" + str2 = "b" + s1 = SOAPStruct.new(1, 1.1, str2) + s2 = SOAPStruct.new(2, 2.2, str1) + s3 = SOAPStruct.new(3, 3.3, str1) + arg = [s1, s2, s3] + var = drv.echoStructArray(arg) + dumpNormal(title, getIdObj(var[1].varString), getIdObj(var[2].varString)) + rescue Exception + dumpException(title) + end + +# title = 'echoStructArray (sparse, multi-ref: varString of elem5 == varString of elem7)' +# dumpTitle(title) +# begin +# str1 = "c" +# str2 = "c" +# s1 = SOAPStruct.new(1, 1.1, str2) +# s2 = SOAPStruct.new(2, 2.2, str1) +# s3 = SOAPStruct.new(3, 3.3, str1) +# arg = [nil, s1, nil, nil, s2, nil, s3] +# soapAry = SOAP::Mapping.ary2soap(arg, TypeNS, "SOAPStruct", SOAPBuildersInterop::MappingRegistry) +# soapAry.sparse = true +# var = drv.echoStructArray(soapAry) +# dumpNormal(title, getIdObj(var[4].varString), getIdObj(var[6].varString)) +# rescue Exception +# dumpException(title) +# end + +# title = 'echoStructArray (2D Array)' +# dumpTitle(title) +# begin +# s1 = SOAPStruct.new(1, 1.1, "a") +# s2 = SOAPStruct.new(2, 2.2, "b") +# s3 = SOAPStruct.new(3, 3.3, "c") +# arg = [ +# [s1, nil, s2], +# [nil, s2, s3], +# ] +# md = SOAP::Mapping.ary2md(arg, 2, XSD::Namespace, XSD::AnyTypeLiteral, SOAPBuildersInterop::MappingRegistry) +# +# var = drv.echoStructArray(md) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end +# +# title = 'echoStructArray (2D Array, sparse)' +# dumpTitle(title) +# begin +# s1 = SOAPStruct.new(1, 1.1, "a") +# s2 = SOAPStruct.new(2, 2.2, "b") +# s3 = SOAPStruct.new(3, 3.3, "c") +# arg = [ +# [s1, nil, s2], +# [nil, s2, s3], +# ] +# md = SOAP::Mapping.ary2md(arg, 2, TypeNS, "SOAPStruct", SOAPBuildersInterop::MappingRegistry) +## md.sparse = true +# +# var = drv.echoStructArray(md) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end +# +# title = 'echoStructArray (anyType, 2D Array, sparse)' +# dumpTitle(title) +# begin +# s1 = SOAPStruct.new(1, 1.1, "a") +# s2 = SOAPStruct.new(2, 2.2, "b") +# s3 = SOAPStruct.new(3, 3.3, "c") +# arg = [ +# [s1, nil, s2], +# [nil, s2, s3], +# ] +# md = SOAP::Mapping.ary2md(arg, 2, XSD::Namespace, XSD::AnyTypeLiteral, SOAPBuildersInterop::MappingRegistry) +# md.sparse = true +# +# var = drv.echoStructArray(md) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echoDate (now)' + dumpTitle(title) + begin + t = Time.now.gmtime + arg = DateTime.new(t.year, t.mon, t.mday, t.hour, t.min, t.sec) + var = drv.echoDate(arg) + dumpNormal(title, arg.to_s, var.to_s) + rescue Exception + dumpException(title) + end + + title = 'echoDate (before 1970: 1-01-01T00:00:00Z)' + dumpTitle(title) + begin + t = Time.now.gmtime + arg = DateTime.new(1, 1, 1, 0, 0, 0) + var = drv.echoDate(arg) + dumpNormal(title, arg.to_s, var.to_s) + rescue Exception + dumpException(title) + end + + title = 'echoDate (after 2038: 2038-12-31T00:00:00Z)' + dumpTitle(title) + begin + t = Time.now.gmtime + arg = DateTime.new(2038, 12, 31, 0, 0, 0) + var = drv.echoDate(arg) + dumpNormal(title, arg.to_s, var.to_s) + rescue Exception + dumpException(title) + end + + title = 'echoDate (negative: -10-01-01T00:00:00Z)' + dumpTitle(title) + begin + t = Time.now.gmtime + arg = DateTime.new(-10, 1, 1, 0, 0, 0) + var = drv.echoDate(arg) + dumpNormal(title, arg.to_s, var.to_s) + rescue Exception + dumpException(title) + end + + title = 'echoDate (time precision: msec)' + dumpTitle(title) + begin + arg = SOAP::SOAPDateTime.new('2001-06-16T18:13:40.012') + argDate = arg.data + var = drv.echoDate(arg) + dumpNormal(title, argDate, var) + rescue Exception + dumpException(title) + end + + title = 'echoDate (time precision: long)' + dumpTitle(title) + begin + arg = SOAP::SOAPDateTime.new('2001-06-16T18:13:40.0000000000123456789012345678900000000000') + argDate = arg.data + var = drv.echoDate(arg) + dumpNormal(title, argDate, var) + rescue Exception + dumpException(title) + end + + title = 'echoDate (positive TZ)' + dumpTitle(title) + begin + arg = SOAP::SOAPDateTime.new('2001-06-17T01:13:40+07:00') + argNormalized = DateTime.new(2001, 6, 16, 18, 13, 40) + var = drv.echoDate(arg) + dumpNormal(title, argNormalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDate (negative TZ)' + dumpTitle(title) + begin + arg = SOAP::SOAPDateTime.new('2001-06-16T18:13:40-07:00') + argNormalized = DateTime.new(2001, 6, 17, 1, 13, 40) + var = drv.echoDate(arg) + dumpNormal(title, argNormalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDate (+00:00 TZ)' + dumpTitle(title) + begin + arg = SOAP::SOAPDateTime.new('2001-06-17T01:13:40+00:00') + argNormalized = DateTime.new(2001, 6, 17, 1, 13, 40) + var = drv.echoDate(arg) + dumpNormal(title, argNormalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDate (-00:00 TZ)' + dumpTitle(title) + begin + arg = SOAP::SOAPDateTime.new('2001-06-17T01:13:40-00:00') + argNormalized = DateTime.new(2001, 6, 17, 1, 13, 40) + var = drv.echoDate(arg) + dumpNormal(title, argNormalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDate (min TZ)' + dumpTitle(title) + begin + arg = SOAP::SOAPDateTime.new('2001-06-16T00:00:01+00:01') + argNormalized = DateTime.new(2001, 6, 15, 23, 59, 1) + var = drv.echoDate(arg) + dumpNormal(title, argNormalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDate (year > 9999)' + dumpTitle(title) + begin + arg = SOAP::SOAPDateTime.new('10000-06-16T18:13:40-07:00') + argNormalized = DateTime.new(10000, 6, 17, 1, 13, 40) + var = drv.echoDate(arg) + dumpNormal(title, argNormalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDate (year < 0)' + dumpTitle(title) + begin + arg = SOAP::SOAPDateTime.new('-0001-06-16T18:13:40-07:00') + argNormalized = DateTime.new(0, 6, 17, 1, 13, 40) + var = drv.echoDate(arg) + dumpNormal(title, argNormalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDate (year == -4713)' + dumpTitle(title) + begin + arg = SOAP::SOAPDateTime.new('-4713-01-01T12:00:00') + argNormalized = DateTime.new(-4712, 1, 1, 12, 0, 0) + var = drv.echoDate(arg) + dumpNormal(title, argNormalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDate (year 0000: junk)' + dumpTitle(title) + begin + begin + arg = FakeDateTime.new("0000-05-18T16:52:20Z") + var = drv.echoDate(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoDate (year nn: junk)' + dumpTitle(title) + begin + begin + arg = FakeDateTime.new("05-05-18T16:52:20Z") + var = drv.echoDate(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoDate (no day part: junk)' + dumpTitle(title) + begin + begin + arg = FakeDateTime.new("2002-05T16:52:20Z") + var = drv.echoDate(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoDate (no sec part: junk)' + dumpTitle(title) + begin + begin + arg = FakeDateTime.new("2002-05-18T16:52Z") + var = drv.echoDate(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoDate (empty: junk)' + dumpTitle(title) + begin + begin + arg = FakeDateTime.new("") + var = drv.echoDate(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoBase64 (xsd:base64Binary)' + dumpTitle(title) + begin + str = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + arg = SOAP::SOAPBase64.new(str) + arg.as_xsd # Force xsd:base64Binary instead of soap-enc:base64 + var = drv.echoBase64(arg) + dumpNormal(title, str, var) + rescue Exception + dumpException(title) + end + + title = 'echoBase64 (xsd:base64Binary, empty)' + dumpTitle(title) + begin + str = "" + arg = SOAP::SOAPBase64.new(str) + arg.as_xsd # Force xsd:base64Binary instead of soap-enc:base64 + var = drv.echoBase64(arg) + dumpNormal(title, str, var) + rescue Exception + dumpException(title) + end + + title = 'echoBase64 (SOAP-ENC:base64)' + dumpTitle(title) + begin + str = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + arg = SOAP::SOAPBase64.new(str) + var = drv.echoBase64(arg) + dumpNormal(title, str, var) + rescue Exception + dumpException(title) + end + + title = 'echoBase64 (\0)' + dumpTitle(title) + begin + str = "\0" + arg = SOAP::SOAPBase64.new(str) + var = drv.echoBase64(arg) + dumpNormal(title, str, var) + rescue Exception + dumpException(title) + end + + title = 'echoBase64 (\0a\0)' + dumpTitle(title) + begin + str = "a\0b\0\0c\0\0\0" + arg = SOAP::SOAPBase64.new(str) + var = drv.echoBase64(arg) + dumpNormal(title, str, var) + rescue Exception + dumpException(title) + end + + title = 'echoBase64 (-: junk)' + dumpTitle(title) + begin + begin + arg = SOAP::SOAPBase64.new("dummy") + arg.instance_eval { @data = '-' } + var = drv.echoBase64(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoHexBinary' + dumpTitle(title) + begin + str = "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" + arg = SOAP::SOAPHexBinary.new(str) + var = drv.echoHexBinary(arg) + dumpNormal(title, str, var) + rescue Exception + dumpException(title) + end + + title = 'echoHexBinary(empty)' + dumpTitle(title) + begin + str = "" + arg = SOAP::SOAPHexBinary.new(str) + var = drv.echoHexBinary(arg) + dumpNormal(title, str, var) + rescue Exception + dumpException(title) + end + + title = 'echoHexBinary(\0)' + dumpTitle(title) + begin + str = "\0" + arg = SOAP::SOAPHexBinary.new(str) + var = drv.echoHexBinary(arg) + dumpNormal(title, str, var) + rescue Exception + dumpException(title) + end + + title = 'echoHexBinary(\0a\0)' + dumpTitle(title) + begin + str = "a\0b\0\0c\0\0\0" + arg = SOAP::SOAPHexBinary.new(str) + var = drv.echoHexBinary(arg) + dumpNormal(title, str, var) + rescue Exception + dumpException(title) + end + + title = 'echoHexBinary(lower case)' + dumpTitle(title) + begin + str = "lower case" + arg = SOAP::SOAPHexBinary.new + arg.set_encoded((str.unpack("H*")[0]).tr('A-F', 'a-f')) + var = drv.echoHexBinary(arg) + dumpNormal(title, str, var) + rescue Exception + dumpException(title) + end + + title = 'echoHexBinary (0FG7: junk)' + dumpTitle(title) + begin + begin + arg = SOAP::SOAPHexBinary.new("dummy") + arg.instance_eval { @data = '0FG7' } + var = drv.echoHexBinary(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoBoolean (true)' + dumpTitle(title) + begin + arg = true + var = drv.echoBoolean(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoBoolean (false)' + dumpTitle(title) + begin + arg = false + var = drv.echoBoolean(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoBoolean (junk)' + dumpTitle(title) + begin + begin + arg = SOAP::SOAPBoolean.new(true) + arg.instance_eval { @data = 'junk' } + var = drv.echoBoolean(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoDecimal (123456)' + dumpTitle(title) + begin + arg = "123456789012345678" + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + normalized = arg + dumpNormal(title, normalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDecimal (+0.123)' + dumpTitle(title) + begin + arg = "+0.12345678901234567" + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + normalized = arg.sub(/0$/, '').sub(/^\+/, '') + dumpNormal(title, normalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDecimal (.00000123)' + dumpTitle(title) + begin + arg = ".00000123456789012" + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + normalized = '0' << arg.sub(/0$/, '') + dumpNormal(title, normalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDecimal (-.00000123)' + dumpTitle(title) + begin + arg = "-.00000123456789012" + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + normalized = '-0' << arg.sub(/0$/, '').sub(/-/, '') + dumpNormal(title, normalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDecimal (-123.456)' + dumpTitle(title) + begin + arg = "-123456789012345.008" + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoDecimal (-123.)' + dumpTitle(title) + begin + arg = "-12345678901234567." + normalized = arg.sub(/\.$/, '') + var = drv.echoDecimal(SOAP::SOAPDecimal.new(arg)) + dumpNormal(title, normalized, var) + rescue Exception + dumpException(title) + end + + title = 'echoDecimal (0.000a: junk)' + dumpTitle(title) + begin + begin + arg = FakeDecimal.new("0.0000000000000000a") + var = drv.echoDecimal(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoDecimal (00a.0001: junk)' + dumpTitle(title) + begin + begin + arg = FakeDecimal.new("00a.000000000000001") + var = drv.echoDecimal(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoDecimal (+-5: junk)' + dumpTitle(title) + begin + begin + arg = FakeDecimal.new("+-5") + var = drv.echoDecimal(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + + title = 'echoDecimal (5_0: junk)' + dumpTitle(title) + begin + begin + arg = FakeDecimal.new("5_0") + var = drv.echoDecimal(arg) + dumpNormal(title, 'Fault', 'No error occurred.') + rescue SOAP::RPC::ServerException, SOAP::FaultError + dumpNormal(title, true, true) + end + rescue Exception + dumpException(title) + end + +if false # unless $noEchoMap + + title = 'echoMap' + dumpTitle(title) + begin + arg = { "a" => 1, "b" => 2 } + var = drv.echoMap(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoMap (boolean, base64, nil, float)' + dumpTitle(title) + begin + arg = { true => "\0", "\0" => nil, nil => 0.0001, 0.0001 => false } + var = drv.echoMap(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoMap (multibyte char)' + dumpTitle(title) + begin + arg = { "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" => 1, 1 => "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" } + var = drv.echoMap(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoMap (Struct)' + dumpTitle(title) + begin + obj = SOAPStruct.new(1, 1.1, "a") + arg = { 1 => obj, 2 => obj } + var = drv.echoMap(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoMap (multi-ref: value for key "a" == value for key "b")' + dumpTitle(title) + begin + value = "c" + arg = { "a" => value, "b" => value } + var = drv.echoMap(arg) + dumpNormal(title, getIdObj(var["a"]), getIdObj(var["b"])) + rescue Exception + dumpException(title) + end + + title = 'echoMap (Struct, multi-ref: varString of a key == varString of a value)' + dumpTitle(title) + begin + str = "" + obj = SOAPStruct.new(1, 1.1, str) + arg = { obj => "1", "1" => obj } + var = drv.echoMap(arg) + dumpNormal(title, getIdObj(var.index("1").varString), getIdObj(var.fetch("1").varString)) + rescue Exception + dumpException(title) + end + + title = 'echoMapArray' + dumpTitle(title) + begin + map1 = { "a" => 1, "b" => 2 } + map2 = { "a" => 1, "b" => 2 } + map3 = { "a" => 1, "b" => 2 } + arg = [map1, map2, map3] + var = drv.echoMapArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoMapArray (boolean, base64, nil, float)' + dumpTitle(title) + begin + map1 = { true => "\0", "\0" => nil, nil => 0.0001, 0.0001 => false } + map2 = { true => "\0", "\0" => nil, nil => 0.0001, 0.0001 => false } + map3 = { true => "\0", "\0" => nil, nil => 0.0001, 0.0001 => false } + arg = [map1, map2, map3] + var = drv.echoMapArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + +# title = 'echoMapArray (sparse)' +# dumpTitle(title) +# begin +# map1 = { "a" => 1, "b" => 2 } +# map2 = { "a" => 1, "b" => 2 } +# map3 = { "a" => 1, "b" => 2 } +# arg = [nil, nil, map1, nil, map2, nil, map3, nil, nil] +# soapAry = SOAP::Mapping.ary2soap(arg, ApacheNS, "Map", SOAPBuildersInterop::MappingRegistry) +# soapAry.sparse = true +# var = drv.echoMapArray(soapAry) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echoMapArray (multibyte char)' + dumpTitle(title) + begin + map1 = { "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" => 1, 1 => "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" } + map2 = { "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" => 1, 1 => "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" } + map3 = { "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" => 1, 1 => "Hello (ÆüËܸìJapanese) ¤³¤ó¤Ë¤Á¤Ï" } + arg = [map1, map2, map3] + var = drv.echoMapArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + +# title = 'echoMapArray (sparse, multi-ref)' +# dumpTitle(title) +# begin +# map1 = { "a" => 1, "b" => 2 } +# map2 = { "a" => 1, "b" => 2 } +# arg = [nil, nil, map1, nil, map2, nil, map1, nil, nil] +# soapAry = SOAP::Mapping.ary2soap(arg, ApacheNS, "Map", SOAPBuildersInterop::MappingRegistry) +# soapAry.sparse = true +# var = drv.echoMapArray(soapAry) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echoMapArray (multi-ref: elem1 == elem2)' + dumpTitle(title) + begin + map1 = { "a" => 1, "b" => 2 } + map2 = { "a" => 1, "b" => 2 } + arg = [map1, map1, map2] + var = drv.echoMapArray(arg) + dumpNormal(title, getIdObj(var[0]), getIdObj(var[1])) + rescue Exception + dumpException(title) + end +end + +end + + +### +## Invoke methods. +# +def doTestGroupB(drv) + setWireDumpLogFile('_GroupB') + drv.wiredump_dev = $wireDumpDev +# drv.wiredump_filebase = getWireDumpLogFileBase('_GroupB') + + drv.mapping_registry = SOAPBuildersInterop::MappingRegistry + + title = 'echoStructAsSimpleTypes' + dumpTitle(title) + begin + arg = SOAPStruct.new(1, 1.1, "a") + ret, out1, out2 = drv.echoStructAsSimpleTypes(arg) + var = SOAPStruct.new(out1, out2, ret) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoStructAsSimpleTypes (nil)' + dumpTitle(title) + begin + arg = SOAPStruct.new(nil, nil, nil) + ret, out1, out2 = drv.echoStructAsSimpleTypes(arg) + var = SOAPStruct.new(out1, out2, ret) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoSimpleTypesAsStruct' + dumpTitle(title) + begin + arg = SOAPStruct.new(1, 1.1, "a") + var = drv.echoSimpleTypesAsStruct(arg.varString, arg.varInt, arg.varFloat) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoSimpleTypesAsStruct (nil)' + dumpTitle(title) + begin + arg = SOAPStruct.new(nil, nil, nil) + var = drv.echoSimpleTypesAsStruct(arg.varString, arg.varInt, arg.varFloat) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echo2DStringArray' + dumpTitle(title) + begin + +# arg = SOAP::SOAPArray.new(SOAP::ValueArrayName, 2, XSD::XSDString::Type) +# arg[0, 0] = obj2soap('r0c0') +# arg[1, 0] = obj2soap('r1c0') +# arg[2, 0] = obj2soap('r2c0') +# arg[0, 1] = obj2soap('r0c1') +# arg[1, 1] = obj2soap('r1c1') +# arg[2, 1] = obj2soap('r2c1') +# arg[0, 2] = obj2soap('r0c2') +# arg[1, 2] = obj2soap('r1c2') +# arg[2, 2] = obj2soap('r2c2') + + arg = SOAP::SOAPArray.new(XSD::QName.new('http://soapinterop.org/xsd', 'ArrayOfString2D'), 2, XSD::XSDString::Type) + arg.size = [3, 3] + arg.size_fixed = true + arg.add(SOAP::Mapping.obj2soap('r0c0', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r1c0', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r2c0', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r0c1', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r1c1', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r2c1', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r0c2', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r1c2', SOAPBuildersInterop::MappingRegistry)) + arg.add(SOAP::Mapping.obj2soap('r2c2', SOAPBuildersInterop::MappingRegistry)) + argNormalized = [ + ['r0c0', 'r1c0', 'r2c0'], + ['r0c1', 'r1c1', 'r2c1'], + ['r0c2', 'r1c2', 'r2c2'], + ] + + var = drv.echo2DStringArray(arg) + dumpNormal(title, argNormalized, var) + rescue Exception + dumpException(title) + end + + title = 'echo2DStringArray (anyType array)' + dumpTitle(title) + begin + # ary2md converts Arry ((of Array)...) into M-D anyType Array + arg = [ + ['r0c0', 'r0c1', 'r0c2'], + ['r1c0', 'r1c1', 'r1c2'], + ['r2c0', 'r0c1', 'r2c2'], + ] + + paramArg = SOAP::Mapping.ary2md(arg, 2, XSD::Namespace, XSD::AnyTypeLiteral, SOAPBuildersInterop::MappingRegistry) + paramArg.type = XSD::QName.new('http://soapinterop.org/xsd', 'ArrayOfString2D') + var = drv.echo2DStringArray(paramArg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + +# title = 'echo2DStringArray (sparse)' +# dumpTitle(title) +# begin +# # ary2md converts Arry ((of Array)...) into M-D anyType Array +# arg = [ +# ['r0c0', nil, 'r0c2'], +# [nil, 'r1c1', 'r1c2'], +# ] +# md = SOAP::Mapping.ary2md(arg, 2, XSD::Namespace, XSD::StringLiteral, SOAPBuildersInterop::MappingRegistry) +# md.sparse = true +# +# var = drv.echo2DStringArray(md) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + +# title = 'echo2DStringArray (anyType, sparse)' +# dumpTitle(title) +# begin +# # ary2md converts Arry ((of Array)...) into M-D anyType Array +# arg = [ +# ['r0c0', nil, 'r0c2'], +# [nil, 'r1c1', 'r1c2'], +# ] +# md = SOAP::Mapping.ary2md(arg, 2, XSD::Namespace, XSD::StringLiteral, SOAPBuildersInterop::MappingRegistry) +# md.sparse = true +# +# var = drv.echo2DStringArray(md) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echo2DStringArray (multi-ref)' + dumpTitle(title) + begin + arg = SOAP::SOAPArray.new(XSD::QName.new('http://soapinterop.org/xsd', 'ArrayOfString2D'), 2, XSD::XSDString::Type) + arg.size = [3, 3] + arg.size_fixed = true + + item = 'item' + arg.add('r0c0') + arg.add('r1c0') + arg.add(item) + arg.add('r0c1') + arg.add('r1c1') + arg.add('r2c1') + arg.add(item) + arg.add('r1c2') + arg.add('r2c2') + argNormalized = [ + ['r0c0', 'r1c0', 'item'], + ['r0c1', 'r1c1', 'r2c1'], + ['item', 'r1c2', 'r2c2'], + ] + + var = drv.echo2DStringArray(arg) + dumpNormal(title, argNormalized, var) + rescue Exception + dumpException(title) + end + + title = 'echo2DStringArray (multi-ref: ele[2, 0] == ele[0, 2])' + dumpTitle(title) + begin + arg = SOAP::SOAPArray.new(XSD::QName.new('http://soapinterop.org/xsd', 'ArrayOfString2D'), 2, XSD::XSDString::Type) + arg.size = [3, 3] + arg.size_fixed = true + + item = 'item' + arg.add('r0c0') + arg.add('r1c0') + arg.add(item) + arg.add('r0c1') + arg.add('r1c1') + arg.add('r2c1') + arg.add(item) + arg.add('r1c2') + arg.add('r2c2') + + var = drv.echo2DStringArray(arg) + dumpNormal(title, getIdObj(var[2][0]), getIdObj(var[0][2])) + rescue Exception + dumpException(title) + end + +# title = 'echo2DStringArray (sparse, multi-ref)' +# dumpTitle(title) +# begin +# # ary2md converts Arry ((of Array)...) into M-D anyType Array +# str = "BANG!" +# arg = [ +# ['r0c0', nil, str ], +# [nil, str, 'r1c2'], +# ] +# md = SOAP::Mapping.ary2md(arg, 2, XSD::Namespace, XSD::StringLiteral, SOAPBuildersInterop::MappingRegistry) +# md.sparse = true +# +# var = drv.echo2DStringArray(md) +# dumpNormal(title, arg, var) +# rescue Exception +# dumpException(title) +# end + + title = 'echoNestedStruct' + dumpTitle(title) + begin + arg = SOAPStructStruct.new(1, 1.1, "a", + SOAPStruct.new(2, 2.2, "b") + ) + var = drv.echoNestedStruct(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoNestedStruct (nil)' + dumpTitle(title) + begin + arg = SOAPStructStruct.new(nil, nil, nil, + SOAPStruct.new(nil, nil, nil) + ) + var = drv.echoNestedStruct(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoNestedStruct (multi-ref: varString of StructStruct == varString of Struct)' + dumpTitle(title) + begin + str1 = "" + arg = SOAPStructStruct.new(1, 1.1, str1, + SOAPStruct.new(2, 2.2, str1) + ) + var = drv.echoNestedStruct(arg) + dumpNormal(title, getIdObj(var.varString), getIdObj(var.varStruct.varString)) + rescue Exception + dumpException(title) + end + + title = 'echoNestedArray' + dumpTitle(title) + begin + arg = SOAPArrayStruct.new(1, 1.1, "a", StringArray["2", "2.2", "b"]) + var = drv.echoNestedArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoNestedArray (anyType array)' + dumpTitle(title) + begin + arg = SOAPArrayStruct.new(1, 1.1, "a", ["2", "2.2", "b"]) + var = drv.echoNestedArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoNestedArray (multi-ref)' + dumpTitle(title) + begin + str = "" + arg = SOAPArrayStruct.new(1, 1.1, str, StringArray["2", str, "b"]) + var = drv.echoNestedArray(arg) + dumpNormal(title, arg, var) + rescue Exception + dumpException(title) + end + + title = 'echoNestedArray (multi-ref: varString == varArray[1])' + dumpTitle(title) + begin + str = "" + arg = SOAPArrayStruct.new(1, 1.1, str, StringArray["2", str, "b"]) + var = drv.echoNestedArray(arg) + dumpNormal(title, getIdObj(var.varString), getIdObj(var.varArray[1])) + rescue Exception + dumpException(title) + end + +# title = 'echoNestedArray (sparse, multi-ref)' +# dumpTitle(title) +# begin +# str = "!" +# subAry = [nil, nil, str, nil, str, nil] +# ary = SOAP::Mapping.ary2soap(subAry, XSD::Namespace, XSD::StringLiteral, SOAPBuildersInterop::MappingRegistry) +# ary.sparse = true +# arg = SOAPArrayStruct.new(1, 1.1, str, ary) +# argNormalized = SOAPArrayStruct.new(1, 1.1, str, subAry) +# var = drv.echoNestedArray(arg) +# dumpNormal(title, argNormalized, var) +# rescue Exception +# dumpException(title) +# end + +end diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientCapeConnect.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientCapeConnect.rb new file mode 100644 index 00000000..32a91470 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientCapeConnect.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +$serverName = 'CapeConnect' + +$server = 'http://interop.capeclear.com/ccx/soapbuilders-round2' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDefBase(drvBase) + +#drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +#methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +#doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientDelphi.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientDelphi.rb new file mode 100644 index 00000000..344b098f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientDelphi.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +$serverName = 'Delphi' + +$serverBase = 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropService.exe/soap/InteropTestPortType' +$serverGroupB = 'http://soap-server.borland.com/WebServices/Interop/cgi-bin/InteropGroupB.exe/soap/InteropTestPortTypeB' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientEasySoap.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientEasySoap.rb new file mode 100644 index 00000000..579decbe --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientEasySoap.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +$serverName = 'EasySoap++' + +$server = 'http://easysoap.sourceforge.net/cgi-bin/interopserver' + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDef(drv) + +doTestBase(drv) +doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientFrontier.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientFrontier.rb new file mode 100644 index 00000000..ce569217 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientFrontier.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby + +$serverName = 'Frontier' + +$serverBase = 'http://www.soapware.org/xmethodsInterop' + +#$wsdlBase = 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/SOAP4R_SOAPBuildersInteropTest_R2base.wsdl' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +#drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +#methodDefGroupB(drvGroupB) + +=begin +require 'soap/wsdlDriver' +drvBase = SOAP::WSDLDriverFactory.new($wsdlBase).create_rpc_driver +drvBase.endpoint_url = $serverBase +=end + +doTestBase(drvBase) +#doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientGLUE.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientGLUE.rb new file mode 100644 index 00000000..f32cf465 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientGLUE.rb @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby + +$serverName = 'GLUE' + +$serverBase = 'http://www.themindelectric.net:8005/glue/round2' +$serverGroupB = 'http://www.themindelectric.net:8005/glue/round2B' + +$wsdlBase = 'http://www.themindelectric.net:8005/glue/round2.wsdl' +$wsdlGroupB = 'http://www.themindelectric.net:8005/glue/round2B.wsdl' + +$noEchoMap = true + +require 'clientBase' + +=begin +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) +=end + +require 'soap/wsdlDriver' +drvBase = SOAP::WSDLDriverFactory.new($wsdlBase).create_rpc_driver +drvBase.endpoint_url = $serverBase +drvBase.wiredump_dev = STDOUT +drvGroupB = SOAP::WSDLDriverFactory.new($wsdlGroupB).create_rpc_driver +drvGroupB.endpoint_url = $serverGroupB + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientHP.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientHP.rb new file mode 100644 index 00000000..ca018a5d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientHP.rb @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby + +$serverName = 'HPSOAP' +$server = 'http://soap.bluestone.com/hpws/soap/EchoService' + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) + +methodDef(drv) + +doTest(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientJAX-RPC.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientJAX-RPC.rb new file mode 100644 index 00000000..471f9324 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientJAX-RPC.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +$serverName = 'JAX-RPC' + +$serverBase = 'http://soapinterop.java.sun.com:80/round2/base' +$serverGroupB = 'http://soapinterop.java.sun.com:80/round2/groupb' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDef( drvBase ) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB( drvGroupB ) + +doTestBase( drvBase ) +doTestGroupB( drvGroupB ) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientJSOAP.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientJSOAP.rb new file mode 100644 index 00000000..69ca8584 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientJSOAP.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +$serverName = 'SpheonJSOAP' +$server = 'http://soap.fmui.de/RPC' + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) + +methodDef(drv) + +doTestBase(drv) +doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientKafkaXSLT.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientKafkaXSLT.rb new file mode 100644 index 00000000..0980350b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientKafkaXSLT.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +$serverName = 'KafkaXSLTSOAP' + +$server = 'http://www.thoughtpost.com/services/interop.asmx' +$noEchoMap = true + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDef(drv) + +doTestBase(drv) +doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientMSSOAPToolkit2.0.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientMSSOAPToolkit2.0.rb new file mode 100644 index 00000000..3c3e323a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientMSSOAPToolkit2.0.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +$serverName = 'MicrosoftSoapToolkitV2' +$serverBase = 'http://mssoapinterop.org/stk/InteropB.wsdl' +$serverGroupB = 'http://mssoapinterop.org/stk/InteropBtyped.wsdl' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientMSSOAPToolkit3.0.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientMSSOAPToolkit3.0.rb new file mode 100644 index 00000000..a878edd6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientMSSOAPToolkit3.0.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +$serverName = 'MicrosoftSoapToolkit3.0' +$serverBase = 'http://mssoapinterop.org/stkV3/InteropTyped.wsdl' +$serverGroupB = 'http://mssoapinterop.org/stkV3/InteropBtyped.wsdl' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientNuSOAP.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientNuSOAP.rb new file mode 100644 index 00000000..51fa2fd4 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientNuSOAP.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +$serverName = 'NuSOAP' + +$serverBase = 'http://dietrich.ganx4.com/nusoap/testbed/round2_base_server.php' +$serverGroupB = 'http://dietrich.ganx4.com/nusoap/testbed/round2_groupb_server.php' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientNuWave.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientNuWave.rb new file mode 100644 index 00000000..934bf97e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientNuWave.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +$serverName = 'NuWave' + +$server = ' http://interop.nuwave-tech.com:7070/interop/base.wsdl' +$noEchoMap = true + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDef(drv) + +doTestBase(drv) +#doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientOpenLink.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientOpenLink.rb new file mode 100644 index 00000000..210d2da8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientOpenLink.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +$serverName = 'OpenLink' + +$server = 'http://demo.openlinksw.com:8890/Interop' +$noEchoMap = true + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDef(drv) + +doTestBase(drv) +doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientOracle.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientOracle.rb new file mode 100644 index 00000000..273f51fa --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientOracle.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +$serverName = 'Oracle' + +$server = 'http://ws-interop.oracle.com/soapbuilder/r2/InteropTest' +$noEchoMap = true + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDef(drv) + +doTestBase(drv) +#doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientPEAR.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientPEAR.rb new file mode 100644 index 00000000..9cb612e3 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientPEAR.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +$serverName = 'PEAR' + +$server = 'http://www.caraveo.com/soap_interop/server_round2.php' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientPhalanx.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientPhalanx.rb new file mode 100644 index 00000000..f1e0ddca --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientPhalanx.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +$serverName = 'Phalanx' + +$serverBase = 'http://www.phalanxsys.com/ilabA/typed/target.asp' +$serverGroupB = 'http://www.phalanxsys.com/ilabB/typed/target.asp' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientSIMACE.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSIMACE.rb new file mode 100644 index 00000000..41ab1de8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSIMACE.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +$serverName = 'SIM' +$serverBase = 'http://soapinterop.simdb.com/round2' +$serverGroupB = 'http://soapinterop.simdb.com/round2B' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientSOAP4R.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSOAP4R.rb new file mode 100644 index 00000000..65001cd1 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSOAP4R.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +$serverName = 'SOAP4R' + +$server = 'http://dev.ctor.org/soapsrv' +#$server = 'http://rrr.jin.gr.jp/soapsrv' +#$server = 'http://dev.ctor.org/soapsrv' +#$server = 'http://localhost:10080' +#require 'xsd/datatypes1999' + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDef(drv) + +doTestBase(drv) +doTestGroupB(drv) +#submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientSOAP__Lite.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSOAP__Lite.rb new file mode 100644 index 00000000..85e636c6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSOAP__Lite.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +$serverName = 'SOAP::Lite' + +$server = 'http://services.soaplite.com/interop.cgi' + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDef(drv) + +doTestBase(drv) +doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientSQLData.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSQLData.rb new file mode 100644 index 00000000..1b414e45 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSQLData.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +$serverName = 'SQLDataSOAPServer' +$serverBase = 'http://soapclient.com/interop/sqldatainterop.wsdl' +$serverGroupB = 'http://soapclient.com/interop/InteropB.wsdl' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientSilverStream.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSilverStream.rb new file mode 100644 index 00000000..77a7a7fb --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSilverStream.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +$serverName = 'SilverStream' + +$server = 'http://explorer.ne.mediaone.net/app/interop/interop' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDefBase(drvBase) + +#drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +#methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +#doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientSpray2001.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSpray2001.rb new file mode 100644 index 00000000..8b6de9c2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSpray2001.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +$serverName = 'Spray2001' +$serverBase = 'http://www.dolphinharbor.org/services/interop2001' +$serverGroupB = 'http://www.dolphinharbor.org/services/interopB2001' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDef(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientSun.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSun.rb new file mode 100644 index 00000000..f447e8ac --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientSun.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +$serverName = 'SunMicrosystems' + +$serverBase = 'http://soapinterop.java.sun.com:80/round2/base' +$serverGroupB = 'http://soapinterop.java.sun.com:80/round2/groupb' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientVWOpentalkSoap.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientVWOpentalkSoap.rb new file mode 100644 index 00000000..83a94aa4 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientVWOpentalkSoap.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +$serverName = 'VWOpentalkSoap' + +$server = 'http://www.cincomsmalltalk.com/soap/interop' +$serverGroupB = 'http://www.cincomsmalltalk.com/r2groupb/interop' +$noEchoMap = true + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDefBase(drv) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drv) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientWASP.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientWASP.rb new file mode 100644 index 00000000..d8fe389a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientWASP.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +$serverName = 'WASPforJava' + +$serverBase = 'http://soap.systinet.net:6060/InteropService/' +$serverGroupB = 'http://soap.systinet.net:6060/InteropBService/' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientWASPC.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientWASPC.rb new file mode 100644 index 00000000..65aaa890 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientWASPC.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +$serverName = 'WASPforC++' + +$serverBase = 'http://soap.systinet.net:6070/InteropService/' +$serverGroupB = 'http://soap.systinet.net:6070/InteropBService/' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientWebMethods.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientWebMethods.rb new file mode 100644 index 00000000..ceee3126 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientWebMethods.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +$serverName = 'webMethods' + +$server = 'http://ewsdemo.webMethods.com:80/soap/rpc' +$noEchoMap = true + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDef(drv) + +doTestBase(drv) +doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientWhiteMesa.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientWhiteMesa.rb new file mode 100644 index 00000000..544278de --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientWhiteMesa.rb @@ -0,0 +1,28 @@ +#!/usr/bin/env ruby + +$serverName = 'WhiteMesaSOAPServer' +$serverBase = 'http://www.whitemesa.net/interop/std' +$serverGroupB = 'http://www.whitemesa.net/interop/std/groupB' + +$wsdlBase = 'http://www.whitemesa.net/wsdl/std/interop.wsdl' +$wsdlGroupB = 'http://www.whitemesa.net/wsdl/std/interopB.wsdl' + +require 'clientBase' + +=begin +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) +=end + +require 'soap/wsdlDriver' +drvBase = SOAP::WSDLDriverFactory.new($wsdlBase).create_rpc_driver +drvBase.endpoint_url = $serverBase +drvGroupB = SOAP::WSDLDriverFactory.new($wsdlGroupB).create_rpc_driver +drvGroupB.endpoint_url = $serverGroupB + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientWingfoot.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientWingfoot.rb new file mode 100644 index 00000000..91d03234 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientWingfoot.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +$serverName = 'WingfootSOAPServer' + +$server = 'http://www.wingfoot.com/servlet/wserver' +$noEchoMap = true + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDef(drv) + +doTestBase(drv) +doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientXMLBus.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientXMLBus.rb new file mode 100644 index 00000000..9f58d0b9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientXMLBus.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +$serverName = 'IONAXMLBus' + +$serverBase = 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/BaseService/BasePort' +$serverGroupB = 'http://interop.xmlbus.com:7002/xmlbus/container/InteropTest/GroupBService/GroupBPort' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDef(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientXMLRPC-EPI.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientXMLRPC-EPI.rb new file mode 100644 index 00000000..5de7e346 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientXMLRPC-EPI.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +$serverName = 'XMLRPC-EPI' +$serverBase = 'http://xmlrpc-epi.sourceforge.net/xmlrpc_php/interop-server.php' +#$serverGroupB = 'http://soapinterop.simdb.com/round2B' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase( drvBase ) + +#drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +#methodDefGroupB( drvGroupB ) + +doTestBase( drvBase ) +#doTestGroupB( drvGroupB ) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientXSOAP.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientXSOAP.rb new file mode 100644 index 00000000..d6fb2f73 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientXSOAP.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +$serverName = 'XSOAP1.2' + +$server = 'http://www.wingfoot.com/servlet/wserver' + +require 'clientBase' + +drv = SOAP::RPC::Driver.new($server, InterfaceNS) +methodDefBase(drv) + +doTestBase(drv) +#doTestGroupB(drv) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientZSI.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientZSI.rb new file mode 100644 index 00000000..343282cd --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientZSI.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +$serverName = 'ZSI' + +$serverBase = 'http://63.142.188.184:1122/' +$serverGroupB = 'http://63.142.188.184:1122/' + +require 'clientBase' +#$soapAction = 'urn:soapinterop' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDef( drvBase ) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB( drvGroupB ) + +doTestBase( drvBase ) +doTestGroupB( drvGroupB ) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clienteSOAP.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clienteSOAP.rb new file mode 100644 index 00000000..b82b358a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clienteSOAP.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +$serverName = 'eSoap' + +$serverBase = 'http://www.quakersoft.net/cgi-bin/interop2_server.cgi' +$noEchoMap = true + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDefBase(drvBase) + +#drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +#methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +#doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientgSOAP.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientgSOAP.rb new file mode 100644 index 00000000..0951ee19 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientgSOAP.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +$serverName = 'gSOAP' + +$serverBase = 'http://websrv.cs.fsu.edu/~engelen/interop2.cgi' +$serverGroupB = 'http://websrv.cs.fsu.edu/~engelen/interop2B.cgi' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDef(drvBase) + +drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/clientkSOAP.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/clientkSOAP.rb new file mode 100644 index 00000000..0037a387 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/clientkSOAP.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +$serverName = 'kSOAP' + +$serverBase = 'http://kissen.cs.uni-dortmund.de:8080/ksoapinterop' + +require 'clientBase' + +drvBase = SOAP::RPC::Driver.new($serverBase, InterfaceNS) +methodDef(drvBase) + +#drvGroupB = SOAP::RPC::Driver.new($serverGroupB, InterfaceNS) +#methodDefGroupB(drvGroupB) + +doTestBase(drvBase) +#doTestGroupB(drvGroupB) +submitTestResult diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/groupc.wsdl b/vendor/gems/soap4r-1.5.8/test/interopR2/groupc.wsdl new file mode 100644 index 00000000..71deea55 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/groupc.wsdl @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/iSimonReg.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/iSimonReg.rb new file mode 100644 index 00000000..7b27eb2a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/iSimonReg.rb @@ -0,0 +1,112 @@ +require 'soap/soap' +require 'soap/rpcUtils' + +module SimonReg + TypeNS = 'http://soap.pocketsoap.com/registration/types' + + module Services + + InterfaceNS = 'http://soap.pocketsoap.com/registration/services' + + class Service + include SOAP::Marshallable + @typeName = 'Service' + @typeNamespace = SimonReg::TypeNS + + attr_accessor :id, :name, :description, :wsdlURL, :websiteURL + + def initialize( id = nil, name = nil, description = nil, wsdlURL = nil, websiteURL = nil ) + + @id = id + @name = name + @description = description + @wsdlURL = wsdlURL + @websiteURL = websiteURL + end + end + + Methods = { + 'ServiceList' => [ 'services' ], + 'Servers' => [ 'Servers', 'serviceID' ], + 'Clients' => [ 'Clients', 'serviceID' ], + } + end + + module Clients + + InterfaceNS = 'http://soap.pocketsoap.com/registration/clients' + + class ClientInfo + include SOAP::Marshallable + @typeName = 'clientInfo' + @typeNamespace = SimonReg::TypeNS + + attr_accessor :name, :version, :resultsURL + + def initialize( name = nil, version = nil, resultsURL = nil ) + + @name = name + @version = version + @resultsURL = resultsURL + end + end + + Methods = { + 'RegisterClient' => [ 'clientID', 'serviceID', 'clientInfo' ], + 'UpdateClient' => [ 'void', 'clientID', 'clientInfo' ], + 'RemoveClient' => [ 'void', 'clientID' ], + } + end + + module Servers + + InterfaceNS = 'http://soap.pocketsoap.com/registration/servers' + + class ServerInfo + include SOAP::Marshallable + @typeName = 'serverInfo' + @typeNamespace = SimonReg::TypeNS + + attr_accessor :name, :version, :endpointURL, :wsdlURL + + def initialize( name = nil, version = nil, endpointURL = nil, wsdlURL = nil ) + + @name = name + @version = version + @endpointURL = endpointURL + @wsdlURL = wsdlURL + end + end + + Methods = { + 'RegisterServer' => [ 'serverID', 'serviceID', 'serverInfo' ], + 'UpdateServer' => [ 'void', 'serverID', 'serverInfo' ], + 'RemoveServer' => [ 'void', 'serverID' ], + } + end + + module Subscriber + + InterfaceNS = 'http://soap.pocketsoap.com/registration/subscriber' + + class SubscriberInfo + include SOAP::Marshallable + @typeName = 'subscriberInfo' + @typeNamespace = SimonReg::TypeNS + + attr_accessor :notificationID, :expires + + def initialize( notificationID = nil, expires = nil ) + + @notificationID = notificationID + @expires = expires + end + end + + Methods = { + 'Subscribe' => [ 'subscriberInfo', 'serviceID', 'ServerChanges', 'ClientChanges', 'NotificationURL' ], + 'Renew' => [ 'expires', 'notificationID' ], + 'Cancel' => [ 'void', 'notificationID' ], + } + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/interopResultBase.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/interopResultBase.rb new file mode 100644 index 00000000..6e301fcb --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/interopResultBase.rb @@ -0,0 +1,114 @@ +require 'soap/mapping' + + +module SOAPBuildersInteropResult +extend SOAP + + +InterfaceNS = 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInteropResult/0.0.1' +TypeNS = 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInteropResult/type/0.0.1' + + +class Endpoint + include SOAP::Marshallable + + attr_accessor :processorName, :processorVersion, :endpointName, :uri, :wsdl + + def initialize( endpointName = nil, uri = nil, wsdl = nil ) + @processorName = 'unknown' + @processorVersion = nil + @endpointName = endpointName + @uri = uri + @wsdl = wsdl + end + + def name + if @endpointName + @endpointName + elsif @processorVersion + "#{ @processorName }-#{ @processorVersion }" + else + "#{ @processorName }" + end + end +end + + +class TestResult + include SOAP::Marshallable + + attr_accessor :testName, :result, :comment, :wiredump + + def initialize( testName, result, comment = nil, wiredump = nil ) + @testName = testName + @result = result + @comment = comment + @wiredump = wiredump + end +end + + +class InteropResults + include SOAP::Marshallable + include Enumerable + + attr_accessor :dateTime, :server, :client + + def initialize( client = nil, server = nil ) + @dateTime = Time.now + @server = server + @client = client + @testResults = [] + end + + def add( testResult ) + @testResults << testResult + end + + def clear + @testResults.clear + end + + def each + @testResults.each do | item | + yield( item ) + end + end + + def size + @testResults.size + end +end + + +Methods = [ + [ 'addResults', ['in', 'interopResults' ]], + [ 'deleteResults', ['in', 'client'], ['in', 'server']], +] + + + +MappingRegistry = SOAP::Mapping::Registry.new + +MappingRegistry.set( + ::SOAPBuildersInteropResult::Endpoint, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + [ XSD::QName.new(TypeNS, 'Endpoint') ] +) + +MappingRegistry.set( + ::SOAPBuildersInteropResult::TestResult, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + [ XSD::QName.new(TypeNS, 'TestResult') ] +) +MappingRegistry.set( + ::SOAPBuildersInteropResult::InteropResults, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + [ XSD::QName.new(TypeNS, 'InteropResults') ] +) + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/interopService.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/interopService.rb new file mode 100644 index 00000000..613609d1 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/interopService.rb @@ -0,0 +1,247 @@ +require 'interopbase' + +class InteropService + include SOAP + + # In echoVoid, 'retval' is not defined. So nothing will be returned. + def echoVoid + return SOAP::RPC::SOAPVoid.new + end + + def echoBoolean(inputBoolean) + inputBoolean + end + + def echoString(inputString) + clone(inputString) + end + + def echoStringArray(inputStringArray) + clone(inputStringArray) + end + + def echoInteger(inputInteger) + SOAP::SOAPInt.new(clone(inputInteger)) + end + + def echoIntegerArray(inputIntegerArray) + clone(inputIntegerArray) + end + + # Float is mapped to SOAPDouble by default. + def echoFloat(inputFloat) + SOAP::SOAPFloat.new(inputFloat) + end + + def echoDecimal(inputDecimal) + SOAP::SOAPDecimal.new(clone(inputDecimal)) + end + + def echoFloatArray(inputFloatArray) + outArray = SOAPBuildersInterop::FloatArray.new + inputFloatArray.each do |f| + outArray << SOAPFloat.new(f) + end + outArray + end + + def echoStruct(inputStruct) + clone_Struct(inputStruct) + end + + def echoStructArray(inputStructArray) + clone_StructArray(inputStructArray) + end + + def echoDate(inputDate) + clone(inputDate) + end + + def echoBase64(inputBase64) + o = SOAP::SOAPBase64.new(clone(inputBase64)) + o.as_xsd + o + end + + def echoHexBinary(inputHexBinary) + SOAP::SOAPHexBinary.new(clone(inputHexBinary)) + end + + def echoDouble(inputDouble) + SOAP::SOAPDouble.new(inputDouble) + end + + # for Round 2 group B + def echoStructAsSimpleTypes(inputStruct) + outputString = inputStruct.varString + outputInteger = inputStruct.varInt + outputFloat = inputStruct.varFloat ? SOAPFloat.new(inputStruct.varFloat) : nil + # retVal is not returned to SOAP client because retVal of this method is + # not defined in method definition. + # retVal, out, out, out + return nil, outputString, outputInteger, outputFloat + end + + def echoSimpleTypesAsStruct(inputString, inputInt, inputFloat) + SOAPBuildersInterop::SOAPStruct.new(inputInt, inputFloat, inputString) + end + + def echo2DStringArray(ary) + # In Ruby, M-D Array is converted to Array of Array now. + mdary = SOAP::Mapping.ary2md(ary, 2, XSD::Namespace, XSD::StringLiteral) + if mdary.include?(nil) + mdary.sparse = true + end + mdary + end + + def echoNestedStruct(inputStruct) + clone_StructStruct(inputStruct) + end + + def echoNestedArray(inputStruct) + clone_Struct(inputStruct) + end + + def echoMap(inputMap) + clone(inputMap) + end + + def echoMapArray(inputMapArray) + clone(inputMapArray) + end + + def echoPolyMorph(anObject) + clone(anObject) + end + + alias echoPolyMorphStruct echoPolyMorph + alias echoPolyMorphArray echoPolyMorph + + + def echoXSDBoolean(inputBoolean) + inputBoolean + end + + def echoXSDString(inputString) + clone(inputString) + end + + def echoXSDDecimal(inputDecimal) + SOAP::SOAPDecimal.new(clone(inputDecimal)) + end + + def echoXSDFloat(inputFloat) + SOAPFloat.new(inputFloat) + end + + def echoXSDDouble(inputDouble) + SOAP::SOAPDouble.new(clone(inputDouble)) + end + + def echoXSDDuration(inputDuration) + SOAP::SOAPDuration.new(clone(inputDuration)) + end + + def echoXSDDateTime(inputXSDDateTime) + clone(inputXSDDateTime) + end + + def echoXSDTime(inputXSDTime) + SOAP::SOAPTime.new(clone(inputXSDTime)) + end + + def echoXSDDate(inputXSDDate) + SOAP::SOAPDate.new(clone(inputXSDDate)) + end + + def echoXSDgYearMonth(inputGYearMonth) + SOAP::SOAPgYearMonth.new(clone(inputGYearMonth)) + end + + def echoXSDgYear(inputGYear) + SOAP::SOAPgYear.new(clone(inputGYear)) + end + + def echoXSDgMonthDay(inputGMonthDay) + SOAP::SOAPgMonthDay.new(clone(inputGMonthDay)) + end + + def echoXSDgDay(inputGDay) + SOAP::SOAPgDay.new(clone(inputGDay)) + end + + def echoXSDgMonth(inputGMonth) + SOAP::SOAPgMonth.new(clone(inputGMonth)) + end + + def echoXSDHexBinary(inputHexBinary) + SOAP::SOAPHexBinary.new(clone(inputHexBinary)) + end + + def echoXSDBase64(inputBase64) + o = SOAP::SOAPBase64.new(clone(inputBase64)) + o.as_xsd + o + end + + def echoXSDanyURI(inputAnyURI) + clone(inputAnyURI) + end + + def echoXSDQName(inputQName) + SOAP::SOAPQName.new(clone(inputQName)) + end + + def echoXSDInteger(inputXSDInteger) + clone(inputXSDInteger) + end + + def echoXSDLong(inputLong) + SOAP::SOAPLong.new(clone(inputLong)) + end + + def echoXSDInt(inputInt) + SOAP::SOAPInt.new(clone(inputInteger)) + end + + def echoPolyMorph(anObject) + clone(anObject) + end + + alias echoPolyMorphStruct echoPolyMorph + alias echoPolyMorphArray echoPolyMorph + +private + + def clone(obj) + begin + return Marshal.load(Marshal.dump(obj)) + rescue TypeError + return obj + end + end + + def clone_Struct(struct) + result = clone(struct) + result.varFloat = SOAPFloat.new(struct.varFloat) if struct.varFloat + result + end + + def clone_StructArray(structArray) + result = clone(structArray) + result.map { |ele| + ele.varFloat = SOAPFloat.new(ele.varFloat) if ele.varFloat + } + result + end + + def clone_StructStruct(structStruct) + result = clone(structStruct) + result.varFloat = SOAPFloat.new(structStruct.varFloat) if structStruct.varFloat + if struct = result.varStruct + struct.varFloat = SOAPFloat.new(struct.varFloat) if struct.varFloat + end + result + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/rwikiInteropService.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/rwikiInteropService.rb new file mode 100644 index 00000000..5536f68b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/rwikiInteropService.rb @@ -0,0 +1,104 @@ +require 'drb/drb' +require 'rw-lib' +require 'interopResultBase' + +class RWikiInteropService + def initialize + @rwiki_uri = 'druby://localhost:7174' + @rwiki = DRbObject.new(nil, @rwiki_uri) + end + + # [ 'addResults', ['in', 'interopResults' ]] + # [ 'deleteResults', ['in', 'client'], ['in', 'server']] + + def addResults(interopResults) + pageName = pageName(interopResults.client, interopResults.server) + + passResults = interopResults.find_all { | testResult | + testResult.result + } + passStr = passResults.collect { | passResult | + str = "* #{ passResult.testName } ((<[wiredump]|\"##{passResult.testName}\">))\n" + if passResult.comment + str << "\n #{ passResult.comment.gsub(/[\r\n]/, '') }\n" + end + str + } + passStr = 'Nothing...' if passStr.empty? + + failResults = interopResults.find_all { | testResult | + !testResult.result + } + failStr = failResults.collect { | failResult | + str = ":#{ failResult.testName } ((<[wiredump]|\"##{failResult.testName}\">))\n Result:\n" + resultStr = failResult.comment.gsub(/\r?\n/, "\n ") + str << " #{ resultStr }\n" + str + } + failStr = 'Nothing!' if failStr.empty? + + pageStr =<<__EOS__ += #{ pageName } + +* Date: #{ interopResults.dateTime } +* Server + * Name: #{ interopResults.server.name } + * Endpoint: #{ interopResults.server.uri } + * WSDL: #{ interopResults.server.wsdl } +* Client + * Name: #{ interopResults.client.name } + * Endpoint: #{ interopResults.client.uri } + * WSDL: #{ interopResults.client.wsdl } + +== Pass + +#{ passResults.size } / #{ interopResults.size } + +#{ passStr } + +== Fail + +#{ failResults.size } / #{ interopResults.size } + +#{ failStr } + +== Wiredumps + +__EOS__ + + interopResults.each do | testResult | + pageStr <<<<__EOS__ +=== #{ testResult.testName } + + #{ testResult.wiredump.gsub(/\r/, '^M').gsub(/\t/, '^I').gsub(/\n/, "\n ") } + +__EOS__ + end + + set(pageName, pageStr) + + msg = "; #{ passResults.size } / #{ interopResults.size } (#{ interopResults.dateTime })" + addLink(pageName, msg) + end + + def deleteResults(client, server) + set(pageName(client, server), '') + end + +private + + def set(pageName, pageSrc) + page = @rwiki.page(pageName) + page.src = pageSrc + end + + def pageName(client, server) + "InteropResults::#{ client.name }-#{ server.name }" + end + + def addLink(pageName, msg) + page = @rwiki.page('InteropResults') + # Race condition... Page source might be mixed with others's. + page.src = (page.src || '') << "\n* ((<\"#{ pageName }\">))\n #{ msg }" + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/server.cgi b/vendor/gems/soap4r-1.5.8/test/interopR2/server.cgi new file mode 100644 index 00000000..d676aa67 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/server.cgi @@ -0,0 +1,270 @@ +#!/usr/bin/env ruby + +$:.unshift(".") + +#$KCODE = "UTF8" # Set $KCODE before loading 'soap/xmlparser'. +#$KCODE = "EUC" +$KCODE = "SJIS" + +require 'soap/rpc/cgistub' +require 'base' + +class InteropApp < SOAP::CGIStub + include SOAP + + def initialize(*arg) + super(*arg) + self.mapping_registry = SOAPBuildersInterop::MappingRegistry + self.level = Logger::Severity::ERROR + end + + def on_init + (SOAPBuildersInterop::MethodsBase + SOAPBuildersInterop::MethodsGroupB + SOAPBuildersInterop::MethodsPolyMorph).each do |name, *params| + add_method(self, name, params) + end + end + + # In echoVoid, 'retval' is not defined. So nothing will be returned. + def echoVoid + return SOAP::RPC::SOAPVoid.new + end + + def echoBoolean(inputBoolean) + inputBoolean + end + + def echoString(inputString) + clone(inputString) + end + + def echoStringArray(inputStringArray) + clone(inputStringArray) + end + + def echoInteger(inputInteger) + SOAP::SOAPInt.new(clone(inputInteger)) + end + + def echoIntegerArray(inputIntegerArray) + clone(inputIntegerArray) + end + + # Float is mapped to SOAPDouble by default. + def echoFloat(inputFloat) + SOAP::SOAPFloat.new(inputFloat) + end + + def echoDecimal(inputDecimal) + SOAP::SOAPDecimal.new(clone(inputDecimal)) + end + + def echoFloatArray(inputFloatArray) + outArray = SOAPBuildersInterop::FloatArray.new + inputFloatArray.each do |f| + outArray << SOAPFloat.new(f) + end + outArray + end + + def echoStruct(inputStruct) + clone_Struct(inputStruct) + end + + def echoStructArray(inputStructArray) + clone_StructArray(inputStructArray) + end + + def echoDate(inputDate) + clone(inputDate) + end + + def echoBase64(inputBase64) + o = SOAP::SOAPBase64.new(clone(inputBase64)) + o.as_xsd + o + end + + def echoHexBinary(inputHexBinary) + SOAP::SOAPHexBinary.new(clone(inputHexBinary)) + end + + def echoDouble(inputDouble) + SOAP::SOAPDouble.new(inputDouble) + end + + # for Round 2 group B + def echoStructAsSimpleTypes(inputStruct) + outputString = inputStruct.varString + outputInteger = inputStruct.varInt + outputFloat = inputStruct.varFloat ? SOAPFloat.new(inputStruct.varFloat) : nil + # retVal is not returned to SOAP client because retVal of this method is + # not defined in method definition. + # retVal, out, out, out + return nil, outputString, outputInteger, outputFloat + end + + def echoSimpleTypesAsStruct(inputString, inputInt, inputFloat) + SOAPBuildersInterop::SOAPStruct.new(inputInt, inputFloat, inputString) + end + + def echo2DStringArray(ary) + # In Ruby, M-D Array is converted to Array of Array now. + mdary = SOAP::Mapping.ary2md(ary, 2, XSD::Namespace, XSD::StringLiteral) + if mdary.include?(nil) + mdary.sparse = true + end + mdary + end + + def echoNestedStruct(inputStruct) + clone_StructStruct(inputStruct) + end + + def echoNestedArray(inputStruct) + clone_Struct(inputStruct) + end + + def echoMap(inputMap) + clone(inputMap) + end + + def echoMapArray(inputMapArray) + clone(inputMapArray) + end + + def echoPolyMorph(anObject) + clone(anObject) + end + + alias echoPolyMorphStruct echoPolyMorph + alias echoPolyMorphArray echoPolyMorph + + + def echoXSDBoolean(inputBoolean) + inputBoolean + end + + def echoXSDString(inputString) + clone(inputString) + end + + def echoXSDDecimal(inputDecimal) + SOAP::SOAPDecimal.new(clone(inputDecimal)) + end + + def echoXSDFloat(inputFloat) + SOAPFloat.new(inputFloat) + end + + def echoXSDDouble(inputDouble) + SOAP::SOAPDouble.new(clone(inputDouble)) + end + + def echoXSDDuration(inputDuration) + SOAP::SOAPDuration.new(clone(inputDuration)) + end + + def echoXSDDateTime(inputXSDDateTime) + clone(inputXSDDateTime) + end + + def echoXSDTime(inputXSDTime) + SOAP::SOAPTime.new(clone(inputXSDTime)) + end + + def echoXSDDate(inputXSDDate) + SOAP::SOAPDate.new(clone(inputXSDDate)) + end + + def echoXSDgYearMonth(inputGYearMonth) + SOAP::SOAPgYearMonth.new(clone(inputGYearMonth)) + end + + def echoXSDgYear(inputGYear) + SOAP::SOAPgYear.new(clone(inputGYear)) + end + + def echoXSDgMonthDay(inputGMonthDay) + SOAP::SOAPgMonthDay.new(clone(inputGMonthDay)) + end + + def echoXSDgDay(inputGDay) + SOAP::SOAPgDay.new(clone(inputGDay)) + end + + def echoXSDgMonth(inputGMonth) + SOAP::SOAPgMonth.new(clone(inputGMonth)) + end + + def echoXSDHexBinary(inputHexBinary) + SOAP::SOAPHexBinary.new(clone(inputHexBinary)) + end + + def echoXSDBase64(inputBase64) + o = SOAP::SOAPBase64.new(clone(inputBase64)) + o.as_xsd + o + end + + def echoXSDanyURI(inputAnyURI) + clone(inputAnyURI) + end + + def echoXSDQName(inputQName) + SOAP::SOAPQName.new(clone(inputQName)) + end + + def echoXSDInteger(inputXSDInteger) + clone(inputXSDInteger) + end + + def echoXSDLong(inputLong) + SOAP::SOAPLong.new(clone(inputLong)) + end + + def echoXSDInt(inputInt) + SOAP::SOAPInt.new(clone(inputInteger)) + end + + def echoPolyMorph(anObject) + clone(anObject) + end + + alias echoPolyMorphStruct echoPolyMorph + alias echoPolyMorphArray echoPolyMorph + +private + + def clone(obj) + begin + return Marshal.load(Marshal.dump(obj)) + rescue TypeError + return obj + end + end + + def clone_Struct(struct) + result = clone(struct) + result.varFloat = SOAPFloat.new(struct.varFloat) if struct.varFloat + result + end + + def clone_StructArray(structArray) + result = clone(structArray) + result.map { |ele| + ele.varFloat = SOAPFloat.new(ele.varFloat) if ele.varFloat + } + result + end + + def clone_StructStruct(structStruct) + result = clone(structStruct) + result.varFloat = SOAPFloat.new(structStruct.varFloat) if structStruct.varFloat + if struct = result.varStruct + struct.varFloat = SOAPFloat.new(struct.varFloat) if struct.varFloat + end + result + end +end + +InteropApp.new('InteropApp', InterfaceNS).start diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/server.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/server.rb new file mode 100644 index 00000000..c9454616 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/server.rb @@ -0,0 +1,275 @@ +#!/usr/bin/env ruby + +$:.unshift(".") + +#$KCODE = "UTF8" # Set $KCODE before loading 'soap/xmlparser'. +#$KCODE = "EUC" +$KCODE = "SJIS" + +require 'soap/rpc/standaloneServer' +require 'base' +require 'xsd/xmlparser/rexmlparser' + +class InteropApp < SOAP::RPC::StandaloneServer + include SOAP + + def initialize(*arg) + super(*arg) + self.mapping_registry = SOAPBuildersInterop::MappingRegistry + self.level = Logger::Severity::ERROR + end + + def on_init + (SOAPBuildersInterop::MethodsBase + SOAPBuildersInterop::MethodsGroupB + SOAPBuildersInterop::MethodsPolyMorph).each do |name, *params| + add_method(self, name, params) + end + end + + # In echoVoid, 'retval' is not defined. So nothing will be returned. + def echoVoid + return SOAP::RPC::SOAPVoid.new + end + + def echoBoolean(inputBoolean) + inputBoolean + end + + def echoString(inputString) + clone(inputString) + end + + def echoStringArray(inputStringArray) + clone(inputStringArray) + end + + def echoInteger(inputInteger) + SOAP::SOAPInt.new(clone(inputInteger)) + end + + def echoIntegerArray(inputIntegerArray) + clone(inputIntegerArray) + end + + # Float is mapped to SOAPDouble by default. + def echoFloat(inputFloat) + SOAP::SOAPFloat.new(inputFloat) + end + + def echoDecimal(inputDecimal) + SOAP::SOAPDecimal.new(clone(inputDecimal)) + end + + def echoFloatArray(inputFloatArray) + outArray = SOAPBuildersInterop::FloatArray.new + inputFloatArray.each do |f| + outArray << SOAPFloat.new(f) + end + outArray + end + + def echoStruct(inputStruct) + clone_Struct(inputStruct) + end + + def echoStructArray(inputStructArray) + clone_StructArray(inputStructArray) + end + + def echoDate(inputDate) + clone(inputDate) + end + + def echoBase64(inputBase64) + o = SOAP::SOAPBase64.new(clone(inputBase64)) + o.as_xsd + o + end + + def echoHexBinary(inputHexBinary) + SOAP::SOAPHexBinary.new(clone(inputHexBinary)) + end + + def echoDouble(inputDouble) + SOAP::SOAPDouble.new(inputDouble) + end + + # for Round 2 group B + def echoStructAsSimpleTypes(inputStruct) + outputString = inputStruct.varString + outputInteger = inputStruct.varInt + outputFloat = inputStruct.varFloat ? SOAPFloat.new(inputStruct.varFloat) : nil + # retVal is not returned to SOAP client because retVal of this method is + # not defined in method definition. + # retVal, out, out, out + return nil, outputString, outputInteger, outputFloat + end + + def echoSimpleTypesAsStruct(inputString, inputInt, inputFloat) + SOAPBuildersInterop::SOAPStruct.new(inputInt, inputFloat, inputString) + end + + def echo2DStringArray(ary) + # In Ruby, M-D Array is converted to Array of Array now. + mdary = SOAP::Mapping.ary2md(ary, 2, XSD::Namespace, XSD::StringLiteral) + if mdary.include?(nil) + mdary.sparse = true + end + mdary + end + + def echoNestedStruct(inputStruct) + clone_StructStruct(inputStruct) + end + + def echoNestedArray(inputStruct) + clone_Struct(inputStruct) + end + + def echoMap(inputMap) + clone(inputMap) + end + + def echoMapArray(inputMapArray) + clone(inputMapArray) + end + + def echoPolyMorph(anObject) + clone(anObject) + end + + alias echoPolyMorphStruct echoPolyMorph + alias echoPolyMorphArray echoPolyMorph + + + def echoXSDBoolean(inputBoolean) + inputBoolean + end + + def echoXSDString(inputString) + clone(inputString) + end + + def echoXSDDecimal(inputDecimal) + SOAP::SOAPDecimal.new(clone(inputDecimal)) + end + + def echoXSDFloat(inputFloat) + SOAPFloat.new(inputFloat) + end + + def echoXSDDouble(inputDouble) + SOAP::SOAPDouble.new(clone(inputDouble)) + end + + def echoXSDDuration(inputDuration) + SOAP::SOAPDuration.new(clone(inputDuration)) + end + + def echoXSDDateTime(inputXSDDateTime) + clone(inputXSDDateTime) + end + + def echoXSDTime(inputXSDTime) + SOAP::SOAPTime.new(clone(inputXSDTime)) + end + + def echoXSDDate(inputXSDDate) + SOAP::SOAPDate.new(clone(inputXSDDate)) + end + + def echoXSDgYearMonth(inputGYearMonth) + SOAP::SOAPgYearMonth.new(clone(inputGYearMonth)) + end + + def echoXSDgYear(inputGYear) + SOAP::SOAPgYear.new(clone(inputGYear)) + end + + def echoXSDgMonthDay(inputGMonthDay) + SOAP::SOAPgMonthDay.new(clone(inputGMonthDay)) + end + + def echoXSDgDay(inputGDay) + SOAP::SOAPgDay.new(clone(inputGDay)) + end + + def echoXSDgMonth(inputGMonth) + SOAP::SOAPgMonth.new(clone(inputGMonth)) + end + + def echoXSDHexBinary(inputHexBinary) + SOAP::SOAPHexBinary.new(clone(inputHexBinary)) + end + + def echoXSDBase64(inputBase64) + o = SOAP::SOAPBase64.new(clone(inputBase64)) + o.as_xsd + o + end + + def echoXSDanyURI(inputAnyURI) + clone(inputAnyURI) + end + + def echoXSDQName(inputQName) + SOAP::SOAPQName.new(clone(inputQName)) + end + + def echoXSDInteger(inputXSDInteger) + clone(inputXSDInteger) + end + + def echoXSDLong(inputLong) + SOAP::SOAPLong.new(clone(inputLong)) + end + + def echoXSDInt(inputInt) + SOAP::SOAPInt.new(clone(inputInteger)) + end + + def echoPolyMorph(anObject) + clone(anObject) + end + + alias echoPolyMorphStruct echoPolyMorph + alias echoPolyMorphArray echoPolyMorph + +private + + def clone(obj) + begin + return Marshal.load(Marshal.dump(obj)) + rescue TypeError + return obj + end + end + + def clone_Struct(struct) + result = clone(struct) + result.varFloat = SOAPFloat.new(struct.varFloat) if struct.varFloat + result + end + + def clone_StructArray(structArray) + result = clone(structArray) + result.map { |ele| + ele.varFloat = SOAPFloat.new(ele.varFloat) if ele.varFloat + } + result + end + + def clone_StructStruct(structStruct) + result = clone(structStruct) + result.varFloat = SOAPFloat.new(structStruct.varFloat) if structStruct.varFloat + if struct = result.varStruct + struct.varFloat = SOAPFloat.new(struct.varFloat) if struct.varFloat + end + result + end +end + +if __FILE__ == $0 + svr = InteropApp.new('InteropApp', InterfaceNS, '0.0.0.0', 10080) + trap("INT") { svr.shutdown } + svr.start +end diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/simonReg.rb b/vendor/gems/soap4r-1.5.8/test/interopR2/simonReg.rb new file mode 100644 index 00000000..552702c7 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/simonReg.rb @@ -0,0 +1,123 @@ +#!/usr/bin/env ruby + +proxy = ARGV.shift || nil + +require 'soap/driver' +require 'logger' + +require 'iSimonReg' + +server = 'http://www.4s4c.com/services/4s4c.ashx' + +class SimonRegApp < Logger::Application + include SimonReg + +private + + AppName = 'SimonRegApp' + + def initialize( server, proxy ) + super( AppName ) + @server = server + @proxy = proxy + @logId = Time.now.gmtime.strftime( "%Y-%m-%dT%X+0000" ) + @drvServices = nil + @drvClients = nil + @drvServers = nil + @drvSubscriber = nil + end + + def run() + @log.level = WARN + wireDump = getWireDumpLogFile + + # Services portType + @drvServices = SOAP::Driver.new( @log, @logId, Services::InterfaceNS, @server, @proxy ) + @drvServices.setWireDumpDev( wireDump ) + + Services::Methods.each do | method, params | + @drvServices.addMethod( method, *( params[1..-1] )) + end + @drvServices.extend( Services ) + + # Clients portType + @drvClients = SOAP::Driver.new( @log, @logId, Clients::InterfaceNS, @server, @proxy ) + @drvClients.setWireDumpDev( wireDump ) + + Clients::Methods.each do | method, params | + @drvClients.addMethod( method, *( params[1..-1] )) + end + @drvClients.extend( Clients ) + + # Servers portType + @drvServers = SOAP::Driver.new( @log, @logId, Servers::InterfaceNS, @server, @proxy ) + @drvServers.setWireDumpDev( wireDump ) + + Servers::Methods.each do | method, params | + @drvServers.addMethod( method, *( params[1..-1] )) + end + @drvServers.extend( Services ) + + # Services portType + @drvSubscriber = SOAP::Driver.new( @log, @logId, Subscriber::InterfaceNS, @server, @proxy ) + @drvSubscriber.setWireDumpDev( wireDump ) + + Subscriber::Methods.each do | method, params | + @drvSubscriber.addMethod( method, *( params[1..-1] )) + end + @drvSubscriber.extend( Subscriber ) + + # Service information + #services = @drvServices.ServiceList + #groupA = services.find { | service | service.name == 'SoapBuilders Interop Group A' } + #groupB = services.find { | service | service.name == 'SoapBuilders Interop Group B' } + + # SOAP4R information + version = '1.4.1' + soap4rClientInfo = Clients::ClientInfo.new( 'SOAP4R', version, + 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/wiki.cgi?cmd=view;name=InteropResults' + ) + soap4rServerInfo = Servers::ServerInfo.new( 'SOAP4R', version, + 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/', + 'http://www.jin.gr.jp/~nahi/Ruby/SOAP4R/SOAPBuildersInterop/SOAP4R_SOAPBuildersInteropTest_R2base.wsdl' ) + soap4rGroupAClientID = '{7B1DF876-055E-4259-ACAE-55E13E399264}' + soap4rGroupBClientID = '{62723003-BC86-4BC0-AABC-C6A3FDE11655}' + soap4rGroupAServerID = '{3094F6C7-F6AA-4BE5-A4EB-194C82103728}' + soap4rGroupBServerID = '{A16357C9-6C7F-45CD-AC3D-72F0FC5F4F99}' + + # Client registration + # clientID = @drvClients.RegisterClient( groupA.id, soap4rClientInfo ) + # clientID = @drvClients.RegisterClient( groupB.id, soap4rClientInfo ) + + # Client remove + # @drvClients.RemoveClient( soap4rClientID ) + + # Server registration + # serverID = @drvServers.RegisterServer( groupA.id, soap4rServerInfo ) + # serverID = @drvServers.RegisterServer( groupB.id, soap4rServerInfo ) + # p serverID + + # Update + @drvClients.UpdateClient( soap4rGroupAClientID, soap4rClientInfo ) + @drvClients.UpdateClient( soap4rGroupBClientID, soap4rClientInfo ) + @drvServers.UpdateServer( soap4rGroupAServerID, soap4rServerInfo ) + @drvServers.UpdateServer( soap4rGroupBServerID, soap4rServerInfo ) + end + + + ### + ## Other utility methods + # + def log( sev, message ) + @log.add( sev, "<#{ @logId }> #{ message }", @appName ) if @log + end + + def getWireDumpLogFile + logFilename = File.basename( $0 ) + '.log' + f = File.open( logFilename, 'w' ) + f << "File: #{ logFilename } - Wiredumps for SOAP4R client.\n" + f << "Date: #{ Time.now }\n\n" + end +end + +app = SimonRegApp.new( server, proxy ).start() diff --git a/vendor/gems/soap4r-1.5.8/test/interopR2/test.sh b/vendor/gems/soap4r-1.5.8/test/interopR2/test.sh new file mode 100644 index 00000000..75d0ef1e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR2/test.sh @@ -0,0 +1,49 @@ +#!/bin/sh - + +ruby clientSOAP4R.rb + +ruby client4S4C.rb +ruby client4S4C2.rb +ruby clientApacheAxis.rb +ruby clientApacheSOAP.rb +ruby clientASP.NET.rb +ruby clientBEAWebLogic.rb +ruby clientCapeConnect.rb +ruby clientDelphi.rb +ruby clientEasySoap.rb +ruby clienteSOAP.rb +ruby clientgSOAP.rb +ruby clientFrontier.rb +ruby clientGLUE.rb +ruby clientHP.rb +ruby clientXMLBus.rb +ruby clientKafkaXSLT.rb +ruby clientkSOAP.rb +ruby client.NetRemoting.rb +ruby clientMSSOAPToolkit2.0.rb +ruby clientMSSOAPToolkit3.0.rb +ruby clientNuSOAP.rb +ruby clientNuWave.rb +ruby clientOpenLink.rb +ruby clientOracle.rb +ruby clientPEAR.rb +ruby clientPhalanx.rb +ruby clientSilverStream.rb +ruby clientSIMACE.rb +ruby clientSOAP::Lite.rb +ruby clientJSOAP.rb +ruby clientSpray2001.rb +ruby clientSQLData.rb +ruby clientSun.rb +ruby clientVWOpentalkSoap.rb +ruby clientWASP.rb +ruby clientWASPC.rb +ruby clientWebMethods.rb +ruby clientWhiteMesa.rb +ruby clientWingfoot.rb +ruby clientXSOAP.rb + +# Permanent +#ruby clientTclSOAP.rb +#ruby clientXMLRPC-EPI.rb +#ruby clientZSI.rb diff --git a/vendor/gems/soap4r-1.5.8/test/interopR4/client.rb b/vendor/gems/soap4r-1.5.8/test/interopR4/client.rb new file mode 100644 index 00000000..edf1c604 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/interopR4/client.rb @@ -0,0 +1,112 @@ +require 'test/unit' +require 'soap/rpc/driver' + + +class TestInteropR4 < Test::Unit::TestCase + include SOAP + + class ArrayOfBinary < Array; end + MappingRegistry = Mapping::DefaultRegistry.dup + MappingRegistry.add( + ArrayOfBinary, + SOAPArray, + Mapping::Registry::TypedArrayFactory, + { :type => XSD::XSDBase64Binary::Type } + ) + + class << self + include SOAP + def setup(name, location) + setup_log(name) + setup_drv(location) + end + + def teardown + end + + private + + def setup_log(name) + filename = File.basename($0).sub(/\.rb$/, '') << '.log' + @@log = File.open(filename, 'w') + @@log << "File: #{ filename } - Wiredumps for SOAP4R client / #{ name } server.\n" + @@log << "Date: #{ Time.now }\n\n" + end + + def setup_drv(location) + namespace = "http://soapinterop.org/attachments/" + soap_action = "http://soapinterop.org/attachments/" + @@drv = RPC::Driver.new(location, namespace, soap_action) + @@drv.mapping_registry = MappingRegistry + @@drv.wiredump_dev = @@log + method_def(@@drv, soap_action) + end + + def method_def(drv, soap_action = nil) + drv.add_method("EchoAttachment", + [['in', 'In', nil], ['retval', 'Out', nil]]) + drv.add_method("EchoAttachments", + [['in', 'In', nil], ['retval', 'Out', nil]]) + drv.add_method("EchoAttachmentAsBase64", + [['in', 'In', nil], ['retval', 'Out', nil]]) + drv.add_method("EchoBase64AsAttachment", + [['in', 'In', nil], ['retval', 'Out', nil]]) + end + end + + def setup + end + + def teardown + end + + def drv + @@drv + end + + def log_test + /`([^']+)'/ =~ caller(1)[0] + title = $1 + title = "==== " + title + " " << "=" * (title.length > 72 ? 0 : (72 - title.length)) + @@log << "#{title}\n\n" + end + + def test_EchoAttachment + log_test + var = drv.EchoAttachment(Attachment.new("foobar")) + assert_equal("foobar", var.content) + end + + def test_EchoAttachments + log_test + var = drv.EchoAttachments( + ArrayOfBinary[ + Attachment.new("foobar"), + Attachment.new("abc\0\0\0def"), + Attachment.new("ghi") + ] + ) + assert_equal(3, var.size) + assert_equal("foobar", var[0].content) + assert_equal("abc\0\0\0def", var[1].content) + assert_equal("ghi", var[2].content) + end + + def test_EchoAttachmentAsBase64 + log_test + var = drv.EchoAttachmentAsBase64(Attachment.new("foobar")) + assert_equal("foobar", var) + end + + def test_EchoBase64AsAttachment + log_test + var = drv.EchoBase64AsAttachment("abc\0\1\2def") + assert_equal("abc\0\1\2def", var.content) + end +end + +if $0 == __FILE__ + name = ARGV.shift || 'localhost' + location = ARGV.shift || 'http://localhost:10080/' + TestInteropR4.setup(name, location) +end diff --git a/vendor/gems/soap4r-1.5.8/test/runner.rb b/vendor/gems/soap4r-1.5.8/test/runner.rb new file mode 100644 index 00000000..e0f00ee2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/runner.rb @@ -0,0 +1,7 @@ +require 'test/unit' + +rcsid = %w$Id: runner.rb 1751 2007-05-02 08:15:55Z nahi $ +Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze +Release = rcsid[3].freeze + +exit Test::Unit::AutoRunner.run(true, File.dirname($0)) diff --git a/vendor/gems/soap4r-1.5.8/test/sm11/classDef.rb b/vendor/gems/soap4r-1.5.8/test/sm11/classDef.rb new file mode 100644 index 00000000..9cee5432 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/sm11/classDef.rb @@ -0,0 +1,155 @@ +# http://dopg.gr.jp/sm11.xsd +class C_struct + attr_accessor :e_boolean # {http://www.w3.org/2001/XMLSchema}boolean + attr_accessor :e_short # {http://www.w3.org/2001/XMLSchema}short + attr_accessor :e_int # {http://www.w3.org/2001/XMLSchema}int + attr_accessor :e_long # {http://www.w3.org/2001/XMLSchema}long + attr_accessor :e_float # {http://www.w3.org/2001/XMLSchema}float + attr_accessor :e_double # {http://www.w3.org/2001/XMLSchema}double + attr_accessor :e_String # {http://www.w3.org/2001/XMLSchema}string + + def initialize( e_boolean = nil, + e_short = nil, + e_int = nil, + e_long = nil, + e_float = nil, + e_double = nil, + e_String = nil ) + @e_boolean = nil + @e_short = nil + @e_int = nil + @e_long = nil + @e_float = nil + @e_double = nil + @e_String = nil + end +end + +# http://dopg.gr.jp/sm11.xsd +class ArrayOfboolean < Array; end + +# http://dopg.gr.jp/sm11.xsd +class ArrayOfshort < Array; end + +# http://dopg.gr.jp/sm11.xsd +class ArrayOfint < Array; end + +# http://dopg.gr.jp/sm11.xsd +class ArrayOflong < Array; end + +# http://dopg.gr.jp/sm11.xsd +class ArrayOffloat < Array; end + +# http://dopg.gr.jp/sm11.xsd +class ArrayOfdouble < Array; end + +# http://dopg.gr.jp/sm11.xsd +class ArrayOfstring < Array; end + +# http://dopg.gr.jp/sm11.xsd +class F_struct + attr_accessor :e_c_struct # {http://dopg.gr.jp/sm11.xsd}C_struct + attr_accessor :e_c_array_e_boolean # {http://dopg.gr.jp/sm11.xsd}ArrayOfboolean + attr_accessor :e_c_array_e_short # {http://dopg.gr.jp/sm11.xsd}ArrayOfshort + attr_accessor :e_c_array_e_int # {http://dopg.gr.jp/sm11.xsd}ArrayOfint + attr_accessor :e_c_array_e_long # {http://dopg.gr.jp/sm11.xsd}ArrayOflong + attr_accessor :e_c_array_e_float # {http://dopg.gr.jp/sm11.xsd}ArrayOffloat + attr_accessor :e_c_array_e_double # {http://dopg.gr.jp/sm11.xsd}ArrayOfdouble + attr_accessor :e_c_array_e_String # {http://dopg.gr.jp/sm11.xsd}ArrayOfstring + + def initialize( e_c_struct = nil, + e_c_array_e_boolean = nil, + e_c_array_e_short = nil, + e_c_array_e_int = nil, + e_c_array_e_long = nil, + e_c_array_e_float = nil, + e_c_array_e_double = nil, + e_c_array_e_String = nil ) + @e_c_struct = nil + @e_c_array_e_boolean = nil + @e_c_array_e_short = nil + @e_c_array_e_int = nil + @e_c_array_e_long = nil + @e_c_array_e_float = nil + @e_c_array_e_double = nil + @e_c_array_e_String = nil + end +end + +# http://dopg.gr.jp/sm11.xsd +class ArrayOfC_struct < Array; end + +# http://dopg.gr.jp/sm11.xsd +class A_except < StandardError + attr_accessor :v1 # {http://www.w3.org/2001/XMLSchema}boolean + attr_accessor :v4 # {http://www.w3.org/2001/XMLSchema}short + attr_accessor :v5 # {http://www.w3.org/2001/XMLSchema}int + attr_accessor :v6 # {http://www.w3.org/2001/XMLSchema}long + attr_accessor :v7 # {http://www.w3.org/2001/XMLSchema}float + attr_accessor :v8 # {http://www.w3.org/2001/XMLSchema}double + attr_accessor :v9 # {http://www.w3.org/2001/XMLSchema}string + + def initialize( v1 = nil, + v4 = nil, + v5 = nil, + v6 = nil, + v7 = nil, + v8 = nil, + v9 = nil ) + @v1 = nil + @v4 = nil + @v5 = nil + @v6 = nil + @v7 = nil + @v8 = nil + @v9 = nil + end +end + +# http://dopg.gr.jp/sm11.xsd +class C_except < StandardError + attr_accessor :v10 # {http://dopg.gr.jp/sm11.xsd}C_struct + attr_accessor :v21 # {http://dopg.gr.jp/sm11.xsd}ArrayOfboolean + attr_accessor :v24 # {http://dopg.gr.jp/sm11.xsd}ArrayOfshort + attr_accessor :v25 # {http://dopg.gr.jp/sm11.xsd}ArrayOfint + attr_accessor :v26 # {http://dopg.gr.jp/sm11.xsd}ArrayOflong + attr_accessor :v27 # {http://dopg.gr.jp/sm11.xsd}ArrayOffloat + attr_accessor :v28 # {http://dopg.gr.jp/sm11.xsd}ArrayOfdouble + attr_accessor :v29 # {http://dopg.gr.jp/sm11.xsd}ArrayOfstring + + def initialize( v10 = nil, + v21 = nil, + v24 = nil, + v25 = nil, + v26 = nil, + v27 = nil, + v28 = nil, + v29 = nil ) + @v10 = nil + @v21 = nil + @v24 = nil + @v25 = nil + @v26 = nil + @v27 = nil + @v28 = nil + @v29 = nil + end +end + +# http://dopg.gr.jp/sm11.xsd +class F_except1 < StandardError + attr_accessor :v40 # {http://dopg.gr.jp/sm11.xsd}F_struct + + def initialize( v40 = nil ) + @v40 = nil + end +end + +# http://dopg.gr.jp/sm11.xsd +class F_except2 < StandardError + attr_accessor :v50 # {http://dopg.gr.jp/sm11.xsd}ArrayOfC_struct + + def initialize( v50 = nil ) + @v50 = nil + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/sm11/client.rb b/vendor/gems/soap4r-1.5.8/test/sm11/client.rb new file mode 100644 index 00000000..705d4919 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/sm11/client.rb @@ -0,0 +1,542 @@ +# Done +# /^void/ def/ +# /^}/ end/ +# /System.out.print/STDOUT.puts/g +# /try { \(.*\) }/\1/ +# /\.set\([^(]*\)(\([^)]*\))/.\1 = \2/ +# /E_/e_/ +# /\.get\([^(]*\)()/.\1/ +# /(short)// +# +require 'soap/baseData' + +class Sm11Caller + include SOAP + + attr_reader :target + + def initialize( target ) + @target = target + end + +private + def cons_0000() + _v1 = C_struct.new() + _v1.e_boolean = false + _v1.e_short = SOAPShort.new(-100) + _v1.e_int = SOAPInt.new(-100000) + _v1.e_long = SOAPLong.new(-10000000000) + _v1.e_float = SOAPFloat.new(0.123) + _v1.e_double = 0.12e3 + _v1.e_String = "abc" + return(_v1) + end + def comp_0000(_v1) + return(true && + (_v1.e_boolean()) && + (_v1.e_short == -200) && + (_v1.e_int == -200000) && + (_v1.e_long == -20000000000) && + (_v1.e_float == 1.234) && + (_v1.e_double == 1.23e4) && + (_v1.e_String == "def") + ) + end + def cons_0001() + _v1 = C_struct.new() + _v1.e_boolean = false + _v1.e_short = SOAPShort.new(-100) + _v1.e_int = SOAPInt.new(-100000) + _v1.e_long = SOAPLong.new(-10000000000) + _v1.e_float = SOAPFloat.new(0.123) + _v1.e_double = 0.12e3 + _v1.e_String = "abc" + return(_v1) + end + def cons_0003() + _v1 = C_struct.new() + _v1.e_boolean = false + _v1.e_short = SOAPShort.new(-100) + _v1.e_int = SOAPInt.new(-100000) + _v1.e_long = SOAPLong.new(-10000000000) + _v1.e_float = SOAPFloat.new(0.123) + _v1.e_double = 0.12e3 + _v1.e_String = "abc" + return(_v1) + end + def cons_0002() + _v1 = F_struct.new() + _v1.e_c_struct = cons_0003() + _v1.e_c_array_e_boolean = ArrayOfboolean[false, false] + _v1.e_c_array_e_short = ArrayOfshort[-100, -100] + _v1.e_c_array_e_int = ArrayOfint[-100000, -100000] + _v1.e_c_array_e_long = ArrayOflong[-10000000000, -10000000000] + _v1.e_c_array_e_float = ArrayOffloat[0.123, 0.123] + _v1.e_c_array_e_double = ArrayOfdouble[0.12e3, 0.12e3] + _v1.e_c_array_e_String = ArrayOfstring["abc", "abc"] + return(_v1) + end + def comp_0002(_v1) + return(true && + (_v1.e_boolean()) && + (_v1.e_short == -200) && + (_v1.e_int == -200000) && + (_v1.e_long == -20000000000) && + (_v1.e_float == 1.234) && + (_v1.e_double == 1.23e4) && + (_v1.e_String == "def") + ) + end + def comp_0001(_v1) + return(true && + comp_0002(_v1.e_c_struct) && + (true && (_v1.e_c_array_e_boolean[0] == true) && (_v1.e_c_array_e_boolean[1] == true)) && + (true && (_v1.e_c_array_e_short[0] == -200) && (_v1.e_c_array_e_short[1] == -200)) && + (true && (_v1.e_c_array_e_int[0] == -200000) && (_v1.e_c_array_e_int[1] == -200000)) && + (true && (_v1.e_c_array_e_long[0] == -20000000000) && (_v1.e_c_array_e_long[1] == -20000000000)) && + (true && (_v1.e_c_array_e_float[0] == 1.234) && (_v1.e_c_array_e_float[1] == 1.234)) && + (true && (_v1.e_c_array_e_double[0] == 1.23e4) && (_v1.e_c_array_e_double[1] == 1.23e4)) && + (true && (_v1.e_c_array_e_String[0] == "def") && (_v1.e_c_array_e_String[1] == "def")) + ) + end + def cons_0004() + _v1 = C_struct.new() + _v1.e_boolean = false + _v1.e_short = SOAPShort.new(-100) + _v1.e_int = SOAPInt.new(-100000) + _v1.e_long = SOAPLong.new(-10000000000) + _v1.e_float = SOAPFloat.new(0.123) + _v1.e_double = 0.12e3 + _v1.e_String = "abc" + return(_v1) + end + def comp_0003(_v1) + return(true && + (_v1.e_boolean()) && + (_v1.e_short == -200) && + (_v1.e_int == -200000) && + (_v1.e_long == -20000000000) && + (_v1.e_float == 1.234) && + (_v1.e_double == 1.23e4) && + (_v1.e_String == "def") + ) + end + def cons_0006() + _v1 = C_struct.new() + _v1.e_boolean = false + _v1.e_short = SOAPShort.new(-100) + _v1.e_int = SOAPInt.new(-100000) + _v1.e_long = SOAPLong.new(-10000000000) + _v1.e_float = SOAPFloat.new(0.123) + _v1.e_double = 0.12e3 + _v1.e_String = "abc" + return(_v1) + end + def cons_0005() + _v1 = F_struct.new() + _v1.e_c_struct = cons_0006() + _v1.e_c_array_e_boolean = ArrayOfboolean[false, false] + _v1.e_c_array_e_short = ArrayOfshort[-100, -100] + _v1.e_c_array_e_int = ArrayOfint[-100000, -100000] + _v1.e_c_array_e_long = ArrayOflong[-10000000000, -10000000000] + _v1.e_c_array_e_float = ArrayOffloat[0.123, 0.123] + _v1.e_c_array_e_double = ArrayOfdouble[0.12e3, 0.12e3] + _v1.e_c_array_e_String = ArrayOfstring["abc", "abc"] + return(_v1) + end + def comp_0004(_v1) + return(true && + (_v1.v1()) && + (_v1.v4 == -200) && + (_v1.v5 == -200000) && + (_v1.v6 == -20000000000) && + (_v1.v7 == 1.234) && + (_v1.v8 == 1.23e4) && + (_v1.v9 == "def") + ) + end + def comp_0006(_v1) + return(true && + (_v1.e_boolean()) && + (_v1.e_short == -200) && + (_v1.e_int == -200000) && + (_v1.e_long == -20000000000) && + (_v1.e_float == 1.234) && + (_v1.e_double == 1.23e4) && + (_v1.e_String == "def") + ) + end + def comp_0005(_v1) + return(true && + comp_0006(_v1.v10) && + (true && (_v1.v21[0] == true) && (_v1.v21[1] == true)) && + (true && (_v1.v24[0] == -200) && (_v1.v24[1] == -200)) && + (true && (_v1.v25[0] == -200000) && (_v1.v25[1] == -200000)) && + (true && (_v1.v26[0] == -20000000000) && (_v1.v26[1] == -20000000000)) && + (true && (_v1.v27[0] == 1.234) && (_v1.v27[1] == 1.234)) && + (true && (_v1.v28[0] == 1.23e4) && (_v1.v28[1] == 1.23e4)) && + (true && (_v1.v29[0] == "def") && (_v1.v29[1] == "def")) + ) + end + def comp_0009(_v1) + return(true && + (_v1.e_boolean()) && + (_v1.e_short == -200) && + (_v1.e_int == -200000) && + (_v1.e_long == -20000000000) && + (_v1.e_float == 1.234) && + (_v1.e_double == 1.23e4) && + (_v1.e_String == "def") + ) + end + def comp_0008(_v1) + return(true && + comp_0009(_v1.e_c_struct) && + (true && (_v1.e_c_array_e_boolean[0] == true) && (_v1.e_c_array_e_boolean[1] == true)) && + (true && (_v1.e_c_array_e_short[0] == -200) && (_v1.e_c_array_e_short[1] == -200)) && + (true && (_v1.e_c_array_e_int[0] == -200000) && (_v1.e_c_array_e_int[1] == -200000)) && + (true && (_v1.e_c_array_e_long[0] == -20000000000) && (_v1.e_c_array_e_long[1] == -20000000000)) && + (true && (_v1.e_c_array_e_float[0] == 1.234) && (_v1.e_c_array_e_float[1] == 1.234)) && + (true && (_v1.e_c_array_e_double[0] == 1.23e4) && (_v1.e_c_array_e_double[1] == 1.23e4)) && + (true && (_v1.e_c_array_e_String[0] == "def") && (_v1.e_c_array_e_String[1] == "def")) + ) + end + def comp_0007(_v1) + return(true && + comp_0008(_v1.v40) + ) + end + def comp_0011(_v1) + return(true && + (_v1.e_boolean()) && + (_v1.e_short == -200) && + (_v1.e_int == -200000) && + (_v1.e_long == -20000000000) && + (_v1.e_float == 1.234) && + (_v1.e_double == 1.23e4) && + (_v1.e_String == "def") + ) + end + def comp_0010(_v1) + return(true && + (true && comp_0011(_v1.v50[0]) && comp_0011(_v1.v50[1])) + ) + end + + def call_op0() + STDOUT.puts("op0\n") + target.op0() + end + def call_op1() + STDOUT.puts("op1\n") + a1 = false + target.op1(a1) + end + def call_op4() + STDOUT.puts("op4\n") + a1 = SOAPShort.new(-100) + target.op4(a1) + end + def call_op5() + STDOUT.puts("op5\n") + a1 = -100000 + target.op5(a1) + end + def call_op6() + STDOUT.puts("op6\n") + a1 = -10000000000 + target.op6(a1) + end + def call_op7() + STDOUT.puts("op7\n") + a1 = SOAPFloat.new(0.123) + target.op7(a1) + end + def call_op8() + STDOUT.puts("op8\n") + a1 = 0.12e3 + target.op8(a1) + end + def call_op9() + STDOUT.puts("op9\n") + a1 = "abc" + target.op9(a1) + end + def call_op11() + STDOUT.puts("op11\n") + _ret = target.op11() + raise unless _ret.is_a?( TrueClass ) + if (!(_ret == true)); STDOUT.puts("_ret value error in op11\n"); end + end + def call_op14() + STDOUT.puts("op14\n") + _ret = target.op14() + raise unless _ret.is_a?( Integer ) + if (!(_ret == -200)); STDOUT.puts("_ret value error in op14\n"); end + end + def call_op15() + STDOUT.puts("op15\n") + _ret = target.op15() + raise unless _ret.is_a?( Integer ) + if (!(_ret == -200000)); STDOUT.puts("_ret value error in op15\n"); end + end + def call_op16() + STDOUT.puts("op16\n") + _ret = target.op16() + raise unless _ret.is_a?( Integer ) + if (!(_ret == -20000000000)); STDOUT.puts("_ret value error in op16\n"); end + end + def call_op17() + STDOUT.puts("op17\n") + _ret = target.op17() + raise unless _ret.is_a?( Float ) + if (!(_ret == 1.234)); STDOUT.puts("_ret value error in op17\n"); end + end + def call_op18() + STDOUT.puts("op18\n") + _ret = target.op18() + raise unless _ret.is_a?( Float ) + if (!(_ret == 1.23e4)); STDOUT.puts("_ret value error in op18\n"); end + end + def call_op19() + STDOUT.puts("op19\n") + _ret = target.op19() + raise unless _ret.is_a?( String ) + if (!(_ret == "def")); STDOUT.puts("_ret value error in op19\n"); end + end + def call_op21() + STDOUT.puts("op21\n") + a1 = false + _ret = target.op21(a1) + raise unless _ret.is_a?( TrueClass ) or _ret.is_a?( FalseClass ) + if (!(_ret == true)); STDOUT.puts("_ret value error in op21\n"); end + end + def call_op24() + STDOUT.puts("op24\n") + a1 = SOAPShort.new(-100) + a2 = SOAPInt.new(-100000) + a3 = SOAPLong.new(-10000000000) + _ret = target.op24(a1,a2,a3) + raise unless _ret.is_a?( Integer ) + if (!(_ret == -200)); STDOUT.puts("_ret value error in op24\n"); end + end + def call_op25() + STDOUT.puts("op25\n") + a1 = SOAPInt.new(-100000) + a2 = SOAPLong.new(-10000000000) + a3 = SOAPFloat.new(0.123) + _ret = target.op25(a1,a2,a3) + raise unless _ret.is_a?( Integer ) + if (!(_ret == -200000)); STDOUT.puts("_ret value error in op25\n"); end + end + def call_op26() + STDOUT.puts("op26\n") + a1 = SOAPLong.new(-10000000000) + a2 = SOAPFloat.new(0.123) + a3 = 0.12e3 + _ret = target.op26(a1,a2,a3) + raise unless _ret.is_a?( Integer ) + if (!(_ret == -20000000000)); STDOUT.puts("_ret value error in op26\n"); end + end + def call_op27() + STDOUT.puts("op27\n") + a1 = SOAPFloat.new(0.123) + a2 = 0.12e3 + a3 = "abc" + _ret = target.op27(a1,a2,a3) + raise unless _ret.is_a?( Float ) + if (!(_ret == 1.234)); STDOUT.puts("_ret value error in op27\n"); end + end + def call_op28() + STDOUT.puts("op28\n") + a1 = 0.12e3 + a2 = "abc" + a3 = false + _ret = target.op28(a1,a2,a3) + raise unless _ret.is_a?( Float ) + if (!(_ret == 1.23e4)); STDOUT.puts("_ret value error in op28\n"); end + end + def call_op29() + STDOUT.puts("op29\n") + a1 = "abc" + a2 = false + _ret = target.op29(a1,a2) + raise unless _ret.is_a?( String ) + if (!(_ret == "def")); STDOUT.puts("_ret value error in op29\n"); end + end + def call_op30() + STDOUT.puts("op30\n") + a1 = cons_0000() + _ret = target.op30(a1) + if (!comp_0000(_ret)); STDOUT.puts("_ret value error in op30\n"); end + end + def call_op31() + STDOUT.puts("op31\n") + a1 = ArrayOfboolean[false, false] + _ret = target.op31(a1) + if (!(true && (_ret[0] == true) && (_ret[1] == true))); STDOUT.puts("_ret value error in op31\n"); end + end + def call_op34() + STDOUT.puts("op34\n") + a1 = ArrayOfshort[-100, -100] + _ret = target.op34(a1) + if (!(true && (_ret[0] == -200) && (_ret[1] == -200))); STDOUT.puts("_ret value error in op34\n"); end + end + def call_op35() + STDOUT.puts("op35\n") + a1 = ArrayOfint[-100000, -100000] + _ret = target.op35(a1) + if (!(true && (_ret[0] == -200000) && (_ret[1] == -200000))); STDOUT.puts("_ret value error in op35\n"); end + end + def call_op36() + STDOUT.puts("op36\n") + a1 = ArrayOflong[-10000000000, -10000000000] + _ret = target.op36(a1) + if (!(true && (_ret[0] == -20000000000) && (_ret[1] == -20000000000))); STDOUT.puts("_ret value error in op36\n"); end + end + def call_op37() + STDOUT.puts("op37\n") + a1 = ArrayOffloat[0.123, 0.123] + _ret = target.op37(a1) + if (!(true && (_ret[0] == 1.234) && (_ret[1] == 1.234))); STDOUT.puts("_ret value error in op37\n"); end + end + def call_op38() + STDOUT.puts("op38\n") + a1 = ArrayOfdouble[0.12e3, 0.12e3] + _ret = target.op38(a1) + if (!(true && (_ret[0] == 1.23e4) && (_ret[1] == 1.23e4))); STDOUT.puts("_ret value error in op38\n"); end + end + def call_op39() + STDOUT.puts("op39\n") + a1 = ArrayOfstring["abc", "abc"] + _ret = target.op39(a1) + if (!(true && (_ret[0] == "def") && (_ret[1] == "def"))); STDOUT.puts("_ret value error in op39\n"); end + end + def call_op40() + STDOUT.puts("op40\n") + a1 = cons_0001() + a2 = ArrayOfboolean[false, false] + a3 = ArrayOfint[-100000, -100000] + a4 = ArrayOfdouble[0.12e3, 0.12e3] + a5 = ArrayOfstring["abc", "abc"] + target.op40(a1,a2,a3,a4,a5) + end + def call_op41() + STDOUT.puts("op41\n") + a1 = cons_0002() + _ret = target.op41(a1) + if (!comp_0001(_ret)); STDOUT.puts("_ret value error in op41\n"); end + end + def call_op42() + STDOUT.puts("op42\n") + a1 = ArrayOfC_struct[cons_0004(), cons_0004()] + _ret = target.op42(a1) + if (!(true && comp_0003(_ret[0]) && comp_0003(_ret[1]))); STDOUT.puts("_ret value error in op42\n"); end + end + def call_op43() + STDOUT.puts("op43\n") + a1 = cons_0005() + a2 = ArrayOfC_struct[cons_0006(), cons_0006()] + target.op43(a1,a2) + end + def call_excop1() + STDOUT.puts("excop1\n") + begin + target.excop1() + rescue A_except => _exc + if (!comp_0004(_exc)); STDOUT.puts("_exc value error in excop1\n"); end + return + end + STDOUT.puts("no exception raised in excop1\n") + end + def call_excop2() + STDOUT.puts("excop2\n") + begin + target.excop2() + rescue C_except => _exc + if (!comp_0005(_exc)); STDOUT.puts("_exc value error in excop2\n"); end + return + end + STDOUT.puts("no exception raised in excop2\n") + end + def call_excop3() + STDOUT.puts("excop3\n") + begin + target.excop3() + rescue F_except1 => _exc + if (!comp_0007(_exc)); STDOUT.puts("_exc value error in excop3\n"); end + return + end + STDOUT.puts("no exception raised in excop3\n") + end + def call_excop4() + STDOUT.puts("excop4\n") + begin + target.excop4() + rescue F_except2 => _exc + if (!comp_0010(_exc)); STDOUT.puts("_exc value error in excop4\n"); end + return + end + STDOUT.puts("no exception raised in excop4\n") + end + +public + + def dispatcher(argv, start, argc) + all = (start == argc) + i = all ? start-1 : start + while (i < argc) do + if (all || ("op0" == argv[i])); call_op0(); end + if (all || ("op1" == argv[i])); call_op1(); end + if (all || ("op4" == argv[i])); call_op4(); end + if (all || ("op5" == argv[i])); call_op5(); end + if (all || ("op6" == argv[i])); call_op6(); end + if (all || ("op7" == argv[i])); call_op7(); end + if (all || ("op8" == argv[i])); call_op8(); end + if (all || ("op9" == argv[i])); call_op9(); end + if (all || ("op11" == argv[i])); call_op11(); end + if (all || ("op14" == argv[i])); call_op14(); end + if (all || ("op15" == argv[i])); call_op15(); end + if (all || ("op16" == argv[i])); call_op16(); end + if (all || ("op17" == argv[i])); call_op17(); end + if (all || ("op18" == argv[i])); call_op18(); end + if (all || ("op19" == argv[i])); call_op19(); end + if (all || ("op21" == argv[i])); call_op21(); end + if (all || ("op24" == argv[i])); call_op24(); end + if (all || ("op25" == argv[i])); call_op25(); end + if (all || ("op26" == argv[i])); call_op26(); end + if (all || ("op27" == argv[i])); call_op27(); end + if (all || ("op28" == argv[i])); call_op28(); end + if (all || ("op29" == argv[i])); call_op29(); end + if (all || ("op30" == argv[i])); call_op30(); end + if (all || ("op31" == argv[i])); call_op31(); end + if (all || ("op34" == argv[i])); call_op34(); end + if (all || ("op35" == argv[i])); call_op35(); end + if (all || ("op36" == argv[i])); call_op36(); end + if (all || ("op37" == argv[i])); call_op37(); end + if (all || ("op38" == argv[i])); call_op38(); end + if (all || ("op39" == argv[i])); call_op39(); end + if (all || ("op40" == argv[i])); call_op40(); end + if (all || ("op41" == argv[i])); call_op41(); end + if (all || ("op42" == argv[i])); call_op42(); end + if (all || ("op43" == argv[i])); call_op43(); end + if (all || ("excop1" == argv[i])); call_excop1(); end + if (all || ("excop2" == argv[i])); call_excop2(); end + if (all || ("excop3" == argv[i])); call_excop3(); end + if (all || ("excop4" == argv[i])); call_excop4(); end + + i += 1 + end + end + +end + + +#url = "http://localhost:10080/" +#url = "http://16.175.170.131:8080/axis/services/sm11Port" +#url = "http://16.175.170.131/soapsrv" +url = ARGV.shift +require 'driver' +drv = Sm11PortType.new( url ) +#drv.setWireDumpDev( STDOUT ) +Sm11Caller.new( drv ).dispatcher( ARGV, 0, ARGV.size ) diff --git a/vendor/gems/soap4r-1.5.8/test/sm11/driver.rb b/vendor/gems/soap4r-1.5.8/test/sm11/driver.rb new file mode 100644 index 00000000..8dacd126 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/sm11/driver.rb @@ -0,0 +1,182 @@ +require 'classDef' +require 'soap/proxy' +require 'soap/rpcUtils' +require 'soap/streamHandler' + +class Sm11PortType + MappingRegistry = SOAP::RPCUtils::MappingRegistry.new + + MappingRegistry.set( + C_struct, + ::SOAP::SOAPStruct, + ::SOAP::RPCUtils::MappingRegistry::TypedStructFactory, + [ "http://dopg.gr.jp/sm11.xsd", "C_struct" ] + ) + MappingRegistry.set( + ArrayOfboolean, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "boolean" ] + ) + MappingRegistry.set( + ArrayOfshort, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "short" ] + ) + MappingRegistry.set( + ArrayOfint, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "int" ] + ) + MappingRegistry.set( + ArrayOflong, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "long" ] + ) + MappingRegistry.set( + ArrayOffloat, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "float" ] + ) + MappingRegistry.set( + ArrayOfdouble, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "double" ] + ) + MappingRegistry.set( + ArrayOfstring, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "string" ] + ) + MappingRegistry.set( + F_struct, + ::SOAP::SOAPStruct, + ::SOAP::RPCUtils::MappingRegistry::TypedStructFactory, + [ "http://dopg.gr.jp/sm11.xsd", "F_struct" ] + ) + MappingRegistry.set( + ArrayOfC_struct, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://dopg.gr.jp/sm11.xsd", "C_struct" ] + ) + + Methods = [ + [ "op0", "op0", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op1", "op1", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op4", "op4", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op5", "op5", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op6", "op6", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op7", "op7", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op8", "op8", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op9", "op9", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op11", "op11", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op14", "op14", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op15", "op15", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op16", "op16", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op17", "op17", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op18", "op18", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op19", "op19", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op21", "op21", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op24", "op24", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op25", "op25", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op26", "op26", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op27", "op27", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op28", "op28", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op29", "op29", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op30", "op30", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op31", "op31", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op34", "op34", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op35", "op35", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op36", "op36", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op37", "op37", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op38", "op38", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op39", "op39", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op40", "op40", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "in", "arg3" ], [ "in", "arg4" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op41", "op41", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op42", "op42", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op43", "op43", [ [ "in", "arg0" ], [ "in", "arg1" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "excop1", "excop1", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "excop2", "excop2", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "excop3", "excop3", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "excop4", "excop4", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ] + ] + + attr_reader :endpointUrl + attr_reader :proxyUrl + + def initialize( endpointUrl, proxyUrl = nil ) + @endpointUrl = endpointUrl + @proxyUrl = proxyUrl + @httpStreamHandler = SOAP::HTTPPostStreamHandler.new( @endpointUrl, + @proxyUrl ) + @proxy = SOAP::SOAPProxy.new( nil, @httpStreamHandler, nil ) + @proxy.allowUnqualifiedElement = true + @mappingRegistry = MappingRegistry + addMethod + end + + def setWireDumpDev( dumpDev ) + @httpStreamHandler.dumpDev = dumpDev + end + + def setDefaultEncodingStyle( encodingStyle ) + @proxy.defaultEncodingStyle = encodingStyle + end + + def getDefaultEncodingStyle + @proxy.defaultEncodingStyle + end + + def call( methodName, *params ) + # Convert parameters + params.collect! { | param | + SOAP::RPCUtils.obj2soap( param, @mappingRegistry ) + } + + # Then, call @proxy.call like the following. + header, body = @proxy.call( nil, methodName, *params ) + + # Check Fault. + begin + @proxy.checkFault( body ) + rescue SOAP::FaultError => e + SOAP::RPCUtils.fault2exception( e, @mappingRegistry ) + end + + ret = body.response ? + SOAP::RPCUtils.soap2obj( body.response, @mappingRegistry ) : nil + if body.outParams + outParams = body.outParams.collect { | outParam | + SOAP::RPCUtils.soap2obj( outParam ) + } + return [ ret ].concat( outParams ) + else + return ret + end + end + +private + + def addMethod + Methods.each do | methodNameAs, methodName, params, soapAction, namespace | + @proxy.addMethodAs( methodNameAs, methodName, params, soapAction, + namespace ) + addMethodInterface( methodNameAs, params ) + end + end + + def addMethodInterface( name, params ) + self.instance_eval <<-EOD + def #{ name }( *params ) + call( "#{ name }", *params ) + end + EOD + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/sm11/servant.rb b/vendor/gems/soap4r-1.5.8/test/sm11/servant.rb new file mode 100644 index 00000000..df872bf9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/sm11/servant.rb @@ -0,0 +1,1066 @@ +require 'classDef' + +# Done +# System.out.print -> STDOUT.puts +# a1 -> arg0 +# a2 -> arg1 +# a3 -> arg2 +# a4 -> arg3 +# a5 -> arg4 +# /if \([^{]*\){\([^}]*\)}/if \1; \2; end/ +# /\([0-9][0-9]*\)L/\1/ +# /\([0-9][0-9]*\)f/\1/ +# /\.equals(\([^)]*\))/ == \1/ +# /\.set\([^(]*\)(\([^)]*\))/.\1 = \2/ +# /E_/e_/ +# /\.get\([^(]*\)()/.\1/ +# /(short)// +# /\.V/.v/ +# +class Sm11PortType + include SOAP + + # SYNOPSIS + # op0 + # + # ARGS + # N/A + # + # RETURNS + # N/A + # + # RAISES + # N/A + # + def op0 + STDOUT.puts("op0\n") + return + end + + # SYNOPSIS + # op1( arg0 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}boolean + # + # RETURNS + # N/A + # + # RAISES + # N/A + # + def op1( arg0 ) + STDOUT.puts("op1\n") + if (!(arg0 == false)); STDOUT.puts("arg0 value error in op1\n"); end + return + end + + # SYNOPSIS + # op4( arg0 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}short + # + # RETURNS + # N/A + # + # RAISES + # N/A + # + def op4( arg0 ) + STDOUT.puts("op4\n") + if (!(arg0 == -100)); STDOUT.puts("arg0 value error in op4\n"); end + return + end + + # SYNOPSIS + # op5( arg0 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}int + # + # RETURNS + # N/A + # + # RAISES + # N/A + # + def op5( arg0 ) + STDOUT.puts("op5\n") + if (!(arg0 == -100000)); STDOUT.puts("arg0 value error in op5\n"); end + return + end + + # SYNOPSIS + # op6( arg0 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}long + # + # RETURNS + # N/A + # + # RAISES + # N/A + # + def op6( arg0 ) + STDOUT.puts("op6\n") + if (!(arg0 == -10000000000)); STDOUT.puts("arg0 value error in op6\n"); end + return + end + + # SYNOPSIS + # op7( arg0 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}float + # + # RETURNS + # N/A + # + # RAISES + # N/A + # + def op7( arg0 ) + STDOUT.puts("op7\n") + if (!(arg0 == 0.123)); STDOUT.puts("arg0 value error in op7\n"); end + return + end + + # SYNOPSIS + # op8( arg0 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}double + # + # RETURNS + # N/A + # + # RAISES + # N/A + # + def op8( arg0 ) + STDOUT.puts("op8\n") + if (!(arg0 == 0.12e3)); STDOUT.puts("arg0 value error in op8\n"); end + return + end + + # SYNOPSIS + # op9( arg0 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}string + # + # RETURNS + # N/A + # + # RAISES + # N/A + # + def op9( arg0 ) + STDOUT.puts("op9\n") + if (!(arg0 == "abc")); STDOUT.puts("arg0 value error in op9\n"); end + return + end + + # SYNOPSIS + # op11 + # + # ARGS + # N/A + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}boolean + # + # RAISES + # N/A + # + def op11 + STDOUT.puts("op11\n") + _ret = true + return(_ret) + end + + # SYNOPSIS + # op14 + # + # ARGS + # N/A + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}short + # + # RAISES + # N/A + # + def op14 + STDOUT.puts("op14\n") + _ret = SOAPShort.new(-200) + return(_ret) + end + + # SYNOPSIS + # op15 + # + # ARGS + # N/A + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}int + # + # RAISES + # N/A + # + def op15 + STDOUT.puts("op15\n") + _ret = SOAPInt.new( -200000 ) + return(_ret) + end + + # SYNOPSIS + # op16 + # + # ARGS + # N/A + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}long + # + # RAISES + # N/A + # + def op16 + STDOUT.puts("op16\n") + _ret = SOAPLong.new( -20000000000 ) + return(_ret) + end + + # SYNOPSIS + # op17 + # + # ARGS + # N/A + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}float + # + # RAISES + # N/A + # + def op17 + STDOUT.puts("op17\n") + _ret = SOAPFloat.new(1.234) + return(_ret) + end + + # SYNOPSIS + # op18 + # + # ARGS + # N/A + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}double + # + # RAISES + # N/A + # + def op18 + STDOUT.puts("op18\n") + _ret = 1.23e4 + return(_ret) + end + + # SYNOPSIS + # op19 + # + # ARGS + # N/A + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}string + # + # RAISES + # N/A + # + def op19 + STDOUT.puts("op19\n") + _ret = "def" + return(_ret) + end + + # SYNOPSIS + # op21( arg0 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}boolean + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}boolean + # + # RAISES + # N/A + # + def op21( arg0 ) + STDOUT.puts("op21\n") + if (!(arg0 == false)); STDOUT.puts("arg0 value error in op21\n"); end + _ret = true + return(_ret) + end + + # SYNOPSIS + # op24( arg0, arg1, arg2 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}short + # arg1 {http://www.w3.org/2001/XMLSchema}int + # arg2 {http://www.w3.org/2001/XMLSchema}long + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}short + # + # RAISES + # N/A + # + def op24( arg0, arg1, arg2 ) + STDOUT.puts("op24\n") + if (!(arg0 == -100)); STDOUT.puts("arg0 value error in op24\n"); end + if (!(arg1 == -100000)); STDOUT.puts("arg1 value error in op24\n"); end + if (!(arg2 == -10000000000)); STDOUT.puts("arg2 value error in op24\n"); end + _ret = SOAPShort.new(-200) + return(_ret) + end + + # SYNOPSIS + # op25( arg0, arg1, arg2 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}int + # arg1 {http://www.w3.org/2001/XMLSchema}long + # arg2 {http://www.w3.org/2001/XMLSchema}float + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}int + # + # RAISES + # N/A + # + def op25( arg0, arg1, arg2 ) + STDOUT.puts("op25\n") + if (!(arg0 == -100000)); STDOUT.puts("arg0 value error in op25\n"); end + if (!(arg1 == -10000000000)); STDOUT.puts("arg1 value error in op25\n"); end + if (!(arg2 == 0.123)); STDOUT.puts("arg2 value error in op25\n"); end + _ret = SOAPInt.new( -200000 ) + return(_ret) + end + + # SYNOPSIS + # op26( arg0, arg1, arg2 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}long + # arg1 {http://www.w3.org/2001/XMLSchema}float + # arg2 {http://www.w3.org/2001/XMLSchema}double + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}long + # + # RAISES + # N/A + # + def op26( arg0, arg1, arg2 ) + STDOUT.puts("op26\n") + if (!(arg0 == -10000000000)); STDOUT.puts("arg0 value error in op26\n"); end + if (!(arg1 == 0.123)); STDOUT.puts("arg1 value error in op26\n"); end + if (!(arg2 == 0.12e3)); STDOUT.puts("arg2 value error in op26\n"); end + _ret = SOAPLong.new( -20000000000 ) + return(_ret) + end + + # SYNOPSIS + # op27( arg0, arg1, arg2 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}float + # arg1 {http://www.w3.org/2001/XMLSchema}double + # arg2 {http://www.w3.org/2001/XMLSchema}string + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}float + # + # RAISES + # N/A + # + def op27( arg0, arg1, arg2 ) + STDOUT.puts("op27\n") + if (!(arg0 == 0.123)); STDOUT.puts("arg0 value error in op27\n"); end + if (!(arg1 == 0.12e3)); STDOUT.puts("arg1 value error in op27\n"); end + if (!(arg2 == "abc")); STDOUT.puts("arg2 value error in op27\n"); end + _ret = SOAPFloat.new(1.234) + return(_ret) + end + + # SYNOPSIS + # op28( arg0, arg1, arg2 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}double + # arg1 {http://www.w3.org/2001/XMLSchema}string + # arg2 {http://www.w3.org/2001/XMLSchema}boolean + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}double + # + # RAISES + # N/A + # + def op28( arg0, arg1, arg2 ) + STDOUT.puts("op28\n") + if (!(arg0 == 0.12e3)); STDOUT.puts("arg0 value error in op28\n"); end + if (!(arg1 == "abc")); STDOUT.puts("arg1 value error in op28\n"); end + if (!(arg2 == false)); STDOUT.puts("arg2 value error in op28\n"); end + _ret = 1.23e4 + return(_ret) + end + + # SYNOPSIS + # op29( arg0, arg1 ) + # + # ARGS + # arg0 {http://www.w3.org/2001/XMLSchema}string + # arg1 {http://www.w3.org/2001/XMLSchema}boolean + # + # RETURNS + # result {http://www.w3.org/2001/XMLSchema}string + # + # RAISES + # N/A + # + def op29( arg0, arg1 ) + STDOUT.puts("op29\n") + if (!(arg0 == "abc")); STDOUT.puts("arg0 value error in op29\n"); end + if (!(arg1 == false)); STDOUT.puts("arg1 value error in op29\n"); end + _ret = "def" + return(_ret) + end + + # SYNOPSIS + # op30( arg0 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}C_struct + # + # RETURNS + # result {http://dopg.gr.jp/sm11.xsd}C_struct + # + # RAISES + # N/A + # + def op30( arg0 ) + STDOUT.puts("op30\n") + if (!comp_0012(arg0)); STDOUT.puts("arg0 value error in op30\n"); end + _ret = cons_0007() + return(_ret) + end + + # SYNOPSIS + # op31( arg0 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}ArrayOfboolean + # + # RETURNS + # result {http://dopg.gr.jp/sm11.xsd}ArrayOfboolean + # + # RAISES + # N/A + # + def op31( arg0 ) + STDOUT.puts("op31\n") + if (!(true && (arg0[0] == false) && (arg0[1] == false))); STDOUT.puts("arg0 value error in op31\n"); end + _ret = ArrayOfboolean[true, true] + return(_ret) + end + + # SYNOPSIS + # op34( arg0 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}ArrayOfshort + # + # RETURNS + # result {http://dopg.gr.jp/sm11.xsd}ArrayOfshort + # + # RAISES + # N/A + # + def op34( arg0 ) + STDOUT.puts("op34\n") + if (!(true && (arg0[0] == -100) && (arg0[1] == -100))); STDOUT.puts("arg0 value error in op34\n"); end + _ret = ArrayOfshort[-200, -200] + return(_ret) + end + + # SYNOPSIS + # op35( arg0 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}ArrayOfint + # + # RETURNS + # result {http://dopg.gr.jp/sm11.xsd}ArrayOfint + # + # RAISES + # N/A + # + def op35( arg0 ) + STDOUT.puts("op35\n") + if (!(true && (arg0[0] == -100000) && (arg0[1] == -100000))); STDOUT.puts("arg0 value error in op35\n"); end + _ret = ArrayOfint[-200000, -200000] + return(_ret) + end + + # SYNOPSIS + # op36( arg0 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}ArrayOflong + # + # RETURNS + # result {http://dopg.gr.jp/sm11.xsd}ArrayOflong + # + # RAISES + # N/A + # + def op36( arg0 ) + STDOUT.puts("op36\n") + if (!(true && (arg0[0] == -10000000000) && (arg0[1] == -10000000000))); STDOUT.puts("arg0 value error in op36\n"); end + _ret = ArrayOflong[-20000000000, -20000000000] + return(_ret) + end + + # SYNOPSIS + # op37( arg0 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}ArrayOffloat + # + # RETURNS + # result {http://dopg.gr.jp/sm11.xsd}ArrayOffloat + # + # RAISES + # N/A + # + def op37( arg0 ) + STDOUT.puts("op37\n") + if (!(true && (arg0[0] == 0.123) && (arg0[1] == 0.123))); STDOUT.puts("arg0 value error in op37\n"); end + _ret = ArrayOffloat[1.234, 1.234] + return(_ret) + end + + # SYNOPSIS + # op38( arg0 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}ArrayOfdouble + # + # RETURNS + # result {http://dopg.gr.jp/sm11.xsd}ArrayOfdouble + # + # RAISES + # N/A + # + def op38( arg0 ) + STDOUT.puts("op38\n") + if (!(true && (arg0[0] == 0.12e3) && (arg0[1] == 0.12e3))); STDOUT.puts("arg0 value error in op38\n"); end + _ret = ArrayOfdouble[1.23e4, 1.23e4] + return(_ret) + end + + # SYNOPSIS + # op39( arg0 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}ArrayOfstring + # + # RETURNS + # result {http://dopg.gr.jp/sm11.xsd}ArrayOfstring + # + # RAISES + # N/A + # + def op39( arg0 ) + STDOUT.puts("op39\n") + if (!(true && (arg0[0] == "abc") && (arg0[1] == "abc"))); STDOUT.puts("arg0 value error in op39\n"); end + _ret = ArrayOfstring["def", "def"] + return(_ret) + end + + # SYNOPSIS + # op40( arg0, arg1, arg2, arg3, arg4 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}C_struct + # arg1 {http://dopg.gr.jp/sm11.xsd}ArrayOfboolean + # arg2 {http://dopg.gr.jp/sm11.xsd}ArrayOfint + # arg3 {http://dopg.gr.jp/sm11.xsd}ArrayOfdouble + # arg4 {http://dopg.gr.jp/sm11.xsd}ArrayOfstring + # + # RETURNS + # N/A + # + # RAISES + # N/A + # + def op40( arg0, arg1, arg2, arg3, arg4 ) + STDOUT.puts("op40\n") + if (!comp_0013(arg0)); STDOUT.puts("arg0 value error in op40\n"); end + if (!(true && (arg1[0] == false) && (arg1[1] == false))); STDOUT.puts("arg1 value error in op40\n"); end + if (!(true && (arg2[0] == -100000) && (arg2[1] == -100000))); STDOUT.puts("arg2 value error in op40\n"); end + if (!(true && (arg3[0] == 0.12e3) && (arg3[1] == 0.12e3))); STDOUT.puts("arg3 value error in op40\n"); end + if (!(true && (arg4[0] == "abc") && (arg4[1] == "abc"))); STDOUT.puts("arg4 value error in op40\n"); end + return + end + + # SYNOPSIS + # op41( arg0 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}F_struct + # + # RETURNS + # result {http://dopg.gr.jp/sm11.xsd}F_struct + # + # RAISES + # N/A + # + def op41( arg0 ) + STDOUT.puts("op41\n") + if (!comp_0014(arg0)); STDOUT.puts("arg0 value error in op41\n"); end + _ret = cons_0008() + return(_ret) + end + + # SYNOPSIS + # op42( arg0 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}ArrayOfC_struct + # + # RETURNS + # result {http://dopg.gr.jp/sm11.xsd}ArrayOfC_struct + # + # RAISES + # N/A + # + def op42( arg0 ) + STDOUT.puts("op42\n") + if (!(true && comp_0016(arg0[0]) && comp_0016(arg0[1]))); STDOUT.puts("arg0 value error in op42\n"); end + _ret = ArrayOfC_struct[cons_0010(), cons_0010()] + return(_ret) + end + + # SYNOPSIS + # op43( arg0, arg1 ) + # + # ARGS + # arg0 {http://dopg.gr.jp/sm11.xsd}F_struct + # arg1 {http://dopg.gr.jp/sm11.xsd}ArrayOfC_struct + # + # RETURNS + # N/A + # + # RAISES + # N/A + # + def op43( arg0, arg1 ) + STDOUT.puts("op43\n") + if (!comp_0017(arg0)); STDOUT.puts("arg0 value error in op43\n"); end + if (!(true && comp_0018(arg1[0]) && comp_0018(arg1[1]))); STDOUT.puts("arg1 value error in op43\n"); end + return + end + + # SYNOPSIS + # excop1 + # + # ARGS + # N/A + # + # RETURNS + # N/A + # + # RAISES + # arg0 {http://dopg.gr.jp/sm11.xsd}A_except + # + def excop1 + STDOUT.puts("excop1\n") + _exc = cons_0011() + raise(_exc) + end + + # SYNOPSIS + # excop2 + # + # ARGS + # N/A + # + # RETURNS + # N/A + # + # RAISES + # arg0 {http://dopg.gr.jp/sm11.xsd}C_except + # + def excop2 + STDOUT.puts("excop2\n") + _exc = cons_0012() + raise(_exc) + end + + # SYNOPSIS + # excop3 + # + # ARGS + # N/A + # + # RETURNS + # N/A + # + # RAISES + # arg0 {http://dopg.gr.jp/sm11.xsd}F_except1 + # + def excop3 + STDOUT.puts("excop3\n") + _exc = cons_0014() + raise(_exc) + end + + # SYNOPSIS + # excop4 + # + # ARGS + # N/A + # + # RETURNS + # N/A + # + # RAISES + # arg0 {http://dopg.gr.jp/sm11.xsd}F_except2 + # + def excop4 + STDOUT.puts("excop4\n") + _exc = cons_0017() + raise(_exc) + end + + + require 'soap/rpcUtils' + MappingRegistry = SOAP::RPCUtils::MappingRegistry.new + + MappingRegistry.set( + C_struct, + ::SOAP::SOAPStruct, + ::SOAP::RPCUtils::MappingRegistry::TypedStructFactory, + [ "http://dopg.gr.jp/sm11.xsd", "C_struct" ] + ) + MappingRegistry.set( + ArrayOfboolean, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "boolean" ] + ) + MappingRegistry.set( + ArrayOfshort, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "short" ] + ) + MappingRegistry.set( + ArrayOfint, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "int" ] + ) + MappingRegistry.set( + ArrayOflong, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "long" ] + ) + MappingRegistry.set( + ArrayOffloat, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "float" ] + ) + MappingRegistry.set( + ArrayOfdouble, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "double" ] + ) + MappingRegistry.set( + ArrayOfstring, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://www.w3.org/2001/XMLSchema", "string" ] + ) + MappingRegistry.set( + F_struct, + ::SOAP::SOAPStruct, + ::SOAP::RPCUtils::MappingRegistry::TypedStructFactory, + [ "http://dopg.gr.jp/sm11.xsd", "F_struct" ] + ) + MappingRegistry.set( + ArrayOfC_struct, + ::SOAP::SOAPArray, + ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, + [ "http://dopg.gr.jp/sm11.xsd", "C_struct" ] + ) + + Methods = [ + [ "op0", "op0", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op1", "op1", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op4", "op4", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op5", "op5", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op6", "op6", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op7", "op7", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op8", "op8", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op9", "op9", [ [ "in", "arg0" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op11", "op11", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op14", "op14", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op15", "op15", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op16", "op16", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op17", "op17", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op18", "op18", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op19", "op19", [ [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op21", "op21", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op24", "op24", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op25", "op25", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op26", "op26", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op27", "op27", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op28", "op28", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op29", "op29", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op30", "op30", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op31", "op31", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op34", "op34", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op35", "op35", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op36", "op36", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op37", "op37", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op38", "op38", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op39", "op39", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op40", "op40", [ [ "in", "arg0" ], [ "in", "arg1" ], [ "in", "arg2" ], [ "in", "arg3" ], [ "in", "arg4" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op41", "op41", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op42", "op42", [ [ "in", "arg0" ], [ "retval", "result" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "op43", "op43", [ [ "in", "arg0" ], [ "in", "arg1" ] ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "excop1", "excop1", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "excop2", "excop2", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "excop3", "excop3", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ], + [ "excop4", "excop4", [ ], "http://dopg.gr.jp/sm11", "http://dopg.gr.jp/sm11" ] + ] + +private + + def comp_0012(_v1) + return(true && + (! _v1.e_boolean()) && + (_v1.e_short == -100) && + (_v1.e_int == -100000) && + (_v1.e_long == -10000000000) && + (_v1.e_float == 0.123) && + (_v1.e_double == 0.12e3) && + (_v1.e_String == "abc") + ) + end + def cons_0007() + _v1 = C_struct.new() + _v1.e_boolean = true + _v1.e_short = SOAPShort.new(-200) + _v1.e_int = SOAPInt.new(-200000) + _v1.e_long = SOAPLong.new(-20000000000) + _v1.e_float = SOAPFloat.new(1.234) + _v1.e_double = 1.23e4 + _v1.e_String = "def" + return(_v1) + end + def comp_0013(_v1) + return(true && + (! _v1.e_boolean()) && + (_v1.e_short == -100) && + (_v1.e_int == -100000) && + (_v1.e_long == -10000000000) && + (_v1.e_float == 0.123) && + (_v1.e_double == 0.12e3) && + (_v1.e_String == "abc") + ) + end + def comp_0015(_v1) + return(true && + (! _v1.e_boolean()) && + (_v1.e_short == -100) && + (_v1.e_int == -100000) && + (_v1.e_long == -10000000000) && + (_v1.e_float == 0.123) && + (_v1.e_double == 0.12e3) && + (_v1.e_String == "abc") + ) + end + def comp_0014(_v1) + return(true && + comp_0015(_v1.e_c_struct) && + (true && (_v1.e_c_array_e_boolean[0] == false) && (_v1.e_c_array_e_boolean[1] == false)) && + (true && (_v1.e_c_array_e_short[0] == -100) && (_v1.e_c_array_e_short[1] == -100)) && + (true && (_v1.e_c_array_e_int[0] == -100000) && (_v1.e_c_array_e_int[1] == -100000)) && + (true && (_v1.e_c_array_e_long[0] == -10000000000) && (_v1.e_c_array_e_long[1] == -10000000000)) && + (true && (_v1.e_c_array_e_float[0] == 0.123) && (_v1.e_c_array_e_float[1] == 0.123)) && + (true && (_v1.e_c_array_e_double[0] == 0.12e3) && (_v1.e_c_array_e_double[1] == 0.12e3)) && + (true && (_v1.e_c_array_e_String[0] == "abc") && (_v1.e_c_array_e_String[1] == "abc")) + ) + end + def cons_0009() + _v1 = C_struct.new() + _v1.e_boolean = true + _v1.e_short = SOAPShort.new(-200) + _v1.e_int = SOAPInt.new(-200000) + _v1.e_long = SOAPLong.new(-20000000000) + _v1.e_float = SOAPFloat.new(1.234) + _v1.e_double = 1.23e4 + _v1.e_String = "def" + return(_v1) + end + def cons_0008() + _v1 = F_struct.new() + _v1.e_c_struct = cons_0009() + _v1.e_c_array_e_boolean = ArrayOfboolean[true, true] + _v1.e_c_array_e_short = ArrayOfshort[-200, -200] + _v1.e_c_array_e_int = ArrayOfint[-200000, -200000] + _v1.e_c_array_e_long = ArrayOflong[-20000000000, -20000000000] + _v1.e_c_array_e_float = ArrayOffloat[1.234, 1.234] + _v1.e_c_array_e_double = ArrayOfdouble[1.23e4, 1.23e4] + _v1.e_c_array_e_String = ArrayOfstring["def", "def"] + return(_v1) + end + def comp_0016(_v1) + return(true && + (! _v1.e_boolean()) && + (_v1.e_short == -100) && + (_v1.e_int == -100000) && + (_v1.e_long == -10000000000) && + (_v1.e_float == 0.123) && + (_v1.e_double == 0.12e3) && + (_v1.e_String == "abc") + ) + end + def cons_0010() + _v1 = C_struct.new() + _v1.e_boolean = true + _v1.e_short = SOAPShort.new(-200) + _v1.e_int = SOAPInt.new(-200000) + _v1.e_long = SOAPLong.new(-20000000000) + _v1.e_float = SOAPFloat.new(1.234) + _v1.e_double = 1.23e4 + _v1.e_String = "def" + return(_v1) + end + def comp_0018(_v1) + return(true && + (! _v1.e_boolean()) && + (_v1.e_short == -100) && + (_v1.e_int == -100000) && + (_v1.e_long == -10000000000) && + (_v1.e_float == 0.123) && + (_v1.e_double == 0.12e3) && + (_v1.e_String == "abc") + ) + end + def comp_0017(_v1) + return(true && + comp_0018(_v1.e_c_struct) && + (true && (_v1.e_c_array_e_boolean[0] == false) && (_v1.e_c_array_e_boolean[1] == false)) && + (true && (_v1.e_c_array_e_short[0] == -100) && (_v1.e_c_array_e_short[1] == -100)) && + (true && (_v1.e_c_array_e_int[0] == -100000) && (_v1.e_c_array_e_int[1] == -100000)) && + (true && (_v1.e_c_array_e_long[0] == -10000000000) && (_v1.e_c_array_e_long[1] == -10000000000)) && + (true && (_v1.e_c_array_e_float[0] == 0.123) && (_v1.e_c_array_e_float[1] == 0.123)) && + (true && (_v1.e_c_array_e_double[0] == 0.12e3) && (_v1.e_c_array_e_double[1] == 0.12e3)) && + (true && (_v1.e_c_array_e_String[0] == "abc") && (_v1.e_c_array_e_String[1] == "abc")) + ) + end + def cons_0011() + _v1 = A_except.new() + _v1.v1 = true + _v1.v4 = SOAPShort.new(-200) + _v1.v5 = SOAPInt.new(-200000) + _v1.v6 = SOAPLong.new(-20000000000) + _v1.v7 = SOAPFloat.new(1.234) + _v1.v8 = 1.23e4 + _v1.v9 = "def" + return(_v1) + end + def cons_0013() + _v1 = C_struct.new() + _v1.e_boolean = true + _v1.e_short = SOAPShort.new(-200) + _v1.e_int = SOAPInt.new(-200000) + _v1.e_long = SOAPLong.new(-20000000000) + _v1.e_float = SOAPFloat.new(1.234) + _v1.e_double = 1.23e4 + _v1.e_String = "def" + return(_v1) + end + def cons_0012() + _v1 = C_except.new() + _v1.v10 = cons_0013() + _v1.v21 = ArrayOfboolean[true, true] + _v1.v24 = ArrayOfshort[-200, -200] + _v1.v25 = ArrayOfint[-200000, -200000] + _v1.v26 = ArrayOflong[-20000000000, -20000000000] + _v1.v27 = ArrayOffloat[1.234, 1.234] + _v1.v28 = ArrayOfdouble[1.23e4, 1.23e4] + _v1.v29 = ArrayOfstring["def", "def"] + return(_v1) + end + def cons_0016() + _v1 = C_struct.new() + _v1.e_boolean = true + _v1.e_short = SOAPShort.new(-200) + _v1.e_int = SOAPInt.new(-200000) + _v1.e_long = SOAPLong.new(-20000000000) + _v1.e_float = SOAPFloat.new(1.234) + _v1.e_double = 1.23e4 + _v1.e_String = "def" + return(_v1) + end + def cons_0015() + _v1 = F_struct.new() + _v1.e_c_struct = cons_0016() + _v1.e_c_array_e_boolean = ArrayOfboolean[true, true] + _v1.e_c_array_e_short = ArrayOfshort[-200, -200] + _v1.e_c_array_e_int = ArrayOfint[-200000, -200000] + _v1.e_c_array_e_long = ArrayOflong[-20000000000, -20000000000] + _v1.e_c_array_e_float = ArrayOffloat[1.234, 1.234] + _v1.e_c_array_e_double = ArrayOfdouble[1.23e4, 1.23e4] + _v1.e_c_array_e_String = ArrayOfstring["def", "def"] + return(_v1) + end + def cons_0014() + _v1 = F_except1.new() + _v1.v40 = cons_0015() + return(_v1) + end + def cons_0018() + _v1 = C_struct.new() + _v1.e_boolean = true + _v1.e_short = SOAPShort.new(-200) + _v1.e_int = SOAPInt.new(-200000) + _v1.e_long = SOAPLong.new(-20000000000) + _v1.e_float = SOAPFloat.new(1.234) + _v1.e_double = 1.23e4 + _v1.e_String = "def" + return(_v1) + end + def cons_0017() + _v1 = F_except2.new() + _v1.v50 = ArrayOfC_struct[cons_0018(), cons_0018()] + return(_v1) + end + +end diff --git a/vendor/gems/soap4r-1.5.8/test/sm11/server.rb b/vendor/gems/soap4r-1.5.8/test/sm11/server.rb new file mode 100644 index 00000000..275b011f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/sm11/server.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby + +$KCODE = "UTF8" # Set $KCODE before loading 'soap/xmlparser'. + +require 'soap/standaloneServer' +require 'servant' + +class App < SOAP::StandaloneServer + def initialize( *arg ) + super( *arg ) + + # Explicit definition + servant = Sm11PortType.new + Sm11PortType::Methods.each do | methodNameAs, methodName, params, soapAction, namespace | + addMethodWithNSAs( namespace, servant, methodName, methodNameAs, params, soapAction ) + end + # Easy way to add all methods. + addServant( Sm11PortType.new ) + + self.mappingRegistry = Sm11PortType::MappingRegistry + self.level = Logger::Severity::ERROR + end +end + +App.new( 'App', nil, '0.0.0.0', 10080 ).start diff --git a/vendor/gems/soap4r-1.5.8/test/soap/asp.net/hello.wsdl b/vendor/gems/soap4r-1.5.8/test/soap/asp.net/hello.wsdl new file mode 100644 index 00000000..b94129c1 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/asp.net/hello.wsdl @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/soap/asp.net/test_aspdotnet.rb b/vendor/gems/soap4r-1.5.8/test/soap/asp.net/test_aspdotnet.rb new file mode 100644 index 00000000..b0cd8d12 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/asp.net/test_aspdotnet.rb @@ -0,0 +1,123 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'soap/rpc/driver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +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 if @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 = TestUtil.start_server_thread(@server) + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + 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_xml + @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')) + require 'rexml/document' + xml = <<__XML__ + + Mike + +__XML__ + ele = REXML::Document.new(xml) + assert_equal("Hello Mike", @client.sayHello(ele)) + def xml.to_xmlpart; to_s; end + assert_equal("Hello Mike", @client.sayHello(xml)) + 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?(HTTPClient) + + # qualified! + REQUEST_ASPDOTNETHANDLER = +%q[ + + + + Mike + + +] + + 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), + [REQUEST_ASPDOTNETHANDLER, parse_requestxml(str)].join("\n\n")) + end + + def parse_requestxml(str) + str.split(/\r?\n\r?\n/)[3] + end + + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/auth/htdigest b/vendor/gems/soap4r-1.5.8/test/soap/auth/htdigest new file mode 100644 index 00000000..55893eab --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/auth/htdigest @@ -0,0 +1,2 @@ +admin:auth:4302fe65caa32f27721949149ccd3083 +guest:auth:402550d83a8289be65377d0e7d11fb6e diff --git a/vendor/gems/soap4r-1.5.8/test/soap/auth/htpasswd b/vendor/gems/soap4r-1.5.8/test/soap/auth/htpasswd new file mode 100644 index 00000000..70df50c9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/auth/htpasswd @@ -0,0 +1,2 @@ +admin:Qg266hq/YYKe2 +guest:gbPc4vPCH.h12 diff --git a/vendor/gems/soap4r-1.5.8/test/soap/auth/test_basic.rb b/vendor/gems/soap4r-1.5.8/test/soap/auth/test_basic.rb new file mode 100644 index 00000000..b0cbf420 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/auth/test_basic.rb @@ -0,0 +1,117 @@ +require 'test/unit' +require 'soap/rpc/driver' +require 'webrick' +require 'webrick/httpproxy' +require 'logger' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module SOAP; module Auth + + +class TestBasic < Test::Unit::TestCase + Port = 17171 + ProxyPort = 17172 + + def setup + @logger = Logger.new(STDERR) + @logger.level = Logger::Severity::FATAL + @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 if @server + teardown_proxyserver if @proxyserver + teardown_server if @client + 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__)) + ) + htpasswd = File.join(File.dirname(__FILE__), 'htpasswd') + htpasswd_userdb = WEBrick::HTTPAuth::Htpasswd.new(htpasswd) + @basic_auth = WEBrick::HTTPAuth::BasicAuth.new( + :Logger => @logger, + :Realm => 'auth', + :UserDB => htpasswd_userdb + ) + @server.mount( + '/', + WEBrick::HTTPServlet::ProcHandler.new(method(:do_server_proc).to_proc) + ) + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_proxyserver + @proxyserver = WEBrick::HTTPProxyServer.new( + :BindAddress => "0.0.0.0", + :Logger => @logger, + :Port => ProxyPort, + :AccessLog => [] + ) + @proxyserver_thread = TestUtil.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 do_server_proc(req, res) + @basic_auth.authenticate(req, res) + res['content-type'] = 'text/xml' + res.body = <<__EOX__ + + + + + OK + + + +__EOX__ + end + + def test_direct + @client.wiredump_dev = STDOUT if $DEBUG + @client.options["protocol.http.auth"] << [@url, "admin", "admin"] + assert_equal("OK", @client.do_server_proc) + end + + def test_proxy + setup_proxyserver + @client.wiredump_dev = STDOUT if $DEBUG + @client.options["protocol.http.proxy"] = @proxyurl + @client.options["protocol.http.auth"] << [@url, "guest", "guest"] + assert_equal("OK", @client.do_server_proc) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/auth/test_digest.rb b/vendor/gems/soap4r-1.5.8/test/soap/auth/test_digest.rb new file mode 100644 index 00000000..4df4660f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/auth/test_digest.rb @@ -0,0 +1,118 @@ +require 'test/unit' +require 'soap/rpc/driver' +require 'webrick' +require 'webrick/httpproxy' +require 'logger' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module SOAP; module Auth + + +class TestDigest < Test::Unit::TestCase + Port = 17171 + ProxyPort = 17172 + + def setup + @logger = Logger.new(STDERR) + @logger.level = Logger::Severity::FATAL + @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 if @client + teardown_proxyserver if @proxyserver + teardown_server if @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__)) + ) + htdigest = File.join(File.dirname(__FILE__), 'htdigest') + htdigest_userdb = WEBrick::HTTPAuth::Htdigest.new(htdigest) + @digest_auth = WEBrick::HTTPAuth::DigestAuth.new( + :Logger => @logger, + :Algorithm => 'MD5', + :Realm => 'auth', + :UserDB => htdigest_userdb + ) + @server.mount( + '/', + WEBrick::HTTPServlet::ProcHandler.new(method(:do_server_proc).to_proc) + ) + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_proxyserver + @proxyserver = WEBrick::HTTPProxyServer.new( + :BindAddress => "0.0.0.0", + :Logger => @logger, + :Port => ProxyPort, + :AccessLog => [] + ) + @proxyserver_thread = TestUtil.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 do_server_proc(req, res) + @digest_auth.authenticate(req, res) + res['content-type'] = 'text/xml' + res.body = <<__EOX__ + + + + + OK + + + +__EOX__ + end + + def test_direct + @client.wiredump_dev = STDOUT if $DEBUG + @client.options["protocol.http.auth"] << [@url, "admin", "admin"] + assert_equal("OK", @client.do_server_proc) + end + + def test_proxy + setup_proxyserver + @client.wiredump_dev = STDOUT if $DEBUG + @client.options["protocol.http.proxy"] = @proxyurl + @client.options["protocol.http.auth"] << [@url, "guest", "guest"] + assert_equal("OK", @client.do_server_proc) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/calc/calc.rb b/vendor/gems/soap4r-1.5.8/test/soap/calc/calc.rb new file mode 100644 index 00000000..6bc78803 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/calc/calc.rb @@ -0,0 +1,17 @@ +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/vendor/gems/soap4r-1.5.8/test/soap/calc/calc2.rb b/vendor/gems/soap4r-1.5.8/test/soap/calc/calc2.rb new file mode 100644 index 00000000..69495730 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/calc/calc2.rb @@ -0,0 +1,29 @@ +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/vendor/gems/soap4r-1.5.8/test/soap/calc/server.cgi b/vendor/gems/soap4r-1.5.8/test/soap/calc/server.cgi new file mode 100644 index 00000000..1eb0d1d8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/calc/server.cgi @@ -0,0 +1,13 @@ +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/vendor/gems/soap4r-1.5.8/test/soap/calc/server.rb b/vendor/gems/soap4r-1.5.8/test/soap/calc/server.rb new file mode 100644 index 00000000..a93774d9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/calc/server.rb @@ -0,0 +1,17 @@ +#!/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/vendor/gems/soap4r-1.5.8/test/soap/calc/server2.rb b/vendor/gems/soap4r-1.5.8/test/soap/calc/server2.rb new file mode 100644 index 00000000..01c6d752 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/calc/server2.rb @@ -0,0 +1,20 @@ +#!/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/vendor/gems/soap4r-1.5.8/test/soap/calc/test_calc.rb b/vendor/gems/soap4r-1.5.8/test/soap/calc/test_calc.rb new file mode 100644 index 00000000..7976bfbf --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/calc/test_calc.rb @@ -0,0 +1,51 @@ +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 if @server + if @t + @t.kill + @t.join + end + @calc.reset_stream if @calc + 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/vendor/gems/soap4r-1.5.8/test/soap/calc/test_calc2.rb b/vendor/gems/soap4r-1.5.8/test/soap/calc/test_calc2.rb new file mode 100644 index 00000000..277600b3 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/calc/test_calc2.rb @@ -0,0 +1,55 @@ +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 if @server + if @t + @t.kill + @t.join + end + @var.reset_stream if @var + 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/vendor/gems/soap4r-1.5.8/test/soap/calc/test_calc_cgi.rb b/vendor/gems/soap4r-1.5.8/test/soap/calc/test_calc_cgi.rb new file mode 100644 index 00000000..4f248f85 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/calc/test_calc_cgi.rb @@ -0,0 +1,71 @@ +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( + Config::CONFIG["bindir"], + Config::CONFIG["ruby_install_name"] + Config::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 if @server + if @t + @t.kill + @t.join + end + @calc.reset_stream if @calc + 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/vendor/gems/soap4r-1.5.8/test/soap/case/test_mapping.rb b/vendor/gems/soap4r-1.5.8/test/soap/case/test_mapping.rb new file mode 100644 index 00000000..3f29acba --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/case/test_mapping.rb @@ -0,0 +1,57 @@ +require 'test/unit' +require 'soap/marshal' + + +module SOAP; module Case + +# {urn:TruckMateTypes}TTMHeader +class TTMHeader + @@schema_type = "TTMHeader" + @@schema_ns = "urn:TruckMateTypes" + @@schema_element = [ + ["dSN", ["SOAP::SOAPString", XSD::QName.new(nil, "DSN")]], + ["password", ["SOAP::SOAPString", XSD::QName.new(nil, "Password")]], + ["schema", ["SOAP::SOAPString", XSD::QName.new(nil, "Schema")]], + ["username", ["SOAP::SOAPString", XSD::QName.new(nil, "Username")]] + ] + + attr_accessor :dSN + attr_accessor :password + attr_accessor :schema + attr_accessor :username + + def initialize(dSN = nil, password = nil, schema = nil, username = nil) + @dSN = dSN + @password = password + @schema = schema + @username = username + end +end + + +class TestMapping < Test::Unit::TestCase + def test_mapping + dump = <<__XML__.chomp + + + + + dsn + password + schema + username + + + +__XML__ + o = TTMHeader.new("dsn", "password", "schema", "username") + assert_equal(dump, SOAP::Marshal.dump(o)) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/fault/test_customfault.rb b/vendor/gems/soap4r-1.5.8/test/soap/fault/test_customfault.rb new file mode 100644 index 00000000..1714f107 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/fault/test_customfault.rb @@ -0,0 +1,60 @@ +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 if @server + if @t + @t.kill + @t.join + end + @client.reset_stream if @client + 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/vendor/gems/soap4r-1.5.8/test/soap/fault/test_soaparray.rb b/vendor/gems/soap4r-1.5.8/test/soap/fault/test_soaparray.rb new file mode 100644 index 00000000..449e4ada --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/fault/test_soaparray.rb @@ -0,0 +1,35 @@ +require 'soap/rpc/router' +require 'soap/mapping/mapping' +require 'soap/processor' +require 'test/unit' + + +module SOAP +module Fault + + +class TestSOAPArray < Test::Unit::TestCase + + # simulate the soap fault creation and parsing on the client + def test_parse_fault + router = SOAP::RPC::Router.new('parse_SOAPArray_error') + soap_fault = pump_stack rescue router.create_fault_response($!) + env = SOAP::Processor.unmarshal(soap_fault.send_string) + soap_fault = SOAP::FaultError.new(env.body.fault) + # in literal service, RuntimeError is raised (not an ArgumentError) + # any chance to use Ruby's exception encoding in literal service? + assert_raises(RuntimeError) do + registry = SOAP::Mapping::LiteralRegistry.new + SOAP::Mapping.fault2exception(soap_fault, registry) + end + end + + def pump_stack(max = 0) + raise ArgumentError if max > 10 + pump_stack(max+1) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/filter/test_filter.rb b/vendor/gems/soap4r-1.5.8/test/soap/filter/test_filter.rb new file mode 100644 index 00000000..5bafbb0f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/filter/test_filter.rb @@ -0,0 +1,146 @@ +require 'test/unit' +require 'soap/rpc/driver' +require 'soap/rpc/standaloneServer' +require 'soap/filter' + + +module SOAP +module Filter + + +class TestFilter < Test::Unit::TestCase + Port = 17171 + PortName = 'http://tempuri.org/filterPort' + + class FilterTestServer < SOAP::RPC::StandaloneServer + class Servant + def self.create + new + end + + def echo(amt) + amt + end + end + + class ServerFilter1 < SOAP::Filter::Handler + # 15 -> 30 + def on_outbound(envelope, opt) + unless envelope.body.is_fault + node = envelope.body.root_node + node.retval = SOAPInt.new(node.retval.data * 2) + node.elename = XSD::QName.new(nil, 'return') + end + envelope + end + + # 4 -> 5 + def on_inbound(xml, opt) + xml = xml.sub(/4/, '5') + xml + end + end + + class ServerFilter2 < SOAP::Filter::Handler + # 5 -> 15 + def on_outbound(envelope, opt) + unless envelope.body.is_fault + node = envelope.body.root_node + node.retval = SOAPInt.new(node.retval.data + 10) + node.elename = XSD::QName.new(nil, 'return') + end + envelope + end + + # 5 -> 6 + def on_inbound(xml, opt) + xml = xml.sub(/5/, '6') + xml + end + end + + def initialize(*arg) + super + add_rpc_servant(Servant.new, PortName) + self.filterchain << ServerFilter1.new + self.filterchain << ServerFilter2.new + end + end + + def setup + @endpoint = "http://localhost:#{Port}/" + setup_server + setup_client + end + + def setup_server + @server = FilterTestServer.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('echo', 'amt') + end + + def teardown + teardown_server if @server + teardown_client if @client + end + + def teardown_server + @server.shutdown + @t.kill + @t.join + end + + def teardown_client + @client.reset_stream + end + + class ClientFilter1 < SOAP::Filter::Handler + # 1 -> 2 + def on_outbound(envelope, opt) + param = envelope.body.root_node.inparam + param["amt"] = SOAPInt.new(param["amt"].data + 1) + param["amt"].elename = XSD::QName.new(nil, 'amt') + envelope + end + + # 31 -> 32 + def on_inbound(xml, opt) + xml = xml.sub(/31/, '32') + xml + end + end + + class ClientFilter2 < SOAP::Filter::Handler + # 2 -> 4 + def on_outbound(envelope, opt) + param = envelope.body.root_node.inparam + param["amt"] = SOAPInt.new(param["amt"].data * 2) + param["amt"].elename = XSD::QName.new(nil, 'amt') + envelope + end + + # 30 -> 31 + def on_inbound(xml, opt) + xml = xml.sub(/30/, '31') + xml + end + end + + def test_call + @client.filterchain << ClientFilter1.new + @client.filterchain << ClientFilter2.new + assert_equal(32, @client.echo(1)) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/header/server.cgi b/vendor/gems/soap4r-1.5.8/test/soap/header/server.cgi new file mode 100644 index 00000000..e996805e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/header/server.cgi @@ -0,0 +1,119 @@ +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/vendor/gems/soap4r-1.5.8/test/soap/header/test_authheader.rb b/vendor/gems/soap4r-1.5.8/test/soap/header/test_authheader.rb new file mode 100644 index 00000000..9c4b7c4d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/header/test_authheader.rb @@ -0,0 +1,240 @@ +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 if @server + teardown_client if @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/vendor/gems/soap4r-1.5.8/test/soap/header/test_authheader_cgi.rb b/vendor/gems/soap4r-1.5.8/test/soap/header/test_authheader_cgi.rb new file mode 100644 index 00000000..bfd91fa1 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/header/test_authheader_cgi.rb @@ -0,0 +1,121 @@ +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( + Config::CONFIG["bindir"], + Config::CONFIG["ruby_install_name"] + Config::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 if @supportclient + teardown_server if @server + teardown_client if @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/vendor/gems/soap4r-1.5.8/test/soap/header/test_simplehandler.rb b/vendor/gems/soap4r-1.5.8/test/soap/header/test_simplehandler.rb new file mode 100644 index 00000000..05880fd2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/header/test_simplehandler.rb @@ -0,0 +1,116 @@ +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 if @server + teardown_client if @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/vendor/gems/soap4r-1.5.8/test/soap/helloworld/hw_s.rb b/vendor/gems/soap4r-1.5.8/test/soap/helloworld/hw_s.rb new file mode 100644 index 00000000..1a54adb9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/helloworld/hw_s.rb @@ -0,0 +1,16 @@ +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/vendor/gems/soap4r-1.5.8/test/soap/helloworld/test_helloworld.rb b/vendor/gems/soap4r-1.5.8/test/soap/helloworld/test_helloworld.rb new file mode 100644 index 00000000..9927bc60 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/helloworld/test_helloworld.rb @@ -0,0 +1,43 @@ +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.wiredump_dev = STDERR if $DEBUG + @client.add_method("hello_world", "from") + end + + def teardown + @server.shutdown if @server + if @t + @t.kill + @t.join + end + @client.reset_stream if @client + 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/vendor/gems/soap4r-1.5.8/test/soap/htpasswd b/vendor/gems/soap4r-1.5.8/test/soap/htpasswd new file mode 100644 index 00000000..70df50c9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/htpasswd @@ -0,0 +1,2 @@ +admin:Qg266hq/YYKe2 +guest:gbPc4vPCH.h12 diff --git a/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/amazonEc.rb b/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/amazonEc.rb new file mode 100644 index 00000000..8f1055ea --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/amazonEc.rb @@ -0,0 +1,4778 @@ +require 'xsd/qname' + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Bin +class Bin + @@schema_type = "Bin" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["binName", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BinName")]], + ["binItemCount", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BinItemCount")]], + ["binParameter", ["[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BinParameter")]] + ] + + attr_accessor :binName + attr_accessor :binItemCount + attr_accessor :binParameter + + def initialize(binName = nil, binItemCount = nil, binParameter = []) + @binName = binName + @binItemCount = binItemCount + @binParameter = binParameter + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SearchBinSet +class SearchBinSet + @@schema_type = "SearchBinSet" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_attribute = { + XSD::QName.new(nil, "NarrowBy") => "SOAP::SOAPString" + } + @@schema_element = [ + ["bin", ["Bin[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Bin")]] + ] + + attr_accessor :bin + + def xmlattr_NarrowBy + (@__xmlattr ||= {})[XSD::QName.new(nil, "NarrowBy")] + end + + def xmlattr_NarrowBy=(value) + (@__xmlattr ||= {})[XSD::QName.new(nil, "NarrowBy")] = value + end + + def initialize(bin = []) + @bin = bin + @__xmlattr = {} + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SearchBinSets +class SearchBinSets < ::Array + @@schema_element = [ + ["SearchBinSet", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SearchBinSet")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Help +class Help + @@schema_type = "Help" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["shared", ["HelpRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["HelpRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ItemSearch +class ItemSearch + @@schema_type = "ItemSearch" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["shared", ["ItemSearchRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["ItemSearchRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :xMLEscaping + attr_accessor :validate + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, xMLEscaping = nil, validate = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @xMLEscaping = xMLEscaping + @validate = validate + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ItemLookup +class ItemLookup + @@schema_type = "ItemLookup" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["ItemLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["ItemLookupRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ListSearch +class ListSearch + @@schema_type = "ListSearch" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["ListSearchRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["ListSearchRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ListLookup +class ListLookup + @@schema_type = "ListLookup" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["ListLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["ListLookupRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CustomerContentSearch +class CustomerContentSearch + @@schema_type = "CustomerContentSearch" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["CustomerContentSearchRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["CustomerContentSearchRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CustomerContentLookup +class CustomerContentLookup + @@schema_type = "CustomerContentLookup" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["CustomerContentLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["CustomerContentLookupRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SimilarityLookup +class SimilarityLookup + @@schema_type = "SimilarityLookup" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["SimilarityLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["SimilarityLookupRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerLookup +class SellerLookup + @@schema_type = "SellerLookup" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["SellerLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["SellerLookupRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartGet +class CartGet + @@schema_type = "CartGet" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["CartGetRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["CartGetRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartAdd +class CartAdd + @@schema_type = "CartAdd" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["CartAddRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["CartAddRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartCreate +class CartCreate + @@schema_type = "CartCreate" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["CartCreateRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["CartCreateRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartModify +class CartModify + @@schema_type = "CartModify" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["CartModifyRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["CartModifyRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartClear +class CartClear + @@schema_type = "CartClear" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["CartClearRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["CartClearRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}TransactionLookup +class TransactionLookup + @@schema_type = "TransactionLookup" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["TransactionLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["TransactionLookupRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerListingSearch +class SellerListingSearch + @@schema_type = "SellerListingSearch" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["SellerListingSearchRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["SellerListingSearchRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerListingLookup +class SellerListingLookup + @@schema_type = "SellerListingLookup" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["SellerListingLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["SellerListingLookupRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}BrowseNodeLookup +class BrowseNodeLookup + @@schema_type = "BrowseNodeLookup" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["marketplaceDomain", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MarketplaceDomain")]], + ["aWSAccessKeyId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AWSAccessKeyId")]], + ["subscriptionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionId")]], + ["associateTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AssociateTag")]], + ["validate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Validate")]], + ["xMLEscaping", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "XMLEscaping")]], + ["shared", ["BrowseNodeLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shared")]], + ["request", ["BrowseNodeLookupRequest[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]] + ] + + attr_accessor :marketplaceDomain + attr_accessor :aWSAccessKeyId + attr_accessor :subscriptionId + attr_accessor :associateTag + attr_accessor :validate + attr_accessor :xMLEscaping + attr_accessor :shared + attr_accessor :request + + def initialize(marketplaceDomain = nil, aWSAccessKeyId = nil, subscriptionId = nil, associateTag = nil, validate = nil, xMLEscaping = nil, shared = nil, request = []) + @marketplaceDomain = marketplaceDomain + @aWSAccessKeyId = aWSAccessKeyId + @subscriptionId = subscriptionId + @associateTag = associateTag + @validate = validate + @xMLEscaping = xMLEscaping + @shared = shared + @request = request + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Condition +class Condition < ::String + @@schema_type = "Condition" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + + All = Condition.new("All") + Collectible = Condition.new("Collectible") + New = Condition.new("New") + Refurbished = Condition.new("Refurbished") + Used = Condition.new("Used") +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}DeliveryMethod +class DeliveryMethod < ::String + @@schema_type = "DeliveryMethod" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + + ISPU = DeliveryMethod.new("ISPU") + Ship = DeliveryMethod.new("Ship") +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}AudienceRating +class AudienceRating < ::String + @@schema_type = "AudienceRating" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + + C_12 = AudienceRating.new("12") + C_16 = AudienceRating.new("16") + C_18 = AudienceRating.new("18") + C_6 = AudienceRating.new("6") + FamilyViewing = AudienceRating.new("FamilyViewing") + G = AudienceRating.new("G") + NC17 = AudienceRating.new("NC-17") + NR = AudienceRating.new("NR") + PG = AudienceRating.new("PG") + PG13 = AudienceRating.new("PG-13") + R = AudienceRating.new("R") + Unrated = AudienceRating.new("Unrated") +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}MultiOperation +class MultiOperation + @@schema_type = "MultiOperation" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["help", ["Help", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Help")]], + ["itemSearch", ["ItemSearch", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemSearch")]], + ["itemLookup", ["ItemLookup", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemLookup")]], + ["listSearch", ["ListSearch", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListSearch")]], + ["listLookup", ["ListLookup", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListLookup")]], + ["customerContentSearch", ["CustomerContentSearch", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerContentSearch")]], + ["customerContentLookup", ["CustomerContentLookup", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerContentLookup")]], + ["similarityLookup", ["SimilarityLookup", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarityLookup")]], + ["sellerLookup", ["SellerLookup", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerLookup")]], + ["cartGet", ["CartGet", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartGet")]], + ["cartAdd", ["CartAdd", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartAdd")]], + ["cartCreate", ["CartCreate", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartCreate")]], + ["cartModify", ["CartModify", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartModify")]], + ["cartClear", ["CartClear", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartClear")]], + ["transactionLookup", ["TransactionLookup", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionLookup")]], + ["sellerListingSearch", ["SellerListingSearch", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListingSearch")]], + ["sellerListingLookup", ["SellerListingLookup", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListingLookup")]], + ["browseNodeLookup", ["BrowseNodeLookup", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNodeLookup")]] + ] + + attr_accessor :help + attr_accessor :itemSearch + attr_accessor :itemLookup + attr_accessor :listSearch + attr_accessor :listLookup + attr_accessor :customerContentSearch + attr_accessor :customerContentLookup + attr_accessor :similarityLookup + attr_accessor :sellerLookup + attr_accessor :cartGet + attr_accessor :cartAdd + attr_accessor :cartCreate + attr_accessor :cartModify + attr_accessor :cartClear + attr_accessor :transactionLookup + attr_accessor :sellerListingSearch + attr_accessor :sellerListingLookup + attr_accessor :browseNodeLookup + + def initialize(help = nil, itemSearch = nil, itemLookup = nil, listSearch = nil, listLookup = nil, customerContentSearch = nil, customerContentLookup = nil, similarityLookup = nil, sellerLookup = nil, cartGet = nil, cartAdd = nil, cartCreate = nil, cartModify = nil, cartClear = nil, transactionLookup = nil, sellerListingSearch = nil, sellerListingLookup = nil, browseNodeLookup = nil) + @help = help + @itemSearch = itemSearch + @itemLookup = itemLookup + @listSearch = listSearch + @listLookup = listLookup + @customerContentSearch = customerContentSearch + @customerContentLookup = customerContentLookup + @similarityLookup = similarityLookup + @sellerLookup = sellerLookup + @cartGet = cartGet + @cartAdd = cartAdd + @cartCreate = cartCreate + @cartModify = cartModify + @cartClear = cartClear + @transactionLookup = transactionLookup + @sellerListingSearch = sellerListingSearch + @sellerListingLookup = sellerListingLookup + @browseNodeLookup = browseNodeLookup + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}HelpResponse +class HelpResponse + @@schema_type = "HelpResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["information", ["Information[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Information")]] + ] + + attr_accessor :operationRequest + attr_accessor :information + + def initialize(operationRequest = nil, information = []) + @operationRequest = operationRequest + @information = information + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ItemSearchResponse +class ItemSearchResponse + @@schema_type = "ItemSearchResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["items", ["Items[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Items")]] + ] + + attr_accessor :operationRequest + attr_accessor :items + + def initialize(operationRequest = nil, items = []) + @operationRequest = operationRequest + @items = items + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ItemLookupResponse +class ItemLookupResponse + @@schema_type = "ItemLookupResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["items", ["Items[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Items")]] + ] + + attr_accessor :operationRequest + attr_accessor :items + + def initialize(operationRequest = nil, items = []) + @operationRequest = operationRequest + @items = items + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ListSearchResponse +class ListSearchResponse + @@schema_type = "ListSearchResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["lists", ["Lists[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Lists")]] + ] + + attr_accessor :operationRequest + attr_accessor :lists + + def initialize(operationRequest = nil, lists = []) + @operationRequest = operationRequest + @lists = lists + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ListLookupResponse +class ListLookupResponse + @@schema_type = "ListLookupResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["lists", ["Lists[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Lists")]] + ] + + attr_accessor :operationRequest + attr_accessor :lists + + def initialize(operationRequest = nil, lists = []) + @operationRequest = operationRequest + @lists = lists + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CustomerContentSearchResponse +class CustomerContentSearchResponse + @@schema_type = "CustomerContentSearchResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["customers", ["Customers[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Customers")]] + ] + + attr_accessor :operationRequest + attr_accessor :customers + + def initialize(operationRequest = nil, customers = []) + @operationRequest = operationRequest + @customers = customers + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CustomerContentLookupResponse +class CustomerContentLookupResponse + @@schema_type = "CustomerContentLookupResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["customers", ["Customers[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Customers")]] + ] + + attr_accessor :operationRequest + attr_accessor :customers + + def initialize(operationRequest = nil, customers = []) + @operationRequest = operationRequest + @customers = customers + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SimilarityLookupResponse +class SimilarityLookupResponse + @@schema_type = "SimilarityLookupResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["items", ["Items[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Items")]] + ] + + attr_accessor :operationRequest + attr_accessor :items + + def initialize(operationRequest = nil, items = []) + @operationRequest = operationRequest + @items = items + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerLookupResponse +class SellerLookupResponse + @@schema_type = "SellerLookupResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["sellers", ["Sellers[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Sellers")]] + ] + + attr_accessor :operationRequest + attr_accessor :sellers + + def initialize(operationRequest = nil, sellers = []) + @operationRequest = operationRequest + @sellers = sellers + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartGetResponse +class CartGetResponse + @@schema_type = "CartGetResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["cart", ["Cart[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Cart")]] + ] + + attr_accessor :operationRequest + attr_accessor :cart + + def initialize(operationRequest = nil, cart = []) + @operationRequest = operationRequest + @cart = cart + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartAddResponse +class CartAddResponse + @@schema_type = "CartAddResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["cart", ["Cart[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Cart")]] + ] + + attr_accessor :operationRequest + attr_accessor :cart + + def initialize(operationRequest = nil, cart = []) + @operationRequest = operationRequest + @cart = cart + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartCreateResponse +class CartCreateResponse + @@schema_type = "CartCreateResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["cart", ["Cart[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Cart")]] + ] + + attr_accessor :operationRequest + attr_accessor :cart + + def initialize(operationRequest = nil, cart = []) + @operationRequest = operationRequest + @cart = cart + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartModifyResponse +class CartModifyResponse + @@schema_type = "CartModifyResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["cart", ["Cart[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Cart")]] + ] + + attr_accessor :operationRequest + attr_accessor :cart + + def initialize(operationRequest = nil, cart = []) + @operationRequest = operationRequest + @cart = cart + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartClearResponse +class CartClearResponse + @@schema_type = "CartClearResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["cart", ["Cart[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Cart")]] + ] + + attr_accessor :operationRequest + attr_accessor :cart + + def initialize(operationRequest = nil, cart = []) + @operationRequest = operationRequest + @cart = cart + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}TransactionLookupResponse +class TransactionLookupResponse + @@schema_type = "TransactionLookupResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["transactions", ["Transactions[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Transactions")]] + ] + + attr_accessor :operationRequest + attr_accessor :transactions + + def initialize(operationRequest = nil, transactions = []) + @operationRequest = operationRequest + @transactions = transactions + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerListingSearchResponse +class SellerListingSearchResponse + @@schema_type = "SellerListingSearchResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["sellerListings", ["SellerListings[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListings")]] + ] + + attr_accessor :operationRequest + attr_accessor :sellerListings + + def initialize(operationRequest = nil, sellerListings = []) + @operationRequest = operationRequest + @sellerListings = sellerListings + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerListingLookupResponse +class SellerListingLookupResponse + @@schema_type = "SellerListingLookupResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["sellerListings", ["SellerListings[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListings")]] + ] + + attr_accessor :operationRequest + attr_accessor :sellerListings + + def initialize(operationRequest = nil, sellerListings = []) + @operationRequest = operationRequest + @sellerListings = sellerListings + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}BrowseNodeLookupResponse +class BrowseNodeLookupResponse + @@schema_type = "BrowseNodeLookupResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["browseNodes", ["BrowseNodes[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNodes")]] + ] + + attr_accessor :operationRequest + attr_accessor :browseNodes + + def initialize(operationRequest = nil, browseNodes = []) + @operationRequest = operationRequest + @browseNodes = browseNodes + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}MultiOperationResponse +class MultiOperationResponse + @@schema_type = "MultiOperationResponse" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["operationRequest", ["OperationRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationRequest")]], + ["helpResponse", ["HelpResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HelpResponse")]], + ["itemSearchResponse", ["ItemSearchResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemSearchResponse")]], + ["itemLookupResponse", ["ItemLookupResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemLookupResponse")]], + ["listSearchResponse", ["ListSearchResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListSearchResponse")]], + ["listLookupResponse", ["ListLookupResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListLookupResponse")]], + ["customerContentSearchResponse", ["CustomerContentSearchResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerContentSearchResponse")]], + ["customerContentLookupResponse", ["CustomerContentLookupResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerContentLookupResponse")]], + ["similarityLookupResponse", ["SimilarityLookupResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarityLookupResponse")]], + ["sellerLookupResponse", ["SellerLookupResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerLookupResponse")]], + ["cartGetResponse", ["CartGetResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartGetResponse")]], + ["cartAddResponse", ["CartAddResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartAddResponse")]], + ["cartCreateResponse", ["CartCreateResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartCreateResponse")]], + ["cartModifyResponse", ["CartModifyResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartModifyResponse")]], + ["cartClearResponse", ["CartClearResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartClearResponse")]], + ["transactionLookupResponse", ["TransactionLookupResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionLookupResponse")]], + ["sellerListingSearchResponse", ["SellerListingSearchResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListingSearchResponse")]], + ["sellerListingLookupResponse", ["SellerListingLookupResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListingLookupResponse")]], + ["browseNodeLookupResponse", ["BrowseNodeLookupResponse", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNodeLookupResponse")]] + ] + + attr_accessor :operationRequest + attr_accessor :helpResponse + attr_accessor :itemSearchResponse + attr_accessor :itemLookupResponse + attr_accessor :listSearchResponse + attr_accessor :listLookupResponse + attr_accessor :customerContentSearchResponse + attr_accessor :customerContentLookupResponse + attr_accessor :similarityLookupResponse + attr_accessor :sellerLookupResponse + attr_accessor :cartGetResponse + attr_accessor :cartAddResponse + attr_accessor :cartCreateResponse + attr_accessor :cartModifyResponse + attr_accessor :cartClearResponse + attr_accessor :transactionLookupResponse + attr_accessor :sellerListingSearchResponse + attr_accessor :sellerListingLookupResponse + attr_accessor :browseNodeLookupResponse + + def initialize(operationRequest = nil, helpResponse = nil, itemSearchResponse = nil, itemLookupResponse = nil, listSearchResponse = nil, listLookupResponse = nil, customerContentSearchResponse = nil, customerContentLookupResponse = nil, similarityLookupResponse = nil, sellerLookupResponse = nil, cartGetResponse = nil, cartAddResponse = nil, cartCreateResponse = nil, cartModifyResponse = nil, cartClearResponse = nil, transactionLookupResponse = nil, sellerListingSearchResponse = nil, sellerListingLookupResponse = nil, browseNodeLookupResponse = nil) + @operationRequest = operationRequest + @helpResponse = helpResponse + @itemSearchResponse = itemSearchResponse + @itemLookupResponse = itemLookupResponse + @listSearchResponse = listSearchResponse + @listLookupResponse = listLookupResponse + @customerContentSearchResponse = customerContentSearchResponse + @customerContentLookupResponse = customerContentLookupResponse + @similarityLookupResponse = similarityLookupResponse + @sellerLookupResponse = sellerLookupResponse + @cartGetResponse = cartGetResponse + @cartAddResponse = cartAddResponse + @cartCreateResponse = cartCreateResponse + @cartModifyResponse = cartModifyResponse + @cartClearResponse = cartClearResponse + @transactionLookupResponse = transactionLookupResponse + @sellerListingSearchResponse = sellerListingSearchResponse + @sellerListingLookupResponse = sellerListingLookupResponse + @browseNodeLookupResponse = browseNodeLookupResponse + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}OperationRequest +class OperationRequest + @@schema_type = "OperationRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["hTTPHeaders", ["HTTPHeaders", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HTTPHeaders")]], + ["requestId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RequestId")]], + ["arguments", ["Arguments", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Arguments")]], + ["errors", ["Errors", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Errors")]], + ["requestProcessingTime", ["SOAP::SOAPFloat", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RequestProcessingTime")]] + ] + + attr_accessor :hTTPHeaders + attr_accessor :requestId + attr_accessor :arguments + attr_accessor :errors + attr_accessor :requestProcessingTime + + def initialize(hTTPHeaders = nil, requestId = nil, arguments = nil, errors = nil, requestProcessingTime = nil) + @hTTPHeaders = hTTPHeaders + @requestId = requestId + @arguments = arguments + @errors = errors + @requestProcessingTime = requestProcessingTime + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Request +class Request + @@schema_type = "Request" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["isValid", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsValid")]], + ["helpRequest", ["HelpRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HelpRequest")]], + ["browseNodeLookupRequest", ["BrowseNodeLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNodeLookupRequest")]], + ["itemSearchRequest", ["ItemSearchRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemSearchRequest")]], + ["itemLookupRequest", ["ItemLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemLookupRequest")]], + ["listSearchRequest", ["ListSearchRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListSearchRequest")]], + ["listLookupRequest", ["ListLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListLookupRequest")]], + ["customerContentSearchRequest", ["CustomerContentSearchRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerContentSearchRequest")]], + ["customerContentLookupRequest", ["CustomerContentLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerContentLookupRequest")]], + ["similarityLookupRequest", ["SimilarityLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarityLookupRequest")]], + ["cartGetRequest", ["CartGetRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartGetRequest")]], + ["cartAddRequest", ["CartAddRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartAddRequest")]], + ["cartCreateRequest", ["CartCreateRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartCreateRequest")]], + ["cartModifyRequest", ["CartModifyRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartModifyRequest")]], + ["cartClearRequest", ["CartClearRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartClearRequest")]], + ["transactionLookupRequest", ["TransactionLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionLookupRequest")]], + ["sellerListingSearchRequest", ["SellerListingSearchRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListingSearchRequest")]], + ["sellerListingLookupRequest", ["SellerListingLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListingLookupRequest")]], + ["sellerLookupRequest", ["SellerLookupRequest", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerLookupRequest")]], + ["errors", ["Errors", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Errors")]] + ] + + attr_accessor :isValid + attr_accessor :helpRequest + attr_accessor :browseNodeLookupRequest + attr_accessor :itemSearchRequest + attr_accessor :itemLookupRequest + attr_accessor :listSearchRequest + attr_accessor :listLookupRequest + attr_accessor :customerContentSearchRequest + attr_accessor :customerContentLookupRequest + attr_accessor :similarityLookupRequest + attr_accessor :cartGetRequest + attr_accessor :cartAddRequest + attr_accessor :cartCreateRequest + attr_accessor :cartModifyRequest + attr_accessor :cartClearRequest + attr_accessor :transactionLookupRequest + attr_accessor :sellerListingSearchRequest + attr_accessor :sellerListingLookupRequest + attr_accessor :sellerLookupRequest + attr_accessor :errors + + def initialize(isValid = nil, helpRequest = nil, browseNodeLookupRequest = nil, itemSearchRequest = nil, itemLookupRequest = nil, listSearchRequest = nil, listLookupRequest = nil, customerContentSearchRequest = nil, customerContentLookupRequest = nil, similarityLookupRequest = nil, cartGetRequest = nil, cartAddRequest = nil, cartCreateRequest = nil, cartModifyRequest = nil, cartClearRequest = nil, transactionLookupRequest = nil, sellerListingSearchRequest = nil, sellerListingLookupRequest = nil, sellerLookupRequest = nil, errors = nil) + @isValid = isValid + @helpRequest = helpRequest + @browseNodeLookupRequest = browseNodeLookupRequest + @itemSearchRequest = itemSearchRequest + @itemLookupRequest = itemLookupRequest + @listSearchRequest = listSearchRequest + @listLookupRequest = listLookupRequest + @customerContentSearchRequest = customerContentSearchRequest + @customerContentLookupRequest = customerContentLookupRequest + @similarityLookupRequest = similarityLookupRequest + @cartGetRequest = cartGetRequest + @cartAddRequest = cartAddRequest + @cartCreateRequest = cartCreateRequest + @cartModifyRequest = cartModifyRequest + @cartClearRequest = cartClearRequest + @transactionLookupRequest = transactionLookupRequest + @sellerListingSearchRequest = sellerListingSearchRequest + @sellerListingLookupRequest = sellerListingLookupRequest + @sellerLookupRequest = sellerLookupRequest + @errors = errors + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Arguments +class Arguments < ::Array + @@schema_element = [ + ["Argument", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Argument")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}HTTPHeaders +class HTTPHeaders < ::Array + @@schema_element = [ + ["Header", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Header")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Errors +class Errors < ::Array + @@schema_element = [ + ["Error", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Error")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Information +class Information + @@schema_type = "Information" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["request", ["Request", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]], + ["operationInformation", ["OperationInformation[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OperationInformation")]], + ["responseGroupInformation", ["ResponseGroupInformation[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroupInformation")]] + ] + + attr_accessor :request + attr_accessor :operationInformation + attr_accessor :responseGroupInformation + + def initialize(request = nil, operationInformation = [], responseGroupInformation = []) + @request = request + @operationInformation = operationInformation + @responseGroupInformation = responseGroupInformation + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Items +class Items + @@schema_type = "Items" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["request", ["Request", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]], + ["correctedQuery", ["CorrectedQuery", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CorrectedQuery")]], + ["totalResults", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalResults")]], + ["totalPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPages")]], + ["searchResultsMap", ["SearchResultsMap", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SearchResultsMap")]], + ["item", ["Item[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Item")]], + ["searchBinSets", ["SearchBinSets", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SearchBinSets")]] + ] + + attr_accessor :request + attr_accessor :correctedQuery + attr_accessor :totalResults + attr_accessor :totalPages + attr_accessor :searchResultsMap + attr_accessor :item + attr_accessor :searchBinSets + + def initialize(request = nil, correctedQuery = nil, totalResults = nil, totalPages = nil, searchResultsMap = nil, item = [], searchBinSets = nil) + @request = request + @correctedQuery = correctedQuery + @totalResults = totalResults + @totalPages = totalPages + @searchResultsMap = searchResultsMap + @item = item + @searchBinSets = searchBinSets + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CorrectedQuery +class CorrectedQuery + @@schema_type = "CorrectedQuery" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["keywords", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Keywords")]], + ["message", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Message")]] + ] + + attr_accessor :keywords + attr_accessor :message + + def initialize(keywords = nil, message = nil) + @keywords = keywords + @message = message + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Lists +class Lists + @@schema_type = "Lists" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["request", ["Request", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]], + ["totalResults", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalResults")]], + ["totalPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPages")]], + ["list", ["List[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "List")]] + ] + + attr_accessor :request + attr_accessor :totalResults + attr_accessor :totalPages + attr_accessor :list + + def initialize(request = nil, totalResults = nil, totalPages = nil, list = []) + @request = request + @totalResults = totalResults + @totalPages = totalPages + @list = list + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Customers +class Customers + @@schema_type = "Customers" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["request", ["Request", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]], + ["totalResults", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalResults")]], + ["totalPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPages")]], + ["customer", ["Customer[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Customer")]] + ] + + attr_accessor :request + attr_accessor :totalResults + attr_accessor :totalPages + attr_accessor :customer + + def initialize(request = nil, totalResults = nil, totalPages = nil, customer = []) + @request = request + @totalResults = totalResults + @totalPages = totalPages + @customer = customer + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Cart +class Cart + @@schema_type = "Cart" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["request", ["Request", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]], + ["cartId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartId")]], + ["hMAC", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HMAC")]], + ["uRLEncodedHMAC", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "URLEncodedHMAC")]], + ["purchaseURL", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PurchaseURL")]], + ["subTotal", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubTotal")]], + ["cartItems", ["CartItems", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartItems")]], + ["savedForLaterItems", ["SavedForLaterItems", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SavedForLaterItems")]], + ["similarProducts", ["SimilarProducts", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarProducts")]], + ["topSellers", ["TopSellers", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TopSellers")]], + ["newReleases", ["NewReleases", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NewReleases")]], + ["similarViewedProducts", ["SimilarViewedProducts", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarViewedProducts")]], + ["otherCategoriesSimilarProducts", ["OtherCategoriesSimilarProducts", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OtherCategoriesSimilarProducts")]] + ] + + attr_accessor :request + attr_accessor :cartId + attr_accessor :hMAC + attr_accessor :uRLEncodedHMAC + attr_accessor :purchaseURL + attr_accessor :subTotal + attr_accessor :cartItems + attr_accessor :savedForLaterItems + attr_accessor :similarProducts + attr_accessor :topSellers + attr_accessor :newReleases + attr_accessor :similarViewedProducts + attr_accessor :otherCategoriesSimilarProducts + + def initialize(request = nil, cartId = nil, hMAC = nil, uRLEncodedHMAC = nil, purchaseURL = nil, subTotal = nil, cartItems = nil, savedForLaterItems = nil, similarProducts = nil, topSellers = nil, newReleases = nil, similarViewedProducts = nil, otherCategoriesSimilarProducts = nil) + @request = request + @cartId = cartId + @hMAC = hMAC + @uRLEncodedHMAC = uRLEncodedHMAC + @purchaseURL = purchaseURL + @subTotal = subTotal + @cartItems = cartItems + @savedForLaterItems = savedForLaterItems + @similarProducts = similarProducts + @topSellers = topSellers + @newReleases = newReleases + @similarViewedProducts = similarViewedProducts + @otherCategoriesSimilarProducts = otherCategoriesSimilarProducts + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Transactions +class Transactions + @@schema_type = "Transactions" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["request", ["Request", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]], + ["totalResults", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalResults")]], + ["totalPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPages")]], + ["transaction", ["Transaction[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Transaction")]] + ] + + attr_accessor :request + attr_accessor :totalResults + attr_accessor :totalPages + attr_accessor :transaction + + def initialize(request = nil, totalResults = nil, totalPages = nil, transaction = []) + @request = request + @totalResults = totalResults + @totalPages = totalPages + @transaction = transaction + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Sellers +class Sellers + @@schema_type = "Sellers" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["request", ["Request", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]], + ["totalResults", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalResults")]], + ["totalPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPages")]], + ["seller", ["Seller[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Seller")]] + ] + + attr_accessor :request + attr_accessor :totalResults + attr_accessor :totalPages + attr_accessor :seller + + def initialize(request = nil, totalResults = nil, totalPages = nil, seller = []) + @request = request + @totalResults = totalResults + @totalPages = totalPages + @seller = seller + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerListings +class SellerListings + @@schema_type = "SellerListings" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["request", ["Request", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]], + ["totalResults", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalResults")]], + ["totalPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPages")]], + ["sellerListing", ["SellerListing[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListing")]] + ] + + attr_accessor :request + attr_accessor :totalResults + attr_accessor :totalPages + attr_accessor :sellerListing + + def initialize(request = nil, totalResults = nil, totalPages = nil, sellerListing = []) + @request = request + @totalResults = totalResults + @totalPages = totalPages + @sellerListing = sellerListing + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}OperationInformation +class OperationInformation + @@schema_type = "OperationInformation" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["name", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Name")]], + ["description", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Description")]], + ["requiredParameters", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RequiredParameters")]], + ["availableParameters", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AvailableParameters")]], + ["defaultResponseGroups", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DefaultResponseGroups")]], + ["availableResponseGroups", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AvailableResponseGroups")]] + ] + + attr_accessor :name + attr_accessor :description + attr_accessor :requiredParameters + attr_accessor :availableParameters + attr_accessor :defaultResponseGroups + attr_accessor :availableResponseGroups + + def initialize(name = nil, description = nil, requiredParameters = nil, availableParameters = nil, defaultResponseGroups = nil, availableResponseGroups = nil) + @name = name + @description = description + @requiredParameters = requiredParameters + @availableParameters = availableParameters + @defaultResponseGroups = defaultResponseGroups + @availableResponseGroups = availableResponseGroups + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ResponseGroupInformation +class ResponseGroupInformation + @@schema_type = "ResponseGroupInformation" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["name", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Name")]], + ["creationDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CreationDate")]], + ["validOperations", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ValidOperations")]], + ["elements", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Elements")]] + ] + + attr_accessor :name + attr_accessor :creationDate + attr_accessor :validOperations + attr_accessor :elements + + def initialize(name = nil, creationDate = nil, validOperations = nil, elements = nil) + @name = name + @creationDate = creationDate + @validOperations = validOperations + @elements = elements + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}List +class List + @@schema_type = "List" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["listId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListId")]], + ["listURL", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListURL")]], + ["registryNumber", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RegistryNumber")]], + ["listName", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListName")]], + ["listType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListType")]], + ["totalItems", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalItems")]], + ["totalPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPages")]], + ["dateCreated", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DateCreated")]], + ["occasionDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OccasionDate")]], + ["customerName", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerName")]], + ["partnerName", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PartnerName")]], + ["additionalName", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AdditionalName")]], + ["comment", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Comment")]], + ["image", ["Image", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Image")]], + ["averageRating", ["SOAP::SOAPDecimal", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AverageRating")]], + ["totalVotes", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalVotes")]], + ["totalTimesRead", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalTimesRead")]], + ["listItem", ["ListItem[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListItem")]] + ] + + attr_accessor :listId + attr_accessor :listURL + attr_accessor :registryNumber + attr_accessor :listName + attr_accessor :listType + attr_accessor :totalItems + attr_accessor :totalPages + attr_accessor :dateCreated + attr_accessor :occasionDate + attr_accessor :customerName + attr_accessor :partnerName + attr_accessor :additionalName + attr_accessor :comment + attr_accessor :image + attr_accessor :averageRating + attr_accessor :totalVotes + attr_accessor :totalTimesRead + attr_accessor :listItem + + def initialize(listId = nil, listURL = nil, registryNumber = nil, listName = nil, listType = nil, totalItems = nil, totalPages = nil, dateCreated = nil, occasionDate = nil, customerName = nil, partnerName = nil, additionalName = nil, comment = nil, image = nil, averageRating = nil, totalVotes = nil, totalTimesRead = nil, listItem = []) + @listId = listId + @listURL = listURL + @registryNumber = registryNumber + @listName = listName + @listType = listType + @totalItems = totalItems + @totalPages = totalPages + @dateCreated = dateCreated + @occasionDate = occasionDate + @customerName = customerName + @partnerName = partnerName + @additionalName = additionalName + @comment = comment + @image = image + @averageRating = averageRating + @totalVotes = totalVotes + @totalTimesRead = totalTimesRead + @listItem = listItem + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ListItem +class ListItem + @@schema_type = "ListItem" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["listItemId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListItemId")]], + ["dateAdded", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DateAdded")]], + ["comment", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Comment")]], + ["quantityDesired", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "QuantityDesired")]], + ["quantityReceived", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "QuantityReceived")]], + ["item", ["Item", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Item")]] + ] + + attr_accessor :listItemId + attr_accessor :dateAdded + attr_accessor :comment + attr_accessor :quantityDesired + attr_accessor :quantityReceived + attr_accessor :item + + def initialize(listItemId = nil, dateAdded = nil, comment = nil, quantityDesired = nil, quantityReceived = nil, item = nil) + @listItemId = listItemId + @dateAdded = dateAdded + @comment = comment + @quantityDesired = quantityDesired + @quantityReceived = quantityReceived + @item = item + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Customer +class Customer + @@schema_type = "Customer" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["customerId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerId")]], + ["nickname", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Nickname")]], + ["birthday", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Birthday")]], + ["wishListId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WishListId")]], + ["location", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Location")]], + ["customerReviews", ["CustomerReviews[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerReviews")]] + ] + + attr_accessor :customerId + attr_accessor :nickname + attr_accessor :birthday + attr_accessor :wishListId + attr_accessor :location + attr_accessor :customerReviews + + def initialize(customerId = nil, nickname = nil, birthday = nil, wishListId = nil, location = nil, customerReviews = []) + @customerId = customerId + @nickname = nickname + @birthday = birthday + @wishListId = wishListId + @location = location + @customerReviews = customerReviews + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SearchResultsMap +class SearchResultsMap < ::Array + @@schema_element = [ + ["SearchIndex", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SearchIndex")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Item +class Item + @@schema_type = "Item" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["aSIN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ASIN")]], + ["errors", ["Errors", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Errors")]], + ["detailPageURL", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DetailPageURL")]], + ["salesRank", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SalesRank")]], + ["smallImage", ["Image", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SmallImage")]], + ["mediumImage", ["Image", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MediumImage")]], + ["largeImage", ["Image", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LargeImage")]], + ["imageSets", ["[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ImageSets")]], + ["itemAttributes", ["ItemAttributes", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemAttributes")]], + ["merchantItemAttributes", ["MerchantItemAttributes", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MerchantItemAttributes")]], + ["subjects", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Subjects")]], + ["offerSummary", ["OfferSummary", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OfferSummary")]], + ["offers", ["Offers", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Offers")]], + ["variationSummary", ["VariationSummary", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "VariationSummary")]], + ["variations", ["Variations", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Variations")]], + ["customerReviews", ["CustomerReviews", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerReviews")]], + ["editorialReviews", ["EditorialReviews", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "EditorialReviews")]], + ["similarProducts", ["SimilarProducts", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarProducts")]], + ["accessories", ["Accessories", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Accessories")]], + ["tracks", ["Tracks", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Tracks")]], + ["browseNodes", ["BrowseNodes", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNodes")]], + ["listmaniaLists", ["ListmaniaLists", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListmaniaLists")]], + ["searchInside", ["SearchInside", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SearchInside")]] + ] + + attr_accessor :aSIN + attr_accessor :errors + attr_accessor :detailPageURL + attr_accessor :salesRank + attr_accessor :smallImage + attr_accessor :mediumImage + attr_accessor :largeImage + attr_accessor :imageSets + attr_accessor :itemAttributes + attr_accessor :merchantItemAttributes + attr_accessor :subjects + attr_accessor :offerSummary + attr_accessor :offers + attr_accessor :variationSummary + attr_accessor :variations + attr_accessor :customerReviews + attr_accessor :editorialReviews + attr_accessor :similarProducts + attr_accessor :accessories + attr_accessor :tracks + attr_accessor :browseNodes + attr_accessor :listmaniaLists + attr_accessor :searchInside + + def initialize(aSIN = nil, errors = nil, detailPageURL = nil, salesRank = nil, smallImage = nil, mediumImage = nil, largeImage = nil, imageSets = [], itemAttributes = nil, merchantItemAttributes = nil, subjects = nil, offerSummary = nil, offers = nil, variationSummary = nil, variations = nil, customerReviews = nil, editorialReviews = nil, similarProducts = nil, accessories = nil, tracks = nil, browseNodes = nil, listmaniaLists = nil, searchInside = nil) + @aSIN = aSIN + @errors = errors + @detailPageURL = detailPageURL + @salesRank = salesRank + @smallImage = smallImage + @mediumImage = mediumImage + @largeImage = largeImage + @imageSets = imageSets + @itemAttributes = itemAttributes + @merchantItemAttributes = merchantItemAttributes + @subjects = subjects + @offerSummary = offerSummary + @offers = offers + @variationSummary = variationSummary + @variations = variations + @customerReviews = customerReviews + @editorialReviews = editorialReviews + @similarProducts = similarProducts + @accessories = accessories + @tracks = tracks + @browseNodes = browseNodes + @listmaniaLists = listmaniaLists + @searchInside = searchInside + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}OfferSummary +class OfferSummary + @@schema_type = "OfferSummary" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["lowestNewPrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LowestNewPrice")]], + ["lowestUsedPrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LowestUsedPrice")]], + ["lowestCollectiblePrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LowestCollectiblePrice")]], + ["lowestRefurbishedPrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LowestRefurbishedPrice")]], + ["totalNew", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalNew")]], + ["totalUsed", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalUsed")]], + ["totalCollectible", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalCollectible")]], + ["totalRefurbished", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalRefurbished")]] + ] + + attr_accessor :lowestNewPrice + attr_accessor :lowestUsedPrice + attr_accessor :lowestCollectiblePrice + attr_accessor :lowestRefurbishedPrice + attr_accessor :totalNew + attr_accessor :totalUsed + attr_accessor :totalCollectible + attr_accessor :totalRefurbished + + def initialize(lowestNewPrice = nil, lowestUsedPrice = nil, lowestCollectiblePrice = nil, lowestRefurbishedPrice = nil, totalNew = nil, totalUsed = nil, totalCollectible = nil, totalRefurbished = nil) + @lowestNewPrice = lowestNewPrice + @lowestUsedPrice = lowestUsedPrice + @lowestCollectiblePrice = lowestCollectiblePrice + @lowestRefurbishedPrice = lowestRefurbishedPrice + @totalNew = totalNew + @totalUsed = totalUsed + @totalCollectible = totalCollectible + @totalRefurbished = totalRefurbished + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Offers +class Offers + @@schema_type = "Offers" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["totalOffers", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalOffers")]], + ["totalOfferPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalOfferPages")]], + ["offer", ["Offer[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Offer")]] + ] + + attr_accessor :totalOffers + attr_accessor :totalOfferPages + attr_accessor :offer + + def initialize(totalOffers = nil, totalOfferPages = nil, offer = []) + @totalOffers = totalOffers + @totalOfferPages = totalOfferPages + @offer = offer + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Offer +class Offer + @@schema_type = "Offer" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["merchant", ["Merchant", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Merchant")]], + ["seller", ["Seller", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Seller")]], + ["offerAttributes", ["OfferAttributes", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OfferAttributes")]], + ["offerListing", ["OfferListing[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OfferListing")]] + ] + + attr_accessor :merchant + attr_accessor :seller + attr_accessor :offerAttributes + attr_accessor :offerListing + + def initialize(merchant = nil, seller = nil, offerAttributes = nil, offerListing = []) + @merchant = merchant + @seller = seller + @offerAttributes = offerAttributes + @offerListing = offerListing + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}OfferAttributes +class OfferAttributes + @@schema_type = "OfferAttributes" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["condition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Condition")]], + ["subCondition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubCondition")]], + ["conditionNote", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ConditionNote")]], + ["willShipExpedited", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WillShipExpedited")]], + ["willShipInternational", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WillShipInternational")]] + ] + + attr_accessor :condition + attr_accessor :subCondition + attr_accessor :conditionNote + attr_accessor :willShipExpedited + attr_accessor :willShipInternational + + def initialize(condition = nil, subCondition = nil, conditionNote = nil, willShipExpedited = nil, willShipInternational = nil) + @condition = condition + @subCondition = subCondition + @conditionNote = conditionNote + @willShipExpedited = willShipExpedited + @willShipInternational = willShipInternational + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Merchant +class Merchant + @@schema_type = "Merchant" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["merchantId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MerchantId")]], + ["name", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Name")]], + ["glancePage", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GlancePage")]], + ["averageFeedbackRating", ["SOAP::SOAPDecimal", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AverageFeedbackRating")]], + ["totalFeedback", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalFeedback")]], + ["totalFeedbackPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalFeedbackPages")]] + ] + + attr_accessor :merchantId + attr_accessor :name + attr_accessor :glancePage + attr_accessor :averageFeedbackRating + attr_accessor :totalFeedback + attr_accessor :totalFeedbackPages + + def initialize(merchantId = nil, name = nil, glancePage = nil, averageFeedbackRating = nil, totalFeedback = nil, totalFeedbackPages = nil) + @merchantId = merchantId + @name = name + @glancePage = glancePage + @averageFeedbackRating = averageFeedbackRating + @totalFeedback = totalFeedback + @totalFeedbackPages = totalFeedbackPages + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}OfferListing +class OfferListing + @@schema_type = "OfferListing" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["offerListingId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OfferListingId")]], + ["exchangeId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ExchangeId")]], + ["price", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Price")]], + ["salePrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SalePrice")]], + ["availability", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Availability")]], + ["iSPUStoreAddress", ["Address", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ISPUStoreAddress")]], + ["iSPUStoreHours", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ISPUStoreHours")]], + ["isEligibleForSuperSaverShipping", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsEligibleForSuperSaverShipping")]] + ] + + attr_accessor :offerListingId + attr_accessor :exchangeId + attr_accessor :price + attr_accessor :salePrice + attr_accessor :availability + attr_accessor :iSPUStoreAddress + attr_accessor :iSPUStoreHours + attr_accessor :isEligibleForSuperSaverShipping + + def initialize(offerListingId = nil, exchangeId = nil, price = nil, salePrice = nil, availability = nil, iSPUStoreAddress = nil, iSPUStoreHours = nil, isEligibleForSuperSaverShipping = nil) + @offerListingId = offerListingId + @exchangeId = exchangeId + @price = price + @salePrice = salePrice + @availability = availability + @iSPUStoreAddress = iSPUStoreAddress + @iSPUStoreHours = iSPUStoreHours + @isEligibleForSuperSaverShipping = isEligibleForSuperSaverShipping + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}VariationSummary +class VariationSummary + @@schema_type = "VariationSummary" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["lowestPrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LowestPrice")]], + ["highestPrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HighestPrice")]], + ["lowestSalePrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LowestSalePrice")]], + ["highestSalePrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HighestSalePrice")]], + ["singleMerchantId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SingleMerchantId")]] + ] + + attr_accessor :lowestPrice + attr_accessor :highestPrice + attr_accessor :lowestSalePrice + attr_accessor :highestSalePrice + attr_accessor :singleMerchantId + + def initialize(lowestPrice = nil, highestPrice = nil, lowestSalePrice = nil, highestSalePrice = nil, singleMerchantId = nil) + @lowestPrice = lowestPrice + @highestPrice = highestPrice + @lowestSalePrice = lowestSalePrice + @highestSalePrice = highestSalePrice + @singleMerchantId = singleMerchantId + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Variations +class Variations + @@schema_type = "Variations" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["totalVariations", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalVariations")]], + ["totalVariationPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalVariationPages")]], + ["variationDimensions", ["VariationDimensions", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "VariationDimensions")]], + ["item", ["Item[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Item")]] + ] + + attr_accessor :totalVariations + attr_accessor :totalVariationPages + attr_accessor :variationDimensions + attr_accessor :item + + def initialize(totalVariations = nil, totalVariationPages = nil, variationDimensions = nil, item = []) + @totalVariations = totalVariations + @totalVariationPages = totalVariationPages + @variationDimensions = variationDimensions + @item = item + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}VariationDimensions +class VariationDimensions < ::Array + @@schema_element = [ + ["VariationDimension", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "VariationDimension")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}EditorialReviews +class EditorialReviews < ::Array + @@schema_element = [ + ["EditorialReview", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "EditorialReview")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}EditorialReview +class EditorialReview + @@schema_type = "EditorialReview" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["source", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Source")]], + ["content", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Content")]] + ] + + attr_accessor :source + attr_accessor :content + + def initialize(source = nil, content = nil) + @source = source + @content = content + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CustomerReviews +class CustomerReviews + @@schema_type = "CustomerReviews" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["averageRating", ["SOAP::SOAPDecimal", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AverageRating")]], + ["totalReviews", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalReviews")]], + ["totalReviewPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalReviewPages")]], + ["review", ["Review[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Review")]] + ] + + attr_accessor :averageRating + attr_accessor :totalReviews + attr_accessor :totalReviewPages + attr_accessor :review + + def initialize(averageRating = nil, totalReviews = nil, totalReviewPages = nil, review = []) + @averageRating = averageRating + @totalReviews = totalReviews + @totalReviewPages = totalReviewPages + @review = review + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Review +class Review + @@schema_type = "Review" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["aSIN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ASIN")]], + ["rating", ["SOAP::SOAPDecimal", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Rating")]], + ["helpfulVotes", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HelpfulVotes")]], + ["customerId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerId")]], + ["totalVotes", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalVotes")]], + ["date", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Date")]], + ["summary", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Summary")]], + ["content", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Content")]] + ] + + attr_accessor :aSIN + attr_accessor :rating + attr_accessor :helpfulVotes + attr_accessor :customerId + attr_accessor :totalVotes + attr_accessor :date + attr_accessor :summary + attr_accessor :content + + def initialize(aSIN = nil, rating = nil, helpfulVotes = nil, customerId = nil, totalVotes = nil, date = nil, summary = nil, content = nil) + @aSIN = aSIN + @rating = rating + @helpfulVotes = helpfulVotes + @customerId = customerId + @totalVotes = totalVotes + @date = date + @summary = summary + @content = content + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Tracks +class Tracks < ::Array + @@schema_element = [ + ["Disc", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Disc")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SimilarProducts +class SimilarProducts < ::Array + @@schema_element = [ + ["SimilarProduct", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarProduct")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}TopSellers +class TopSellers < ::Array + @@schema_element = [ + ["TopSeller", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TopSeller")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}NewReleases +class NewReleases < ::Array + @@schema_element = [ + ["NewRelease", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NewRelease")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SimilarViewedProducts +class SimilarViewedProducts < ::Array + @@schema_element = [ + ["SimilarViewedProduct", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarViewedProduct")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}OtherCategoriesSimilarProducts +class OtherCategoriesSimilarProducts < ::Array + @@schema_element = [ + ["OtherCategoriesSimilarProduct", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OtherCategoriesSimilarProduct")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Accessories +class Accessories < ::Array + @@schema_element = [ + ["Accessory", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Accessory")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}BrowseNodes +class BrowseNodes + @@schema_type = "BrowseNodes" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["request", ["Request", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Request")]], + ["browseNode", ["BrowseNode[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNode")]] + ] + + attr_accessor :request + attr_accessor :browseNode + + def initialize(request = nil, browseNode = []) + @request = request + @browseNode = browseNode + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}BrowseNode +class BrowseNode + @@schema_type = "BrowseNode" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["browseNodeId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNodeId")]], + ["name", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Name")]], + ["children", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Children")]], + ["ancestors", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Ancestors")]], + ["topSellers", ["TopSellers", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TopSellers")]], + ["newReleases", ["NewReleases", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NewReleases")]] + ] + + attr_accessor :browseNodeId + attr_accessor :name + attr_accessor :children + attr_accessor :ancestors + attr_accessor :topSellers + attr_accessor :newReleases + + def initialize(browseNodeId = nil, name = nil, children = nil, ancestors = nil, topSellers = nil, newReleases = nil) + @browseNodeId = browseNodeId + @name = name + @children = children + @ancestors = ancestors + @topSellers = topSellers + @newReleases = newReleases + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ListmaniaLists +class ListmaniaLists < ::Array + @@schema_element = [ + ["ListmaniaList", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListmaniaList")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SearchInside +class SearchInside + @@schema_type = "SearchInside" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["totalExcerpts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalExcerpts")]], + ["excerpt", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Excerpt")]] + ] + + attr_accessor :totalExcerpts + attr_accessor :excerpt + + def initialize(totalExcerpts = nil, excerpt = nil) + @totalExcerpts = totalExcerpts + @excerpt = excerpt + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartItems +class CartItems + @@schema_type = "CartItems" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["subTotal", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubTotal")]], + ["cartItem", ["CartItem[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartItem")]] + ] + + attr_accessor :subTotal + attr_accessor :cartItem + + def initialize(subTotal = nil, cartItem = []) + @subTotal = subTotal + @cartItem = cartItem + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SavedForLaterItems +class SavedForLaterItems + @@schema_type = "SavedForLaterItems" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["subTotal", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubTotal")]], + ["savedForLaterItem", ["CartItem[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SavedForLaterItem")]] + ] + + attr_accessor :subTotal + attr_accessor :savedForLaterItem + + def initialize(subTotal = nil, savedForLaterItem = []) + @subTotal = subTotal + @savedForLaterItem = savedForLaterItem + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Transaction +class Transaction + @@schema_type = "Transaction" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["transactionId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionId")]], + ["sellerId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerId")]], + ["condition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Condition")]], + ["transactionDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionDate")]], + ["transactionDateEpoch", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionDateEpoch")]], + ["sellerName", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerName")]], + ["payingCustomerId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PayingCustomerId")]], + ["orderingCustomerId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OrderingCustomerId")]], + ["totals", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Totals")]], + ["transactionItems", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionItems")]], + ["shipments", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Shipments")]] + ] + + attr_accessor :transactionId + attr_accessor :sellerId + attr_accessor :condition + attr_accessor :transactionDate + attr_accessor :transactionDateEpoch + attr_accessor :sellerName + attr_accessor :payingCustomerId + attr_accessor :orderingCustomerId + attr_accessor :totals + attr_accessor :transactionItems + attr_accessor :shipments + + def initialize(transactionId = nil, sellerId = nil, condition = nil, transactionDate = nil, transactionDateEpoch = nil, sellerName = nil, payingCustomerId = nil, orderingCustomerId = nil, totals = nil, transactionItems = nil, shipments = nil) + @transactionId = transactionId + @sellerId = sellerId + @condition = condition + @transactionDate = transactionDate + @transactionDateEpoch = transactionDateEpoch + @sellerName = sellerName + @payingCustomerId = payingCustomerId + @orderingCustomerId = orderingCustomerId + @totals = totals + @transactionItems = transactionItems + @shipments = shipments + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}TransactionItem +class TransactionItem + @@schema_type = "TransactionItem" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["transactionItemId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionItemId")]], + ["quantity", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Quantity")]], + ["unitPrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "UnitPrice")]], + ["totalPrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPrice")]], + ["aSIN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ASIN")]], + ["childTransactionItems", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ChildTransactionItems")]] + ] + + attr_accessor :transactionItemId + attr_accessor :quantity + attr_accessor :unitPrice + attr_accessor :totalPrice + attr_accessor :aSIN + attr_accessor :childTransactionItems + + def initialize(transactionItemId = nil, quantity = nil, unitPrice = nil, totalPrice = nil, aSIN = nil, childTransactionItems = nil) + @transactionItemId = transactionItemId + @quantity = quantity + @unitPrice = unitPrice + @totalPrice = totalPrice + @aSIN = aSIN + @childTransactionItems = childTransactionItems + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Seller +class Seller + @@schema_type = "Seller" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["sellerId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerId")]], + ["sellerName", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerName")]], + ["sellerLegalName", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerLegalName")]], + ["nickname", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Nickname")]], + ["glancePage", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GlancePage")]], + ["about", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "About")]], + ["moreAbout", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MoreAbout")]], + ["location", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Location")]], + ["averageFeedbackRating", ["SOAP::SOAPDecimal", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AverageFeedbackRating")]], + ["totalFeedback", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalFeedback")]], + ["totalFeedbackPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalFeedbackPages")]], + ["sellerFeedbackSummary", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerFeedbackSummary")]], + ["sellerFeedback", ["SellerFeedback", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerFeedback")]] + ] + + attr_accessor :sellerId + attr_accessor :sellerName + attr_accessor :sellerLegalName + attr_accessor :nickname + attr_accessor :glancePage + attr_accessor :about + attr_accessor :moreAbout + attr_accessor :location + attr_accessor :averageFeedbackRating + attr_accessor :totalFeedback + attr_accessor :totalFeedbackPages + attr_accessor :sellerFeedbackSummary + attr_accessor :sellerFeedback + + def initialize(sellerId = nil, sellerName = nil, sellerLegalName = nil, nickname = nil, glancePage = nil, about = nil, moreAbout = nil, location = nil, averageFeedbackRating = nil, totalFeedback = nil, totalFeedbackPages = nil, sellerFeedbackSummary = nil, sellerFeedback = nil) + @sellerId = sellerId + @sellerName = sellerName + @sellerLegalName = sellerLegalName + @nickname = nickname + @glancePage = glancePage + @about = about + @moreAbout = moreAbout + @location = location + @averageFeedbackRating = averageFeedbackRating + @totalFeedback = totalFeedback + @totalFeedbackPages = totalFeedbackPages + @sellerFeedbackSummary = sellerFeedbackSummary + @sellerFeedback = sellerFeedback + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerFeedback +class SellerFeedback < ::Array + @@schema_element = [ + ["Feedback", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Feedback")]] + ] +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerListing +class SellerListing + @@schema_type = "SellerListing" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["exchangeId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ExchangeId")]], + ["listingId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListingId")]], + ["aSIN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ASIN")]], + ["sKU", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SKU")]], + ["uPC", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "UPC")]], + ["eAN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "EAN")]], + ["willShipExpedited", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WillShipExpedited")]], + ["willShipInternational", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WillShipInternational")]], + ["title", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Title")]], + ["price", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Price")]], + ["startDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StartDate")]], + ["endDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "EndDate")]], + ["status", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Status")]], + ["quantity", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Quantity")]], + ["condition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Condition")]], + ["subCondition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubCondition")]], + ["seller", ["Seller", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Seller")]] + ] + + attr_accessor :exchangeId + attr_accessor :listingId + attr_accessor :aSIN + attr_accessor :sKU + attr_accessor :uPC + attr_accessor :eAN + attr_accessor :willShipExpedited + attr_accessor :willShipInternational + attr_accessor :title + attr_accessor :price + attr_accessor :startDate + attr_accessor :endDate + attr_accessor :status + attr_accessor :quantity + attr_accessor :condition + attr_accessor :subCondition + attr_accessor :seller + + def initialize(exchangeId = nil, listingId = nil, aSIN = nil, sKU = nil, uPC = nil, eAN = nil, willShipExpedited = nil, willShipInternational = nil, title = nil, price = nil, startDate = nil, endDate = nil, status = nil, quantity = nil, condition = nil, subCondition = nil, seller = nil) + @exchangeId = exchangeId + @listingId = listingId + @aSIN = aSIN + @sKU = sKU + @uPC = uPC + @eAN = eAN + @willShipExpedited = willShipExpedited + @willShipInternational = willShipInternational + @title = title + @price = price + @startDate = startDate + @endDate = endDate + @status = status + @quantity = quantity + @condition = condition + @subCondition = subCondition + @seller = seller + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ImageSet +class ImageSet + @@schema_type = "ImageSet" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_attribute = { + XSD::QName.new(nil, "Category") => "SOAP::SOAPString" + } + @@schema_element = [ + ["swatchImage", ["Image", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SwatchImage")]], + ["smallImage", ["Image", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SmallImage")]], + ["mediumImage", ["Image", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MediumImage")]], + ["largeImage", ["Image", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LargeImage")]] + ] + + attr_accessor :swatchImage + attr_accessor :smallImage + attr_accessor :mediumImage + attr_accessor :largeImage + + def xmlattr_Category + (@__xmlattr ||= {})[XSD::QName.new(nil, "Category")] + end + + def xmlattr_Category=(value) + (@__xmlattr ||= {})[XSD::QName.new(nil, "Category")] = value + end + + def initialize(swatchImage = nil, smallImage = nil, mediumImage = nil, largeImage = nil) + @swatchImage = swatchImage + @smallImage = smallImage + @mediumImage = mediumImage + @largeImage = largeImage + @__xmlattr = {} + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ItemAttributes +class ItemAttributes + @@schema_type = "ItemAttributes" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["actor", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Actor")]], + ["address", ["Address", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Address")]], + ["amazonMaximumAge", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AmazonMaximumAge")]], + ["amazonMinimumAge", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AmazonMinimumAge")]], + ["apertureModes", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ApertureModes")]], + ["artist", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Artist")]], + ["aspectRatio", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AspectRatio")]], + ["audienceRating", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AudienceRating")]], + ["audioFormat", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AudioFormat")]], + ["author", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Author")]], + ["backFinding", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BackFinding")]], + ["bandMaterialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BandMaterialType")]], + ["batteriesIncluded", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BatteriesIncluded")]], + ["batteries", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Batteries")]], + ["batteryDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BatteryDescription")]], + ["batteryType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BatteryType")]], + ["bezelMaterialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BezelMaterialType")]], + ["binding", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Binding")]], + ["brand", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Brand")]], + ["calendarType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CalendarType")]], + ["cameraManualFeatures", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CameraManualFeatures")]], + ["caseDiameter", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CaseDiameter")]], + ["caseMaterialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CaseMaterialType")]], + ["caseThickness", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CaseThickness")]], + ["caseType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CaseType")]], + ["cDRWDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CDRWDescription")]], + ["chainType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ChainType")]], + ["claspType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ClaspType")]], + ["clothingSize", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ClothingSize")]], + ["color", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Color")]], + ["compatibility", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Compatibility")]], + ["computerHardwareType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ComputerHardwareType")]], + ["computerPlatform", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ComputerPlatform")]], + ["connectivity", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Connectivity")]], + ["continuousShootingSpeed", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ContinuousShootingSpeed")]], + ["country", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Country")]], + ["cPUManufacturer", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CPUManufacturer")]], + ["cPUSpeed", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CPUSpeed")]], + ["cPUType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CPUType")]], + ["creator", ["[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Creator")]], + ["cuisine", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Cuisine")]], + ["delayBetweenShots", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DelayBetweenShots")]], + ["department", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Department")]], + ["deweyDecimalNumber", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DeweyDecimalNumber")]], + ["dialColor", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DialColor")]], + ["dialWindowMaterialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DialWindowMaterialType")]], + ["digitalZoom", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DigitalZoom")]], + ["director", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Director")]], + ["displaySize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DisplaySize")]], + ["drumSetPieceQuantity", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DrumSetPieceQuantity")]], + ["dVDLayers", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DVDLayers")]], + ["dVDRWDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DVDRWDescription")]], + ["dVDSides", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DVDSides")]], + ["eAN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "EAN")]], + ["edition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Edition")]], + ["eSRBAgeRating", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ESRBAgeRating")]], + ["externalDisplaySupportDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ExternalDisplaySupportDescription")]], + ["fabricType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FabricType")]], + ["faxNumber", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FaxNumber")]], + ["feature", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Feature")]], + ["firstIssueLeadTime", ["StringWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FirstIssueLeadTime")]], + ["floppyDiskDriveDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FloppyDiskDriveDescription")]], + ["format", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Format")]], + ["gemType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GemType")]], + ["graphicsCardInterface", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GraphicsCardInterface")]], + ["graphicsDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GraphicsDescription")]], + ["graphicsMemorySize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GraphicsMemorySize")]], + ["guitarAttribute", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GuitarAttribute")]], + ["guitarBridgeSystem", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GuitarBridgeSystem")]], + ["guitarPickThickness", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GuitarPickThickness")]], + ["guitarPickupConfiguration", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GuitarPickupConfiguration")]], + ["hardDiskCount", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HardDiskCount")]], + ["hardDiskSize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HardDiskSize")]], + ["hasAutoFocus", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasAutoFocus")]], + ["hasBurstMode", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasBurstMode")]], + ["hasInCameraEditing", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasInCameraEditing")]], + ["hasRedEyeReduction", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasRedEyeReduction")]], + ["hasSelfTimer", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasSelfTimer")]], + ["hasTripodMount", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasTripodMount")]], + ["hasVideoOut", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasVideoOut")]], + ["hasViewfinder", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasViewfinder")]], + ["hazardousMaterialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HazardousMaterialType")]], + ["hoursOfOperation", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HoursOfOperation")]], + ["includedSoftware", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IncludedSoftware")]], + ["includesMp3Player", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IncludesMp3Player")]], + ["ingredients", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Ingredients")]], + ["instrumentKey", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "InstrumentKey")]], + ["isAdultProduct", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsAdultProduct")]], + ["isAutographed", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsAutographed")]], + ["iSBN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ISBN")]], + ["isFragile", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsFragile")]], + ["isLabCreated", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsLabCreated")]], + ["isMemorabilia", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsMemorabilia")]], + ["iSOEquivalent", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ISOEquivalent")]], + ["issuesPerYear", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IssuesPerYear")]], + ["itemDimensions", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemDimensions")]], + ["keyboardDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "KeyboardDescription")]], + ["label", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Label")]], + ["languages", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Languages")]], + ["legalDisclaimer", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LegalDisclaimer")]], + ["lineVoltage", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LineVoltage")]], + ["listPrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListPrice")]], + ["macroFocusRange", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MacroFocusRange")]], + ["magazineType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MagazineType")]], + ["malletHardness", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MalletHardness")]], + ["manufacturer", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Manufacturer")]], + ["manufacturerLaborWarrantyDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ManufacturerLaborWarrantyDescription")]], + ["manufacturerMaximumAge", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ManufacturerMaximumAge")]], + ["manufacturerMinimumAge", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ManufacturerMinimumAge")]], + ["manufacturerPartsWarrantyDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ManufacturerPartsWarrantyDescription")]], + ["materialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaterialType")]], + ["maximumAperture", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumAperture")]], + ["maximumColorDepth", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumColorDepth")]], + ["maximumFocalLength", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumFocalLength")]], + ["maximumHighResolutionImages", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumHighResolutionImages")]], + ["maximumHorizontalResolution", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumHorizontalResolution")]], + ["maximumLowResolutionImages", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumLowResolutionImages")]], + ["maximumResolution", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumResolution")]], + ["maximumShutterSpeed", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumShutterSpeed")]], + ["maximumVerticalResolution", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumVerticalResolution")]], + ["maximumWeightRecommendation", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumWeightRecommendation")]], + ["memorySlotsAvailable", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MemorySlotsAvailable")]], + ["metalStamp", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MetalStamp")]], + ["metalType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MetalType")]], + ["miniMovieDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MiniMovieDescription")]], + ["minimumFocalLength", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MinimumFocalLength")]], + ["minimumShutterSpeed", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MinimumShutterSpeed")]], + ["model", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Model")]], + ["modelYear", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ModelYear")]], + ["modemDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ModemDescription")]], + ["monitorSize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MonitorSize")]], + ["monitorViewableDiagonalSize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MonitorViewableDiagonalSize")]], + ["mouseDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MouseDescription")]], + ["mPN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MPN")]], + ["musicalStyle", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MusicalStyle")]], + ["nativeResolution", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NativeResolution")]], + ["neighborhood", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Neighborhood")]], + ["networkInterfaceDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NetworkInterfaceDescription")]], + ["notebookDisplayTechnology", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NotebookDisplayTechnology")]], + ["notebookPointingDeviceDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NotebookPointingDeviceDescription")]], + ["numberOfDiscs", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfDiscs")]], + ["numberOfIssues", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfIssues")]], + ["numberOfItems", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfItems")]], + ["numberOfKeys", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfKeys")]], + ["numberOfPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfPages")]], + ["numberOfPearls", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfPearls")]], + ["numberOfRapidFireShots", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfRapidFireShots")]], + ["numberOfStones", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfStones")]], + ["numberOfStrings", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfStrings")]], + ["numberOfTracks", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfTracks")]], + ["opticalZoom", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OpticalZoom")]], + ["outputWattage", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OutputWattage")]], + ["packageDimensions", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PackageDimensions")]], + ["pearlLustre", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlLustre")]], + ["pearlMinimumColor", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlMinimumColor")]], + ["pearlShape", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlShape")]], + ["pearlStringingMethod", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlStringingMethod")]], + ["pearlSurfaceBlemishes", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlSurfaceBlemishes")]], + ["pearlType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlType")]], + ["pearlUniformity", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlUniformity")]], + ["phoneNumber", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PhoneNumber")]], + ["photoFlashType", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PhotoFlashType")]], + ["pictureFormat", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PictureFormat")]], + ["platform", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Platform")]], + ["priceRating", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PriceRating")]], + ["processorCount", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ProcessorCount")]], + ["productGroup", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ProductGroup")]], + ["promotionalTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PromotionalTag")]], + ["publicationDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PublicationDate")]], + ["publisher", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Publisher")]], + ["readingLevel", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ReadingLevel")]], + ["recorderTrackCount", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RecorderTrackCount")]], + ["regionCode", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RegionCode")]], + ["regionOfOrigin", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RegionOfOrigin")]], + ["releaseDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ReleaseDate")]], + ["removableMemory", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RemovableMemory")]], + ["resolutionModes", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResolutionModes")]], + ["ringSize", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RingSize")]], + ["runningTime", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RunningTime")]], + ["secondaryCacheSize", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SecondaryCacheSize")]], + ["settingType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SettingType")]], + ["size", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Size")]], + ["sizePerPearl", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SizePerPearl")]], + ["skillLevel", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SkillLevel")]], + ["sKU", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SKU")]], + ["soundCardDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SoundCardDescription")]], + ["speakerCount", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SpeakerCount")]], + ["speakerDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SpeakerDescription")]], + ["specialFeatures", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SpecialFeatures")]], + ["stoneClarity", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StoneClarity")]], + ["stoneColor", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StoneColor")]], + ["stoneCut", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StoneCut")]], + ["stoneShape", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StoneShape")]], + ["stoneWeight", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StoneWeight")]], + ["studio", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Studio")]], + ["subscriptionLength", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionLength")]], + ["supportedImageType", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SupportedImageType")]], + ["systemBusSpeed", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SystemBusSpeed")]], + ["systemMemorySizeMax", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SystemMemorySizeMax")]], + ["systemMemorySize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SystemMemorySize")]], + ["systemMemoryType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SystemMemoryType")]], + ["theatricalReleaseDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TheatricalReleaseDate")]], + ["title", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Title")]], + ["totalDiamondWeight", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalDiamondWeight")]], + ["totalExternalBaysFree", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalExternalBaysFree")]], + ["totalFirewirePorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalFirewirePorts")]], + ["totalGemWeight", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalGemWeight")]], + ["totalInternalBaysFree", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalInternalBaysFree")]], + ["totalMetalWeight", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalMetalWeight")]], + ["totalNTSCPALPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalNTSCPALPorts")]], + ["totalParallelPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalParallelPorts")]], + ["totalPCCardSlots", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPCCardSlots")]], + ["totalPCISlotsFree", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPCISlotsFree")]], + ["totalSerialPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalSerialPorts")]], + ["totalSVideoOutPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalSVideoOutPorts")]], + ["totalUSB2Ports", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalUSB2Ports")]], + ["totalUSBPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalUSBPorts")]], + ["totalVGAOutPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalVGAOutPorts")]], + ["uPC", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "UPC")]], + ["variationDenomination", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "VariationDenomination")]], + ["variationDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "VariationDescription")]], + ["warranty", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Warranty")]], + ["watchMovementType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WatchMovementType")]], + ["waterResistanceDepth", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WaterResistanceDepth")]], + ["wirelessMicrophoneFrequency", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WirelessMicrophoneFrequency")]] + ] + + attr_accessor :actor + attr_accessor :address + attr_accessor :amazonMaximumAge + attr_accessor :amazonMinimumAge + attr_accessor :apertureModes + attr_accessor :artist + attr_accessor :aspectRatio + attr_accessor :audienceRating + attr_accessor :audioFormat + attr_accessor :author + attr_accessor :backFinding + attr_accessor :bandMaterialType + attr_accessor :batteriesIncluded + attr_accessor :batteries + attr_accessor :batteryDescription + attr_accessor :batteryType + attr_accessor :bezelMaterialType + attr_accessor :binding + attr_accessor :brand + attr_accessor :calendarType + attr_accessor :cameraManualFeatures + attr_accessor :caseDiameter + attr_accessor :caseMaterialType + attr_accessor :caseThickness + attr_accessor :caseType + attr_accessor :cDRWDescription + attr_accessor :chainType + attr_accessor :claspType + attr_accessor :clothingSize + attr_accessor :color + attr_accessor :compatibility + attr_accessor :computerHardwareType + attr_accessor :computerPlatform + attr_accessor :connectivity + attr_accessor :continuousShootingSpeed + attr_accessor :country + attr_accessor :cPUManufacturer + attr_accessor :cPUSpeed + attr_accessor :cPUType + attr_accessor :creator + attr_accessor :cuisine + attr_accessor :delayBetweenShots + attr_accessor :department + attr_accessor :deweyDecimalNumber + attr_accessor :dialColor + attr_accessor :dialWindowMaterialType + attr_accessor :digitalZoom + attr_accessor :director + attr_accessor :displaySize + attr_accessor :drumSetPieceQuantity + attr_accessor :dVDLayers + attr_accessor :dVDRWDescription + attr_accessor :dVDSides + attr_accessor :eAN + attr_accessor :edition + attr_accessor :eSRBAgeRating + attr_accessor :externalDisplaySupportDescription + attr_accessor :fabricType + attr_accessor :faxNumber + attr_accessor :feature + attr_accessor :firstIssueLeadTime + attr_accessor :floppyDiskDriveDescription + attr_accessor :format + attr_accessor :gemType + attr_accessor :graphicsCardInterface + attr_accessor :graphicsDescription + attr_accessor :graphicsMemorySize + attr_accessor :guitarAttribute + attr_accessor :guitarBridgeSystem + attr_accessor :guitarPickThickness + attr_accessor :guitarPickupConfiguration + attr_accessor :hardDiskCount + attr_accessor :hardDiskSize + attr_accessor :hasAutoFocus + attr_accessor :hasBurstMode + attr_accessor :hasInCameraEditing + attr_accessor :hasRedEyeReduction + attr_accessor :hasSelfTimer + attr_accessor :hasTripodMount + attr_accessor :hasVideoOut + attr_accessor :hasViewfinder + attr_accessor :hazardousMaterialType + attr_accessor :hoursOfOperation + attr_accessor :includedSoftware + attr_accessor :includesMp3Player + attr_accessor :ingredients + attr_accessor :instrumentKey + attr_accessor :isAdultProduct + attr_accessor :isAutographed + attr_accessor :iSBN + attr_accessor :isFragile + attr_accessor :isLabCreated + attr_accessor :isMemorabilia + attr_accessor :iSOEquivalent + attr_accessor :issuesPerYear + attr_accessor :itemDimensions + attr_accessor :keyboardDescription + attr_accessor :label + attr_accessor :languages + attr_accessor :legalDisclaimer + attr_accessor :lineVoltage + attr_accessor :listPrice + attr_accessor :macroFocusRange + attr_accessor :magazineType + attr_accessor :malletHardness + attr_accessor :manufacturer + attr_accessor :manufacturerLaborWarrantyDescription + attr_accessor :manufacturerMaximumAge + attr_accessor :manufacturerMinimumAge + attr_accessor :manufacturerPartsWarrantyDescription + attr_accessor :materialType + attr_accessor :maximumAperture + attr_accessor :maximumColorDepth + attr_accessor :maximumFocalLength + attr_accessor :maximumHighResolutionImages + attr_accessor :maximumHorizontalResolution + attr_accessor :maximumLowResolutionImages + attr_accessor :maximumResolution + attr_accessor :maximumShutterSpeed + attr_accessor :maximumVerticalResolution + attr_accessor :maximumWeightRecommendation + attr_accessor :memorySlotsAvailable + attr_accessor :metalStamp + attr_accessor :metalType + attr_accessor :miniMovieDescription + attr_accessor :minimumFocalLength + attr_accessor :minimumShutterSpeed + attr_accessor :model + attr_accessor :modelYear + attr_accessor :modemDescription + attr_accessor :monitorSize + attr_accessor :monitorViewableDiagonalSize + attr_accessor :mouseDescription + attr_accessor :mPN + attr_accessor :musicalStyle + attr_accessor :nativeResolution + attr_accessor :neighborhood + attr_accessor :networkInterfaceDescription + attr_accessor :notebookDisplayTechnology + attr_accessor :notebookPointingDeviceDescription + attr_accessor :numberOfDiscs + attr_accessor :numberOfIssues + attr_accessor :numberOfItems + attr_accessor :numberOfKeys + attr_accessor :numberOfPages + attr_accessor :numberOfPearls + attr_accessor :numberOfRapidFireShots + attr_accessor :numberOfStones + attr_accessor :numberOfStrings + attr_accessor :numberOfTracks + attr_accessor :opticalZoom + attr_accessor :outputWattage + attr_accessor :packageDimensions + attr_accessor :pearlLustre + attr_accessor :pearlMinimumColor + attr_accessor :pearlShape + attr_accessor :pearlStringingMethod + attr_accessor :pearlSurfaceBlemishes + attr_accessor :pearlType + attr_accessor :pearlUniformity + attr_accessor :phoneNumber + attr_accessor :photoFlashType + attr_accessor :pictureFormat + attr_accessor :platform + attr_accessor :priceRating + attr_accessor :processorCount + attr_accessor :productGroup + attr_accessor :promotionalTag + attr_accessor :publicationDate + attr_accessor :publisher + attr_accessor :readingLevel + attr_accessor :recorderTrackCount + attr_accessor :regionCode + attr_accessor :regionOfOrigin + attr_accessor :releaseDate + attr_accessor :removableMemory + attr_accessor :resolutionModes + attr_accessor :ringSize + attr_accessor :runningTime + attr_accessor :secondaryCacheSize + attr_accessor :settingType + attr_accessor :size + attr_accessor :sizePerPearl + attr_accessor :skillLevel + attr_accessor :sKU + attr_accessor :soundCardDescription + attr_accessor :speakerCount + attr_accessor :speakerDescription + attr_accessor :specialFeatures + attr_accessor :stoneClarity + attr_accessor :stoneColor + attr_accessor :stoneCut + attr_accessor :stoneShape + attr_accessor :stoneWeight + attr_accessor :studio + attr_accessor :subscriptionLength + attr_accessor :supportedImageType + attr_accessor :systemBusSpeed + attr_accessor :systemMemorySizeMax + attr_accessor :systemMemorySize + attr_accessor :systemMemoryType + attr_accessor :theatricalReleaseDate + attr_accessor :title + attr_accessor :totalDiamondWeight + attr_accessor :totalExternalBaysFree + attr_accessor :totalFirewirePorts + attr_accessor :totalGemWeight + attr_accessor :totalInternalBaysFree + attr_accessor :totalMetalWeight + attr_accessor :totalNTSCPALPorts + attr_accessor :totalParallelPorts + attr_accessor :totalPCCardSlots + attr_accessor :totalPCISlotsFree + attr_accessor :totalSerialPorts + attr_accessor :totalSVideoOutPorts + attr_accessor :totalUSB2Ports + attr_accessor :totalUSBPorts + attr_accessor :totalVGAOutPorts + attr_accessor :uPC + attr_accessor :variationDenomination + attr_accessor :variationDescription + attr_accessor :warranty + attr_accessor :watchMovementType + attr_accessor :waterResistanceDepth + attr_accessor :wirelessMicrophoneFrequency + + def initialize(actor = [], address = nil, amazonMaximumAge = nil, amazonMinimumAge = nil, apertureModes = nil, artist = [], aspectRatio = nil, audienceRating = nil, audioFormat = [], author = [], backFinding = nil, bandMaterialType = nil, batteriesIncluded = nil, batteries = nil, batteryDescription = nil, batteryType = nil, bezelMaterialType = nil, binding = nil, brand = nil, calendarType = nil, cameraManualFeatures = [], caseDiameter = nil, caseMaterialType = nil, caseThickness = nil, caseType = nil, cDRWDescription = nil, chainType = nil, claspType = nil, clothingSize = nil, color = nil, compatibility = nil, computerHardwareType = nil, computerPlatform = nil, connectivity = nil, continuousShootingSpeed = nil, country = nil, cPUManufacturer = nil, cPUSpeed = nil, cPUType = nil, creator = [], cuisine = nil, delayBetweenShots = nil, department = nil, deweyDecimalNumber = nil, dialColor = nil, dialWindowMaterialType = nil, digitalZoom = nil, director = [], displaySize = nil, drumSetPieceQuantity = nil, dVDLayers = nil, dVDRWDescription = nil, dVDSides = nil, eAN = nil, edition = nil, eSRBAgeRating = nil, externalDisplaySupportDescription = nil, fabricType = nil, faxNumber = nil, feature = [], firstIssueLeadTime = nil, floppyDiskDriveDescription = nil, format = [], gemType = nil, graphicsCardInterface = nil, graphicsDescription = nil, graphicsMemorySize = nil, guitarAttribute = nil, guitarBridgeSystem = nil, guitarPickThickness = nil, guitarPickupConfiguration = nil, hardDiskCount = nil, hardDiskSize = nil, hasAutoFocus = nil, hasBurstMode = nil, hasInCameraEditing = nil, hasRedEyeReduction = nil, hasSelfTimer = nil, hasTripodMount = nil, hasVideoOut = nil, hasViewfinder = nil, hazardousMaterialType = nil, hoursOfOperation = nil, includedSoftware = nil, includesMp3Player = nil, ingredients = nil, instrumentKey = nil, isAdultProduct = nil, isAutographed = nil, iSBN = nil, isFragile = nil, isLabCreated = nil, isMemorabilia = nil, iSOEquivalent = nil, issuesPerYear = nil, itemDimensions = nil, keyboardDescription = nil, label = nil, languages = nil, legalDisclaimer = nil, lineVoltage = nil, listPrice = nil, macroFocusRange = nil, magazineType = nil, malletHardness = nil, manufacturer = nil, manufacturerLaborWarrantyDescription = nil, manufacturerMaximumAge = nil, manufacturerMinimumAge = nil, manufacturerPartsWarrantyDescription = nil, materialType = nil, maximumAperture = nil, maximumColorDepth = nil, maximumFocalLength = nil, maximumHighResolutionImages = nil, maximumHorizontalResolution = nil, maximumLowResolutionImages = nil, maximumResolution = nil, maximumShutterSpeed = nil, maximumVerticalResolution = nil, maximumWeightRecommendation = nil, memorySlotsAvailable = nil, metalStamp = nil, metalType = nil, miniMovieDescription = nil, minimumFocalLength = nil, minimumShutterSpeed = nil, model = nil, modelYear = nil, modemDescription = nil, monitorSize = nil, monitorViewableDiagonalSize = nil, mouseDescription = nil, mPN = nil, musicalStyle = nil, nativeResolution = nil, neighborhood = nil, networkInterfaceDescription = nil, notebookDisplayTechnology = nil, notebookPointingDeviceDescription = nil, numberOfDiscs = nil, numberOfIssues = nil, numberOfItems = nil, numberOfKeys = nil, numberOfPages = nil, numberOfPearls = nil, numberOfRapidFireShots = nil, numberOfStones = nil, numberOfStrings = nil, numberOfTracks = nil, opticalZoom = nil, outputWattage = nil, packageDimensions = nil, pearlLustre = nil, pearlMinimumColor = nil, pearlShape = nil, pearlStringingMethod = nil, pearlSurfaceBlemishes = nil, pearlType = nil, pearlUniformity = nil, phoneNumber = nil, photoFlashType = [], pictureFormat = [], platform = [], priceRating = nil, processorCount = nil, productGroup = nil, promotionalTag = nil, publicationDate = nil, publisher = nil, readingLevel = nil, recorderTrackCount = nil, regionCode = nil, regionOfOrigin = nil, releaseDate = nil, removableMemory = nil, resolutionModes = nil, ringSize = nil, runningTime = nil, secondaryCacheSize = nil, settingType = nil, size = nil, sizePerPearl = nil, skillLevel = nil, sKU = nil, soundCardDescription = nil, speakerCount = nil, speakerDescription = nil, specialFeatures = [], stoneClarity = nil, stoneColor = nil, stoneCut = nil, stoneShape = nil, stoneWeight = nil, studio = nil, subscriptionLength = nil, supportedImageType = [], systemBusSpeed = nil, systemMemorySizeMax = nil, systemMemorySize = nil, systemMemoryType = nil, theatricalReleaseDate = nil, title = nil, totalDiamondWeight = nil, totalExternalBaysFree = nil, totalFirewirePorts = nil, totalGemWeight = nil, totalInternalBaysFree = nil, totalMetalWeight = nil, totalNTSCPALPorts = nil, totalParallelPorts = nil, totalPCCardSlots = nil, totalPCISlotsFree = nil, totalSerialPorts = nil, totalSVideoOutPorts = nil, totalUSB2Ports = nil, totalUSBPorts = nil, totalVGAOutPorts = nil, uPC = nil, variationDenomination = nil, variationDescription = nil, warranty = nil, watchMovementType = nil, waterResistanceDepth = nil, wirelessMicrophoneFrequency = nil) + @actor = actor + @address = address + @amazonMaximumAge = amazonMaximumAge + @amazonMinimumAge = amazonMinimumAge + @apertureModes = apertureModes + @artist = artist + @aspectRatio = aspectRatio + @audienceRating = audienceRating + @audioFormat = audioFormat + @author = author + @backFinding = backFinding + @bandMaterialType = bandMaterialType + @batteriesIncluded = batteriesIncluded + @batteries = batteries + @batteryDescription = batteryDescription + @batteryType = batteryType + @bezelMaterialType = bezelMaterialType + @binding = binding + @brand = brand + @calendarType = calendarType + @cameraManualFeatures = cameraManualFeatures + @caseDiameter = caseDiameter + @caseMaterialType = caseMaterialType + @caseThickness = caseThickness + @caseType = caseType + @cDRWDescription = cDRWDescription + @chainType = chainType + @claspType = claspType + @clothingSize = clothingSize + @color = color + @compatibility = compatibility + @computerHardwareType = computerHardwareType + @computerPlatform = computerPlatform + @connectivity = connectivity + @continuousShootingSpeed = continuousShootingSpeed + @country = country + @cPUManufacturer = cPUManufacturer + @cPUSpeed = cPUSpeed + @cPUType = cPUType + @creator = creator + @cuisine = cuisine + @delayBetweenShots = delayBetweenShots + @department = department + @deweyDecimalNumber = deweyDecimalNumber + @dialColor = dialColor + @dialWindowMaterialType = dialWindowMaterialType + @digitalZoom = digitalZoom + @director = director + @displaySize = displaySize + @drumSetPieceQuantity = drumSetPieceQuantity + @dVDLayers = dVDLayers + @dVDRWDescription = dVDRWDescription + @dVDSides = dVDSides + @eAN = eAN + @edition = edition + @eSRBAgeRating = eSRBAgeRating + @externalDisplaySupportDescription = externalDisplaySupportDescription + @fabricType = fabricType + @faxNumber = faxNumber + @feature = feature + @firstIssueLeadTime = firstIssueLeadTime + @floppyDiskDriveDescription = floppyDiskDriveDescription + @format = format + @gemType = gemType + @graphicsCardInterface = graphicsCardInterface + @graphicsDescription = graphicsDescription + @graphicsMemorySize = graphicsMemorySize + @guitarAttribute = guitarAttribute + @guitarBridgeSystem = guitarBridgeSystem + @guitarPickThickness = guitarPickThickness + @guitarPickupConfiguration = guitarPickupConfiguration + @hardDiskCount = hardDiskCount + @hardDiskSize = hardDiskSize + @hasAutoFocus = hasAutoFocus + @hasBurstMode = hasBurstMode + @hasInCameraEditing = hasInCameraEditing + @hasRedEyeReduction = hasRedEyeReduction + @hasSelfTimer = hasSelfTimer + @hasTripodMount = hasTripodMount + @hasVideoOut = hasVideoOut + @hasViewfinder = hasViewfinder + @hazardousMaterialType = hazardousMaterialType + @hoursOfOperation = hoursOfOperation + @includedSoftware = includedSoftware + @includesMp3Player = includesMp3Player + @ingredients = ingredients + @instrumentKey = instrumentKey + @isAdultProduct = isAdultProduct + @isAutographed = isAutographed + @iSBN = iSBN + @isFragile = isFragile + @isLabCreated = isLabCreated + @isMemorabilia = isMemorabilia + @iSOEquivalent = iSOEquivalent + @issuesPerYear = issuesPerYear + @itemDimensions = itemDimensions + @keyboardDescription = keyboardDescription + @label = label + @languages = languages + @legalDisclaimer = legalDisclaimer + @lineVoltage = lineVoltage + @listPrice = listPrice + @macroFocusRange = macroFocusRange + @magazineType = magazineType + @malletHardness = malletHardness + @manufacturer = manufacturer + @manufacturerLaborWarrantyDescription = manufacturerLaborWarrantyDescription + @manufacturerMaximumAge = manufacturerMaximumAge + @manufacturerMinimumAge = manufacturerMinimumAge + @manufacturerPartsWarrantyDescription = manufacturerPartsWarrantyDescription + @materialType = materialType + @maximumAperture = maximumAperture + @maximumColorDepth = maximumColorDepth + @maximumFocalLength = maximumFocalLength + @maximumHighResolutionImages = maximumHighResolutionImages + @maximumHorizontalResolution = maximumHorizontalResolution + @maximumLowResolutionImages = maximumLowResolutionImages + @maximumResolution = maximumResolution + @maximumShutterSpeed = maximumShutterSpeed + @maximumVerticalResolution = maximumVerticalResolution + @maximumWeightRecommendation = maximumWeightRecommendation + @memorySlotsAvailable = memorySlotsAvailable + @metalStamp = metalStamp + @metalType = metalType + @miniMovieDescription = miniMovieDescription + @minimumFocalLength = minimumFocalLength + @minimumShutterSpeed = minimumShutterSpeed + @model = model + @modelYear = modelYear + @modemDescription = modemDescription + @monitorSize = monitorSize + @monitorViewableDiagonalSize = monitorViewableDiagonalSize + @mouseDescription = mouseDescription + @mPN = mPN + @musicalStyle = musicalStyle + @nativeResolution = nativeResolution + @neighborhood = neighborhood + @networkInterfaceDescription = networkInterfaceDescription + @notebookDisplayTechnology = notebookDisplayTechnology + @notebookPointingDeviceDescription = notebookPointingDeviceDescription + @numberOfDiscs = numberOfDiscs + @numberOfIssues = numberOfIssues + @numberOfItems = numberOfItems + @numberOfKeys = numberOfKeys + @numberOfPages = numberOfPages + @numberOfPearls = numberOfPearls + @numberOfRapidFireShots = numberOfRapidFireShots + @numberOfStones = numberOfStones + @numberOfStrings = numberOfStrings + @numberOfTracks = numberOfTracks + @opticalZoom = opticalZoom + @outputWattage = outputWattage + @packageDimensions = packageDimensions + @pearlLustre = pearlLustre + @pearlMinimumColor = pearlMinimumColor + @pearlShape = pearlShape + @pearlStringingMethod = pearlStringingMethod + @pearlSurfaceBlemishes = pearlSurfaceBlemishes + @pearlType = pearlType + @pearlUniformity = pearlUniformity + @phoneNumber = phoneNumber + @photoFlashType = photoFlashType + @pictureFormat = pictureFormat + @platform = platform + @priceRating = priceRating + @processorCount = processorCount + @productGroup = productGroup + @promotionalTag = promotionalTag + @publicationDate = publicationDate + @publisher = publisher + @readingLevel = readingLevel + @recorderTrackCount = recorderTrackCount + @regionCode = regionCode + @regionOfOrigin = regionOfOrigin + @releaseDate = releaseDate + @removableMemory = removableMemory + @resolutionModes = resolutionModes + @ringSize = ringSize + @runningTime = runningTime + @secondaryCacheSize = secondaryCacheSize + @settingType = settingType + @size = size + @sizePerPearl = sizePerPearl + @skillLevel = skillLevel + @sKU = sKU + @soundCardDescription = soundCardDescription + @speakerCount = speakerCount + @speakerDescription = speakerDescription + @specialFeatures = specialFeatures + @stoneClarity = stoneClarity + @stoneColor = stoneColor + @stoneCut = stoneCut + @stoneShape = stoneShape + @stoneWeight = stoneWeight + @studio = studio + @subscriptionLength = subscriptionLength + @supportedImageType = supportedImageType + @systemBusSpeed = systemBusSpeed + @systemMemorySizeMax = systemMemorySizeMax + @systemMemorySize = systemMemorySize + @systemMemoryType = systemMemoryType + @theatricalReleaseDate = theatricalReleaseDate + @title = title + @totalDiamondWeight = totalDiamondWeight + @totalExternalBaysFree = totalExternalBaysFree + @totalFirewirePorts = totalFirewirePorts + @totalGemWeight = totalGemWeight + @totalInternalBaysFree = totalInternalBaysFree + @totalMetalWeight = totalMetalWeight + @totalNTSCPALPorts = totalNTSCPALPorts + @totalParallelPorts = totalParallelPorts + @totalPCCardSlots = totalPCCardSlots + @totalPCISlotsFree = totalPCISlotsFree + @totalSerialPorts = totalSerialPorts + @totalSVideoOutPorts = totalSVideoOutPorts + @totalUSB2Ports = totalUSB2Ports + @totalUSBPorts = totalUSBPorts + @totalVGAOutPorts = totalVGAOutPorts + @uPC = uPC + @variationDenomination = variationDenomination + @variationDescription = variationDescription + @warranty = warranty + @watchMovementType = watchMovementType + @waterResistanceDepth = waterResistanceDepth + @wirelessMicrophoneFrequency = wirelessMicrophoneFrequency + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}MerchantItemAttributes +class MerchantItemAttributes + @@schema_type = "MerchantItemAttributes" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_qualified = "true" + @@schema_element = [ + ["actor", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Actor")]], + ["address", ["Address", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Address")]], + ["amazonMaximumAge", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AmazonMaximumAge")]], + ["amazonMinimumAge", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AmazonMinimumAge")]], + ["apertureModes", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ApertureModes")]], + ["artist", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Artist")]], + ["aspectRatio", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AspectRatio")]], + ["audienceRating", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AudienceRating")]], + ["audioFormat", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AudioFormat")]], + ["author", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Author")]], + ["backFinding", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BackFinding")]], + ["bandMaterialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BandMaterialType")]], + ["batteriesIncluded", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BatteriesIncluded")]], + ["batteries", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Batteries")]], + ["batteryDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BatteryDescription")]], + ["batteryType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BatteryType")]], + ["bezelMaterialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BezelMaterialType")]], + ["binding", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Binding")]], + ["brand", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Brand")]], + ["calendarType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CalendarType")]], + ["cameraManualFeatures", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CameraManualFeatures")]], + ["caseDiameter", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CaseDiameter")]], + ["caseMaterialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CaseMaterialType")]], + ["caseThickness", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CaseThickness")]], + ["caseType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CaseType")]], + ["cDRWDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CDRWDescription")]], + ["chainType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ChainType")]], + ["claspType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ClaspType")]], + ["clothingSize", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ClothingSize")]], + ["color", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Color")]], + ["compatibility", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Compatibility")]], + ["computerHardwareType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ComputerHardwareType")]], + ["computerPlatform", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ComputerPlatform")]], + ["connectivity", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Connectivity")]], + ["continuousShootingSpeed", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ContinuousShootingSpeed")]], + ["country", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Country")]], + ["cPUManufacturer", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CPUManufacturer")]], + ["cPUSpeed", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CPUSpeed")]], + ["cPUType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CPUType")]], + ["creator", ["[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Creator")]], + ["cuisine", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Cuisine")]], + ["delayBetweenShots", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DelayBetweenShots")]], + ["department", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Department")]], + ["description", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Description")]], + ["deweyDecimalNumber", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DeweyDecimalNumber")]], + ["dialColor", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DialColor")]], + ["dialWindowMaterialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DialWindowMaterialType")]], + ["digitalZoom", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DigitalZoom")]], + ["director", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Director")]], + ["displaySize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DisplaySize")]], + ["drumSetPieceQuantity", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DrumSetPieceQuantity")]], + ["dVDLayers", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DVDLayers")]], + ["dVDRWDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DVDRWDescription")]], + ["dVDSides", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DVDSides")]], + ["eAN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "EAN")]], + ["edition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Edition")]], + ["eSRBAgeRating", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ESRBAgeRating")]], + ["externalDisplaySupportDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ExternalDisplaySupportDescription")]], + ["fabricType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FabricType")]], + ["faxNumber", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FaxNumber")]], + ["feature", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Feature")]], + ["firstIssueLeadTime", ["StringWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FirstIssueLeadTime")]], + ["floppyDiskDriveDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FloppyDiskDriveDescription")]], + ["format", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Format")]], + ["gemType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GemType")]], + ["graphicsCardInterface", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GraphicsCardInterface")]], + ["graphicsDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GraphicsDescription")]], + ["graphicsMemorySize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GraphicsMemorySize")]], + ["guitarAttribute", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GuitarAttribute")]], + ["guitarBridgeSystem", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GuitarBridgeSystem")]], + ["guitarPickThickness", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GuitarPickThickness")]], + ["guitarPickupConfiguration", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "GuitarPickupConfiguration")]], + ["hardDiskCount", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HardDiskCount")]], + ["hardDiskSize", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HardDiskSize")]], + ["hasAutoFocus", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasAutoFocus")]], + ["hasBurstMode", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasBurstMode")]], + ["hasInCameraEditing", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasInCameraEditing")]], + ["hasRedEyeReduction", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasRedEyeReduction")]], + ["hasSelfTimer", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasSelfTimer")]], + ["hasTripodMount", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasTripodMount")]], + ["hasVideoOut", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasVideoOut")]], + ["hasViewfinder", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HasViewfinder")]], + ["hazardousMaterialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HazardousMaterialType")]], + ["hoursOfOperation", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HoursOfOperation")]], + ["includedSoftware", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IncludedSoftware")]], + ["includesMp3Player", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IncludesMp3Player")]], + ["indications", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Indications")]], + ["ingredients", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Ingredients")]], + ["instrumentKey", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "InstrumentKey")]], + ["isAutographed", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsAutographed")]], + ["iSBN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ISBN")]], + ["isFragile", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsFragile")]], + ["isLabCreated", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsLabCreated")]], + ["isMemorabilia", ["SOAP::SOAPBoolean", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsMemorabilia")]], + ["iSOEquivalent", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ISOEquivalent")]], + ["issuesPerYear", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IssuesPerYear")]], + ["itemDimensions", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemDimensions")]], + ["keyboardDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "KeyboardDescription")]], + ["label", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Label")]], + ["languages", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Languages")]], + ["legalDisclaimer", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LegalDisclaimer")]], + ["lineVoltage", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LineVoltage")]], + ["listPrice", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListPrice")]], + ["macroFocusRange", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MacroFocusRange")]], + ["magazineType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MagazineType")]], + ["malletHardness", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MalletHardness")]], + ["manufacturer", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Manufacturer")]], + ["manufacturerLaborWarrantyDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ManufacturerLaborWarrantyDescription")]], + ["manufacturerMaximumAge", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ManufacturerMaximumAge")]], + ["manufacturerMinimumAge", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ManufacturerMinimumAge")]], + ["manufacturerPartsWarrantyDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ManufacturerPartsWarrantyDescription")]], + ["materialType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaterialType")]], + ["maximumAperture", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumAperture")]], + ["maximumColorDepth", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumColorDepth")]], + ["maximumFocalLength", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumFocalLength")]], + ["maximumHighResolutionImages", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumHighResolutionImages")]], + ["maximumHorizontalResolution", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumHorizontalResolution")]], + ["maximumLowResolutionImages", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumLowResolutionImages")]], + ["maximumResolution", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumResolution")]], + ["maximumShutterSpeed", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumShutterSpeed")]], + ["maximumVerticalResolution", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumVerticalResolution")]], + ["maximumWeightRecommendation", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumWeightRecommendation")]], + ["memorySlotsAvailable", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MemorySlotsAvailable")]], + ["metalStamp", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MetalStamp")]], + ["metalType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MetalType")]], + ["miniMovieDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MiniMovieDescription")]], + ["minimumFocalLength", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MinimumFocalLength")]], + ["minimumShutterSpeed", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MinimumShutterSpeed")]], + ["model", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Model")]], + ["modelYear", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ModelYear")]], + ["modemDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ModemDescription")]], + ["monitorSize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MonitorSize")]], + ["monitorViewableDiagonalSize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MonitorViewableDiagonalSize")]], + ["mouseDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MouseDescription")]], + ["mPN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MPN")]], + ["musicalStyle", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MusicalStyle")]], + ["nativeResolution", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NativeResolution")]], + ["neighborhood", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Neighborhood")]], + ["networkInterfaceDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NetworkInterfaceDescription")]], + ["notebookDisplayTechnology", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NotebookDisplayTechnology")]], + ["notebookPointingDeviceDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NotebookPointingDeviceDescription")]], + ["numberOfDiscs", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfDiscs")]], + ["numberOfIssues", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfIssues")]], + ["numberOfItems", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfItems")]], + ["numberOfKeys", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfKeys")]], + ["numberOfPages", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfPages")]], + ["numberOfPearls", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfPearls")]], + ["numberOfRapidFireShots", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfRapidFireShots")]], + ["numberOfStones", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfStones")]], + ["numberOfStrings", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfStrings")]], + ["numberOfTracks", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "NumberOfTracks")]], + ["opticalZoom", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OpticalZoom")]], + ["outputWattage", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OutputWattage")]], + ["packageDimensions", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PackageDimensions")]], + ["pearlLustre", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlLustre")]], + ["pearlMinimumColor", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlMinimumColor")]], + ["pearlShape", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlShape")]], + ["pearlStringingMethod", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlStringingMethod")]], + ["pearlSurfaceBlemishes", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlSurfaceBlemishes")]], + ["pearlType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlType")]], + ["pearlUniformity", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PearlUniformity")]], + ["phoneNumber", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PhoneNumber")]], + ["photoFlashType", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PhotoFlashType")]], + ["pictureFormat", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PictureFormat")]], + ["platform", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Platform")]], + ["priceRating", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PriceRating")]], + ["processorCount", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ProcessorCount")]], + ["productGroup", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ProductGroup")]], + ["promotionalTag", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PromotionalTag")]], + ["publicationDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PublicationDate")]], + ["publisher", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Publisher")]], + ["readingLevel", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ReadingLevel")]], + ["recorderTrackCount", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RecorderTrackCount")]], + ["regionCode", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RegionCode")]], + ["regionOfOrigin", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RegionOfOrigin")]], + ["releaseDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ReleaseDate")]], + ["removableMemory", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RemovableMemory")]], + ["resolutionModes", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResolutionModes")]], + ["ringSize", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "RingSize")]], + ["safetyWarning", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SafetyWarning")]], + ["secondaryCacheSize", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SecondaryCacheSize")]], + ["settingType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SettingType")]], + ["size", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Size")]], + ["sKU", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SKU")]], + ["sizePerPearl", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SizePerPearl")]], + ["skillLevel", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SkillLevel")]], + ["soundCardDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SoundCardDescription")]], + ["speakerCount", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SpeakerCount")]], + ["speakerDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SpeakerDescription")]], + ["specialFeatures", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SpecialFeatures")]], + ["stoneClarity", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StoneClarity")]], + ["stoneColor", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StoneColor")]], + ["stoneCut", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StoneCut")]], + ["stoneShape", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StoneShape")]], + ["stoneWeight", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "StoneWeight")]], + ["studio", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Studio")]], + ["subscriptionLength", ["NonNegativeIntegerWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SubscriptionLength")]], + ["supportedImageType", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SupportedImageType")]], + ["systemBusSpeed", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SystemBusSpeed")]], + ["systemMemorySizeMax", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SystemMemorySizeMax")]], + ["systemMemorySize", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SystemMemorySize")]], + ["systemMemoryType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SystemMemoryType")]], + ["theatricalReleaseDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TheatricalReleaseDate")]], + ["title", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Title")]], + ["totalDiamondWeight", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalDiamondWeight")]], + ["totalExternalBaysFree", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalExternalBaysFree")]], + ["totalFirewirePorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalFirewirePorts")]], + ["totalGemWeight", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalGemWeight")]], + ["totalInternalBaysFree", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalInternalBaysFree")]], + ["totalMetalWeight", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalMetalWeight")]], + ["totalNTSCPALPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalNTSCPALPorts")]], + ["totalParallelPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalParallelPorts")]], + ["totalPCCardSlots", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPCCardSlots")]], + ["totalPCISlotsFree", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalPCISlotsFree")]], + ["totalSerialPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalSerialPorts")]], + ["totalSVideoOutPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalSVideoOutPorts")]], + ["totalUSB2Ports", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalUSB2Ports")]], + ["totalUSBPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalUSBPorts")]], + ["totalVGAOutPorts", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TotalVGAOutPorts")]], + ["uPC", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "UPC")]], + ["variationDenomination", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "VariationDenomination")]], + ["variationDescription", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "VariationDescription")]], + ["warranty", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Warranty")]], + ["watchMovementType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WatchMovementType")]], + ["waterResistanceDepth", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WaterResistanceDepth")]], + ["wirelessMicrophoneFrequency", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "WirelessMicrophoneFrequency")]] + ] + + attr_accessor :actor + attr_accessor :address + attr_accessor :amazonMaximumAge + attr_accessor :amazonMinimumAge + attr_accessor :apertureModes + attr_accessor :artist + attr_accessor :aspectRatio + attr_accessor :audienceRating + attr_accessor :audioFormat + attr_accessor :author + attr_accessor :backFinding + attr_accessor :bandMaterialType + attr_accessor :batteriesIncluded + attr_accessor :batteries + attr_accessor :batteryDescription + attr_accessor :batteryType + attr_accessor :bezelMaterialType + attr_accessor :binding + attr_accessor :brand + attr_accessor :calendarType + attr_accessor :cameraManualFeatures + attr_accessor :caseDiameter + attr_accessor :caseMaterialType + attr_accessor :caseThickness + attr_accessor :caseType + attr_accessor :cDRWDescription + attr_accessor :chainType + attr_accessor :claspType + attr_accessor :clothingSize + attr_accessor :color + attr_accessor :compatibility + attr_accessor :computerHardwareType + attr_accessor :computerPlatform + attr_accessor :connectivity + attr_accessor :continuousShootingSpeed + attr_accessor :country + attr_accessor :cPUManufacturer + attr_accessor :cPUSpeed + attr_accessor :cPUType + attr_accessor :creator + attr_accessor :cuisine + attr_accessor :delayBetweenShots + attr_accessor :department + attr_accessor :description + attr_accessor :deweyDecimalNumber + attr_accessor :dialColor + attr_accessor :dialWindowMaterialType + attr_accessor :digitalZoom + attr_accessor :director + attr_accessor :displaySize + attr_accessor :drumSetPieceQuantity + attr_accessor :dVDLayers + attr_accessor :dVDRWDescription + attr_accessor :dVDSides + attr_accessor :eAN + attr_accessor :edition + attr_accessor :eSRBAgeRating + attr_accessor :externalDisplaySupportDescription + attr_accessor :fabricType + attr_accessor :faxNumber + attr_accessor :feature + attr_accessor :firstIssueLeadTime + attr_accessor :floppyDiskDriveDescription + attr_accessor :format + attr_accessor :gemType + attr_accessor :graphicsCardInterface + attr_accessor :graphicsDescription + attr_accessor :graphicsMemorySize + attr_accessor :guitarAttribute + attr_accessor :guitarBridgeSystem + attr_accessor :guitarPickThickness + attr_accessor :guitarPickupConfiguration + attr_accessor :hardDiskCount + attr_accessor :hardDiskSize + attr_accessor :hasAutoFocus + attr_accessor :hasBurstMode + attr_accessor :hasInCameraEditing + attr_accessor :hasRedEyeReduction + attr_accessor :hasSelfTimer + attr_accessor :hasTripodMount + attr_accessor :hasVideoOut + attr_accessor :hasViewfinder + attr_accessor :hazardousMaterialType + attr_accessor :hoursOfOperation + attr_accessor :includedSoftware + attr_accessor :includesMp3Player + attr_accessor :indications + attr_accessor :ingredients + attr_accessor :instrumentKey + attr_accessor :isAutographed + attr_accessor :iSBN + attr_accessor :isFragile + attr_accessor :isLabCreated + attr_accessor :isMemorabilia + attr_accessor :iSOEquivalent + attr_accessor :issuesPerYear + attr_accessor :itemDimensions + attr_accessor :keyboardDescription + attr_accessor :label + attr_accessor :languages + attr_accessor :legalDisclaimer + attr_accessor :lineVoltage + attr_accessor :listPrice + attr_accessor :macroFocusRange + attr_accessor :magazineType + attr_accessor :malletHardness + attr_accessor :manufacturer + attr_accessor :manufacturerLaborWarrantyDescription + attr_accessor :manufacturerMaximumAge + attr_accessor :manufacturerMinimumAge + attr_accessor :manufacturerPartsWarrantyDescription + attr_accessor :materialType + attr_accessor :maximumAperture + attr_accessor :maximumColorDepth + attr_accessor :maximumFocalLength + attr_accessor :maximumHighResolutionImages + attr_accessor :maximumHorizontalResolution + attr_accessor :maximumLowResolutionImages + attr_accessor :maximumResolution + attr_accessor :maximumShutterSpeed + attr_accessor :maximumVerticalResolution + attr_accessor :maximumWeightRecommendation + attr_accessor :memorySlotsAvailable + attr_accessor :metalStamp + attr_accessor :metalType + attr_accessor :miniMovieDescription + attr_accessor :minimumFocalLength + attr_accessor :minimumShutterSpeed + attr_accessor :model + attr_accessor :modelYear + attr_accessor :modemDescription + attr_accessor :monitorSize + attr_accessor :monitorViewableDiagonalSize + attr_accessor :mouseDescription + attr_accessor :mPN + attr_accessor :musicalStyle + attr_accessor :nativeResolution + attr_accessor :neighborhood + attr_accessor :networkInterfaceDescription + attr_accessor :notebookDisplayTechnology + attr_accessor :notebookPointingDeviceDescription + attr_accessor :numberOfDiscs + attr_accessor :numberOfIssues + attr_accessor :numberOfItems + attr_accessor :numberOfKeys + attr_accessor :numberOfPages + attr_accessor :numberOfPearls + attr_accessor :numberOfRapidFireShots + attr_accessor :numberOfStones + attr_accessor :numberOfStrings + attr_accessor :numberOfTracks + attr_accessor :opticalZoom + attr_accessor :outputWattage + attr_accessor :packageDimensions + attr_accessor :pearlLustre + attr_accessor :pearlMinimumColor + attr_accessor :pearlShape + attr_accessor :pearlStringingMethod + attr_accessor :pearlSurfaceBlemishes + attr_accessor :pearlType + attr_accessor :pearlUniformity + attr_accessor :phoneNumber + attr_accessor :photoFlashType + attr_accessor :pictureFormat + attr_accessor :platform + attr_accessor :priceRating + attr_accessor :processorCount + attr_accessor :productGroup + attr_accessor :promotionalTag + attr_accessor :publicationDate + attr_accessor :publisher + attr_accessor :readingLevel + attr_accessor :recorderTrackCount + attr_accessor :regionCode + attr_accessor :regionOfOrigin + attr_accessor :releaseDate + attr_accessor :removableMemory + attr_accessor :resolutionModes + attr_accessor :ringSize + attr_accessor :safetyWarning + attr_accessor :secondaryCacheSize + attr_accessor :settingType + attr_accessor :size + attr_accessor :sKU + attr_accessor :sizePerPearl + attr_accessor :skillLevel + attr_accessor :soundCardDescription + attr_accessor :speakerCount + attr_accessor :speakerDescription + attr_accessor :specialFeatures + attr_accessor :stoneClarity + attr_accessor :stoneColor + attr_accessor :stoneCut + attr_accessor :stoneShape + attr_accessor :stoneWeight + attr_accessor :studio + attr_accessor :subscriptionLength + attr_accessor :supportedImageType + attr_accessor :systemBusSpeed + attr_accessor :systemMemorySizeMax + attr_accessor :systemMemorySize + attr_accessor :systemMemoryType + attr_accessor :theatricalReleaseDate + attr_accessor :title + attr_accessor :totalDiamondWeight + attr_accessor :totalExternalBaysFree + attr_accessor :totalFirewirePorts + attr_accessor :totalGemWeight + attr_accessor :totalInternalBaysFree + attr_accessor :totalMetalWeight + attr_accessor :totalNTSCPALPorts + attr_accessor :totalParallelPorts + attr_accessor :totalPCCardSlots + attr_accessor :totalPCISlotsFree + attr_accessor :totalSerialPorts + attr_accessor :totalSVideoOutPorts + attr_accessor :totalUSB2Ports + attr_accessor :totalUSBPorts + attr_accessor :totalVGAOutPorts + attr_accessor :uPC + attr_accessor :variationDenomination + attr_accessor :variationDescription + attr_accessor :warranty + attr_accessor :watchMovementType + attr_accessor :waterResistanceDepth + attr_accessor :wirelessMicrophoneFrequency + + def initialize(actor = [], address = nil, amazonMaximumAge = nil, amazonMinimumAge = nil, apertureModes = nil, artist = [], aspectRatio = nil, audienceRating = nil, audioFormat = [], author = [], backFinding = nil, bandMaterialType = nil, batteriesIncluded = nil, batteries = nil, batteryDescription = nil, batteryType = nil, bezelMaterialType = nil, binding = nil, brand = nil, calendarType = nil, cameraManualFeatures = [], caseDiameter = nil, caseMaterialType = nil, caseThickness = nil, caseType = nil, cDRWDescription = nil, chainType = nil, claspType = nil, clothingSize = nil, color = nil, compatibility = nil, computerHardwareType = nil, computerPlatform = nil, connectivity = nil, continuousShootingSpeed = nil, country = nil, cPUManufacturer = nil, cPUSpeed = nil, cPUType = nil, creator = [], cuisine = nil, delayBetweenShots = nil, department = nil, description = nil, deweyDecimalNumber = nil, dialColor = nil, dialWindowMaterialType = nil, digitalZoom = nil, director = [], displaySize = nil, drumSetPieceQuantity = nil, dVDLayers = nil, dVDRWDescription = nil, dVDSides = nil, eAN = nil, edition = nil, eSRBAgeRating = nil, externalDisplaySupportDescription = nil, fabricType = nil, faxNumber = nil, feature = [], firstIssueLeadTime = nil, floppyDiskDriveDescription = nil, format = [], gemType = nil, graphicsCardInterface = nil, graphicsDescription = nil, graphicsMemorySize = nil, guitarAttribute = nil, guitarBridgeSystem = nil, guitarPickThickness = nil, guitarPickupConfiguration = nil, hardDiskCount = nil, hardDiskSize = nil, hasAutoFocus = nil, hasBurstMode = nil, hasInCameraEditing = nil, hasRedEyeReduction = nil, hasSelfTimer = nil, hasTripodMount = nil, hasVideoOut = nil, hasViewfinder = nil, hazardousMaterialType = nil, hoursOfOperation = nil, includedSoftware = nil, includesMp3Player = nil, indications = nil, ingredients = nil, instrumentKey = nil, isAutographed = nil, iSBN = nil, isFragile = nil, isLabCreated = nil, isMemorabilia = nil, iSOEquivalent = nil, issuesPerYear = nil, itemDimensions = nil, keyboardDescription = nil, label = nil, languages = nil, legalDisclaimer = nil, lineVoltage = nil, listPrice = nil, macroFocusRange = nil, magazineType = nil, malletHardness = nil, manufacturer = nil, manufacturerLaborWarrantyDescription = nil, manufacturerMaximumAge = nil, manufacturerMinimumAge = nil, manufacturerPartsWarrantyDescription = nil, materialType = nil, maximumAperture = nil, maximumColorDepth = nil, maximumFocalLength = nil, maximumHighResolutionImages = nil, maximumHorizontalResolution = nil, maximumLowResolutionImages = nil, maximumResolution = nil, maximumShutterSpeed = nil, maximumVerticalResolution = nil, maximumWeightRecommendation = nil, memorySlotsAvailable = nil, metalStamp = nil, metalType = nil, miniMovieDescription = nil, minimumFocalLength = nil, minimumShutterSpeed = nil, model = nil, modelYear = nil, modemDescription = nil, monitorSize = nil, monitorViewableDiagonalSize = nil, mouseDescription = nil, mPN = nil, musicalStyle = nil, nativeResolution = nil, neighborhood = nil, networkInterfaceDescription = nil, notebookDisplayTechnology = nil, notebookPointingDeviceDescription = nil, numberOfDiscs = nil, numberOfIssues = nil, numberOfItems = nil, numberOfKeys = nil, numberOfPages = nil, numberOfPearls = nil, numberOfRapidFireShots = nil, numberOfStones = nil, numberOfStrings = nil, numberOfTracks = nil, opticalZoom = nil, outputWattage = nil, packageDimensions = nil, pearlLustre = nil, pearlMinimumColor = nil, pearlShape = nil, pearlStringingMethod = nil, pearlSurfaceBlemishes = nil, pearlType = nil, pearlUniformity = nil, phoneNumber = nil, photoFlashType = [], pictureFormat = [], platform = [], priceRating = nil, processorCount = nil, productGroup = nil, promotionalTag = nil, publicationDate = nil, publisher = nil, readingLevel = nil, recorderTrackCount = nil, regionCode = nil, regionOfOrigin = nil, releaseDate = nil, removableMemory = nil, resolutionModes = nil, ringSize = nil, safetyWarning = nil, secondaryCacheSize = nil, settingType = nil, size = nil, sKU = nil, sizePerPearl = nil, skillLevel = nil, soundCardDescription = nil, speakerCount = nil, speakerDescription = nil, specialFeatures = [], stoneClarity = nil, stoneColor = nil, stoneCut = nil, stoneShape = nil, stoneWeight = nil, studio = nil, subscriptionLength = nil, supportedImageType = [], systemBusSpeed = nil, systemMemorySizeMax = nil, systemMemorySize = nil, systemMemoryType = nil, theatricalReleaseDate = nil, title = nil, totalDiamondWeight = nil, totalExternalBaysFree = nil, totalFirewirePorts = nil, totalGemWeight = nil, totalInternalBaysFree = nil, totalMetalWeight = nil, totalNTSCPALPorts = nil, totalParallelPorts = nil, totalPCCardSlots = nil, totalPCISlotsFree = nil, totalSerialPorts = nil, totalSVideoOutPorts = nil, totalUSB2Ports = nil, totalUSBPorts = nil, totalVGAOutPorts = nil, uPC = nil, variationDenomination = nil, variationDescription = nil, warranty = nil, watchMovementType = nil, waterResistanceDepth = nil, wirelessMicrophoneFrequency = nil) + @actor = actor + @address = address + @amazonMaximumAge = amazonMaximumAge + @amazonMinimumAge = amazonMinimumAge + @apertureModes = apertureModes + @artist = artist + @aspectRatio = aspectRatio + @audienceRating = audienceRating + @audioFormat = audioFormat + @author = author + @backFinding = backFinding + @bandMaterialType = bandMaterialType + @batteriesIncluded = batteriesIncluded + @batteries = batteries + @batteryDescription = batteryDescription + @batteryType = batteryType + @bezelMaterialType = bezelMaterialType + @binding = binding + @brand = brand + @calendarType = calendarType + @cameraManualFeatures = cameraManualFeatures + @caseDiameter = caseDiameter + @caseMaterialType = caseMaterialType + @caseThickness = caseThickness + @caseType = caseType + @cDRWDescription = cDRWDescription + @chainType = chainType + @claspType = claspType + @clothingSize = clothingSize + @color = color + @compatibility = compatibility + @computerHardwareType = computerHardwareType + @computerPlatform = computerPlatform + @connectivity = connectivity + @continuousShootingSpeed = continuousShootingSpeed + @country = country + @cPUManufacturer = cPUManufacturer + @cPUSpeed = cPUSpeed + @cPUType = cPUType + @creator = creator + @cuisine = cuisine + @delayBetweenShots = delayBetweenShots + @department = department + @description = description + @deweyDecimalNumber = deweyDecimalNumber + @dialColor = dialColor + @dialWindowMaterialType = dialWindowMaterialType + @digitalZoom = digitalZoom + @director = director + @displaySize = displaySize + @drumSetPieceQuantity = drumSetPieceQuantity + @dVDLayers = dVDLayers + @dVDRWDescription = dVDRWDescription + @dVDSides = dVDSides + @eAN = eAN + @edition = edition + @eSRBAgeRating = eSRBAgeRating + @externalDisplaySupportDescription = externalDisplaySupportDescription + @fabricType = fabricType + @faxNumber = faxNumber + @feature = feature + @firstIssueLeadTime = firstIssueLeadTime + @floppyDiskDriveDescription = floppyDiskDriveDescription + @format = format + @gemType = gemType + @graphicsCardInterface = graphicsCardInterface + @graphicsDescription = graphicsDescription + @graphicsMemorySize = graphicsMemorySize + @guitarAttribute = guitarAttribute + @guitarBridgeSystem = guitarBridgeSystem + @guitarPickThickness = guitarPickThickness + @guitarPickupConfiguration = guitarPickupConfiguration + @hardDiskCount = hardDiskCount + @hardDiskSize = hardDiskSize + @hasAutoFocus = hasAutoFocus + @hasBurstMode = hasBurstMode + @hasInCameraEditing = hasInCameraEditing + @hasRedEyeReduction = hasRedEyeReduction + @hasSelfTimer = hasSelfTimer + @hasTripodMount = hasTripodMount + @hasVideoOut = hasVideoOut + @hasViewfinder = hasViewfinder + @hazardousMaterialType = hazardousMaterialType + @hoursOfOperation = hoursOfOperation + @includedSoftware = includedSoftware + @includesMp3Player = includesMp3Player + @indications = indications + @ingredients = ingredients + @instrumentKey = instrumentKey + @isAutographed = isAutographed + @iSBN = iSBN + @isFragile = isFragile + @isLabCreated = isLabCreated + @isMemorabilia = isMemorabilia + @iSOEquivalent = iSOEquivalent + @issuesPerYear = issuesPerYear + @itemDimensions = itemDimensions + @keyboardDescription = keyboardDescription + @label = label + @languages = languages + @legalDisclaimer = legalDisclaimer + @lineVoltage = lineVoltage + @listPrice = listPrice + @macroFocusRange = macroFocusRange + @magazineType = magazineType + @malletHardness = malletHardness + @manufacturer = manufacturer + @manufacturerLaborWarrantyDescription = manufacturerLaborWarrantyDescription + @manufacturerMaximumAge = manufacturerMaximumAge + @manufacturerMinimumAge = manufacturerMinimumAge + @manufacturerPartsWarrantyDescription = manufacturerPartsWarrantyDescription + @materialType = materialType + @maximumAperture = maximumAperture + @maximumColorDepth = maximumColorDepth + @maximumFocalLength = maximumFocalLength + @maximumHighResolutionImages = maximumHighResolutionImages + @maximumHorizontalResolution = maximumHorizontalResolution + @maximumLowResolutionImages = maximumLowResolutionImages + @maximumResolution = maximumResolution + @maximumShutterSpeed = maximumShutterSpeed + @maximumVerticalResolution = maximumVerticalResolution + @maximumWeightRecommendation = maximumWeightRecommendation + @memorySlotsAvailable = memorySlotsAvailable + @metalStamp = metalStamp + @metalType = metalType + @miniMovieDescription = miniMovieDescription + @minimumFocalLength = minimumFocalLength + @minimumShutterSpeed = minimumShutterSpeed + @model = model + @modelYear = modelYear + @modemDescription = modemDescription + @monitorSize = monitorSize + @monitorViewableDiagonalSize = monitorViewableDiagonalSize + @mouseDescription = mouseDescription + @mPN = mPN + @musicalStyle = musicalStyle + @nativeResolution = nativeResolution + @neighborhood = neighborhood + @networkInterfaceDescription = networkInterfaceDescription + @notebookDisplayTechnology = notebookDisplayTechnology + @notebookPointingDeviceDescription = notebookPointingDeviceDescription + @numberOfDiscs = numberOfDiscs + @numberOfIssues = numberOfIssues + @numberOfItems = numberOfItems + @numberOfKeys = numberOfKeys + @numberOfPages = numberOfPages + @numberOfPearls = numberOfPearls + @numberOfRapidFireShots = numberOfRapidFireShots + @numberOfStones = numberOfStones + @numberOfStrings = numberOfStrings + @numberOfTracks = numberOfTracks + @opticalZoom = opticalZoom + @outputWattage = outputWattage + @packageDimensions = packageDimensions + @pearlLustre = pearlLustre + @pearlMinimumColor = pearlMinimumColor + @pearlShape = pearlShape + @pearlStringingMethod = pearlStringingMethod + @pearlSurfaceBlemishes = pearlSurfaceBlemishes + @pearlType = pearlType + @pearlUniformity = pearlUniformity + @phoneNumber = phoneNumber + @photoFlashType = photoFlashType + @pictureFormat = pictureFormat + @platform = platform + @priceRating = priceRating + @processorCount = processorCount + @productGroup = productGroup + @promotionalTag = promotionalTag + @publicationDate = publicationDate + @publisher = publisher + @readingLevel = readingLevel + @recorderTrackCount = recorderTrackCount + @regionCode = regionCode + @regionOfOrigin = regionOfOrigin + @releaseDate = releaseDate + @removableMemory = removableMemory + @resolutionModes = resolutionModes + @ringSize = ringSize + @safetyWarning = safetyWarning + @secondaryCacheSize = secondaryCacheSize + @settingType = settingType + @size = size + @sKU = sKU + @sizePerPearl = sizePerPearl + @skillLevel = skillLevel + @soundCardDescription = soundCardDescription + @speakerCount = speakerCount + @speakerDescription = speakerDescription + @specialFeatures = specialFeatures + @stoneClarity = stoneClarity + @stoneColor = stoneColor + @stoneCut = stoneCut + @stoneShape = stoneShape + @stoneWeight = stoneWeight + @studio = studio + @subscriptionLength = subscriptionLength + @supportedImageType = supportedImageType + @systemBusSpeed = systemBusSpeed + @systemMemorySizeMax = systemMemorySizeMax + @systemMemorySize = systemMemorySize + @systemMemoryType = systemMemoryType + @theatricalReleaseDate = theatricalReleaseDate + @title = title + @totalDiamondWeight = totalDiamondWeight + @totalExternalBaysFree = totalExternalBaysFree + @totalFirewirePorts = totalFirewirePorts + @totalGemWeight = totalGemWeight + @totalInternalBaysFree = totalInternalBaysFree + @totalMetalWeight = totalMetalWeight + @totalNTSCPALPorts = totalNTSCPALPorts + @totalParallelPorts = totalParallelPorts + @totalPCCardSlots = totalPCCardSlots + @totalPCISlotsFree = totalPCISlotsFree + @totalSerialPorts = totalSerialPorts + @totalSVideoOutPorts = totalSVideoOutPorts + @totalUSB2Ports = totalUSB2Ports + @totalUSBPorts = totalUSBPorts + @totalVGAOutPorts = totalVGAOutPorts + @uPC = uPC + @variationDenomination = variationDenomination + @variationDescription = variationDescription + @warranty = warranty + @watchMovementType = watchMovementType + @waterResistanceDepth = waterResistanceDepth + @wirelessMicrophoneFrequency = wirelessMicrophoneFrequency + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}HelpRequest +class HelpRequest + @@schema_type = "HelpRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["about", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "About")]], + ["helpType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HelpType")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]] + ] + + attr_accessor :about + attr_accessor :helpType + attr_accessor :responseGroup + + def initialize(about = nil, helpType = nil, responseGroup = []) + @about = about + @helpType = helpType + @responseGroup = responseGroup + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ItemSearchRequest +class ItemSearchRequest + @@schema_type = "ItemSearchRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["actor", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Actor")]], + ["artist", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Artist")]], + ["availability", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Availability")]], + ["audienceRating", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "AudienceRating")]], + ["author", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Author")]], + ["brand", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Brand")]], + ["browseNode", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNode")]], + ["city", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "City")]], + ["composer", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Composer")]], + ["condition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Condition")]], + ["conductor", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Conductor")]], + ["count", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Count")]], + ["cuisine", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Cuisine")]], + ["deliveryMethod", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DeliveryMethod")]], + ["director", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Director")]], + ["futureLaunchDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FutureLaunchDate")]], + ["iSPUPostalCode", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ISPUPostalCode")]], + ["itemPage", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemPage")]], + ["keywords", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Keywords")]], + ["manufacturer", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Manufacturer")]], + ["maximumPrice", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MaximumPrice")]], + ["merchantId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MerchantId")]], + ["minimumPrice", ["SOAP::SOAPNonNegativeInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MinimumPrice")]], + ["musicLabel", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MusicLabel")]], + ["neighborhood", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Neighborhood")]], + ["orchestra", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Orchestra")]], + ["postalCode", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PostalCode")]], + ["power", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Power")]], + ["publisher", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Publisher")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]], + ["searchIndex", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SearchIndex")]], + ["sort", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Sort")]], + ["state", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "State")]], + ["textStream", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TextStream")]], + ["title", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Title")]], + ["releaseDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ReleaseDate")]] + ] + + attr_accessor :actor + attr_accessor :artist + attr_accessor :availability + attr_accessor :audienceRating + attr_accessor :author + attr_accessor :brand + attr_accessor :browseNode + attr_accessor :city + attr_accessor :composer + attr_accessor :condition + attr_accessor :conductor + attr_accessor :count + attr_accessor :cuisine + attr_accessor :deliveryMethod + attr_accessor :director + attr_accessor :futureLaunchDate + attr_accessor :iSPUPostalCode + attr_accessor :itemPage + attr_accessor :keywords + attr_accessor :manufacturer + attr_accessor :maximumPrice + attr_accessor :merchantId + attr_accessor :minimumPrice + attr_accessor :musicLabel + attr_accessor :neighborhood + attr_accessor :orchestra + attr_accessor :postalCode + attr_accessor :power + attr_accessor :publisher + attr_accessor :responseGroup + attr_accessor :searchIndex + attr_accessor :sort + attr_accessor :state + attr_accessor :textStream + attr_accessor :title + attr_accessor :releaseDate + + def initialize(actor = nil, artist = nil, availability = nil, audienceRating = [], author = nil, brand = nil, browseNode = nil, city = nil, composer = nil, condition = nil, conductor = nil, count = nil, cuisine = nil, deliveryMethod = nil, director = nil, futureLaunchDate = nil, iSPUPostalCode = nil, itemPage = nil, keywords = nil, manufacturer = nil, maximumPrice = nil, merchantId = nil, minimumPrice = nil, musicLabel = nil, neighborhood = nil, orchestra = nil, postalCode = nil, power = nil, publisher = nil, responseGroup = [], searchIndex = nil, sort = nil, state = nil, textStream = nil, title = nil, releaseDate = nil) + @actor = actor + @artist = artist + @availability = availability + @audienceRating = audienceRating + @author = author + @brand = brand + @browseNode = browseNode + @city = city + @composer = composer + @condition = condition + @conductor = conductor + @count = count + @cuisine = cuisine + @deliveryMethod = deliveryMethod + @director = director + @futureLaunchDate = futureLaunchDate + @iSPUPostalCode = iSPUPostalCode + @itemPage = itemPage + @keywords = keywords + @manufacturer = manufacturer + @maximumPrice = maximumPrice + @merchantId = merchantId + @minimumPrice = minimumPrice + @musicLabel = musicLabel + @neighborhood = neighborhood + @orchestra = orchestra + @postalCode = postalCode + @power = power + @publisher = publisher + @responseGroup = responseGroup + @searchIndex = searchIndex + @sort = sort + @state = state + @textStream = textStream + @title = title + @releaseDate = releaseDate + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ItemLookupRequest +class ItemLookupRequest + @@schema_type = "ItemLookupRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["condition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Condition")]], + ["deliveryMethod", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DeliveryMethod")]], + ["futureLaunchDate", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FutureLaunchDate")]], + ["idType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IdType")]], + ["iSPUPostalCode", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ISPUPostalCode")]], + ["merchantId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MerchantId")]], + ["offerPage", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OfferPage")]], + ["itemId", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemId")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]], + ["reviewPage", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ReviewPage")]], + ["searchIndex", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SearchIndex")]], + ["searchInsideKeywords", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SearchInsideKeywords")]], + ["variationPage", ["PositiveIntegerOrAll", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "VariationPage")]] + ] + + attr_accessor :condition + attr_accessor :deliveryMethod + attr_accessor :futureLaunchDate + attr_accessor :idType + attr_accessor :iSPUPostalCode + attr_accessor :merchantId + attr_accessor :offerPage + attr_accessor :itemId + attr_accessor :responseGroup + attr_accessor :reviewPage + attr_accessor :searchIndex + attr_accessor :searchInsideKeywords + attr_accessor :variationPage + + def initialize(condition = nil, deliveryMethod = nil, futureLaunchDate = nil, idType = nil, iSPUPostalCode = nil, merchantId = nil, offerPage = nil, itemId = [], responseGroup = [], reviewPage = nil, searchIndex = nil, searchInsideKeywords = nil, variationPage = nil) + @condition = condition + @deliveryMethod = deliveryMethod + @futureLaunchDate = futureLaunchDate + @idType = idType + @iSPUPostalCode = iSPUPostalCode + @merchantId = merchantId + @offerPage = offerPage + @itemId = itemId + @responseGroup = responseGroup + @reviewPage = reviewPage + @searchIndex = searchIndex + @searchInsideKeywords = searchInsideKeywords + @variationPage = variationPage + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ListSearchRequest +class ListSearchRequest + @@schema_type = "ListSearchRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["city", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "City")]], + ["email", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Email")]], + ["firstName", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FirstName")]], + ["lastName", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "LastName")]], + ["listPage", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListPage")]], + ["listType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListType")]], + ["name", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Name")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]], + ["state", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "State")]] + ] + + attr_accessor :city + attr_accessor :email + attr_accessor :firstName + attr_accessor :lastName + attr_accessor :listPage + attr_accessor :listType + attr_accessor :name + attr_accessor :responseGroup + attr_accessor :state + + def initialize(city = nil, email = nil, firstName = nil, lastName = nil, listPage = nil, listType = nil, name = nil, responseGroup = [], state = nil) + @city = city + @email = email + @firstName = firstName + @lastName = lastName + @listPage = listPage + @listType = listType + @name = name + @responseGroup = responseGroup + @state = state + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}ListLookupRequest +class ListLookupRequest + @@schema_type = "ListLookupRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["condition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Condition")]], + ["deliveryMethod", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DeliveryMethod")]], + ["iSPUPostalCode", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ISPUPostalCode")]], + ["listId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListId")]], + ["listType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListType")]], + ["merchantId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MerchantId")]], + ["productGroup", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ProductGroup")]], + ["productPage", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ProductPage")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]], + ["sort", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Sort")]] + ] + + attr_accessor :condition + attr_accessor :deliveryMethod + attr_accessor :iSPUPostalCode + attr_accessor :listId + attr_accessor :listType + attr_accessor :merchantId + attr_accessor :productGroup + attr_accessor :productPage + attr_accessor :responseGroup + attr_accessor :sort + + def initialize(condition = nil, deliveryMethod = nil, iSPUPostalCode = nil, listId = nil, listType = nil, merchantId = nil, productGroup = nil, productPage = nil, responseGroup = [], sort = nil) + @condition = condition + @deliveryMethod = deliveryMethod + @iSPUPostalCode = iSPUPostalCode + @listId = listId + @listType = listType + @merchantId = merchantId + @productGroup = productGroup + @productPage = productPage + @responseGroup = responseGroup + @sort = sort + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CustomerContentSearchRequest +class CustomerContentSearchRequest + @@schema_type = "CustomerContentSearchRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["customerPage", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerPage")]], + ["email", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Email")]], + ["name", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Name")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]] + ] + + attr_accessor :customerPage + attr_accessor :email + attr_accessor :name + attr_accessor :responseGroup + + def initialize(customerPage = nil, email = nil, name = nil, responseGroup = []) + @customerPage = customerPage + @email = email + @name = name + @responseGroup = responseGroup + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CustomerContentLookupRequest +class CustomerContentLookupRequest + @@schema_type = "CustomerContentLookupRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["customerId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerId")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]], + ["reviewPage", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ReviewPage")]] + ] + + attr_accessor :customerId + attr_accessor :responseGroup + attr_accessor :reviewPage + + def initialize(customerId = nil, responseGroup = [], reviewPage = nil) + @customerId = customerId + @responseGroup = responseGroup + @reviewPage = reviewPage + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SimilarityLookupRequest +class SimilarityLookupRequest + @@schema_type = "SimilarityLookupRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["condition", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Condition")]], + ["deliveryMethod", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "DeliveryMethod")]], + ["itemId", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemId")]], + ["iSPUPostalCode", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ISPUPostalCode")]], + ["merchantId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MerchantId")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]], + ["similarityType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarityType")]] + ] + + attr_accessor :condition + attr_accessor :deliveryMethod + attr_accessor :itemId + attr_accessor :iSPUPostalCode + attr_accessor :merchantId + attr_accessor :responseGroup + attr_accessor :similarityType + + def initialize(condition = nil, deliveryMethod = nil, itemId = [], iSPUPostalCode = nil, merchantId = nil, responseGroup = [], similarityType = nil) + @condition = condition + @deliveryMethod = deliveryMethod + @itemId = itemId + @iSPUPostalCode = iSPUPostalCode + @merchantId = merchantId + @responseGroup = responseGroup + @similarityType = similarityType + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerLookupRequest +class SellerLookupRequest + @@schema_type = "SellerLookupRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]], + ["sellerId", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerId")]], + ["feedbackPage", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FeedbackPage")]] + ] + + attr_accessor :responseGroup + attr_accessor :sellerId + attr_accessor :feedbackPage + + def initialize(responseGroup = [], sellerId = [], feedbackPage = nil) + @responseGroup = responseGroup + @sellerId = sellerId + @feedbackPage = feedbackPage + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartGetRequest +class CartGetRequest + @@schema_type = "CartGetRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["cartId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartId")]], + ["hMAC", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HMAC")]], + ["mergeCart", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MergeCart")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]] + ] + + attr_accessor :cartId + attr_accessor :hMAC + attr_accessor :mergeCart + attr_accessor :responseGroup + + def initialize(cartId = nil, hMAC = nil, mergeCart = nil, responseGroup = []) + @cartId = cartId + @hMAC = hMAC + @mergeCart = mergeCart + @responseGroup = responseGroup + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartAddRequest +class CartAddRequest + @@schema_type = "CartAddRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["cartId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartId")]], + ["hMAC", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HMAC")]], + ["mergeCart", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MergeCart")]], + ["items", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Items")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]] + ] + + attr_accessor :cartId + attr_accessor :hMAC + attr_accessor :mergeCart + attr_accessor :items + attr_accessor :responseGroup + + def initialize(cartId = nil, hMAC = nil, mergeCart = nil, items = nil, responseGroup = []) + @cartId = cartId + @hMAC = hMAC + @mergeCart = mergeCart + @items = items + @responseGroup = responseGroup + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartCreateRequest +class CartCreateRequest + @@schema_type = "CartCreateRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["mergeCart", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MergeCart")]], + ["items", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Items")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]] + ] + + attr_accessor :mergeCart + attr_accessor :items + attr_accessor :responseGroup + + def initialize(mergeCart = nil, items = nil, responseGroup = []) + @mergeCart = mergeCart + @items = items + @responseGroup = responseGroup + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartModifyRequest +class CartModifyRequest + @@schema_type = "CartModifyRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["cartId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartId")]], + ["hMAC", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HMAC")]], + ["mergeCart", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MergeCart")]], + ["items", [nil, XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Items")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]] + ] + + attr_accessor :cartId + attr_accessor :hMAC + attr_accessor :mergeCart + attr_accessor :items + attr_accessor :responseGroup + + def initialize(cartId = nil, hMAC = nil, mergeCart = nil, items = nil, responseGroup = []) + @cartId = cartId + @hMAC = hMAC + @mergeCart = mergeCart + @items = items + @responseGroup = responseGroup + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartClearRequest +class CartClearRequest + @@schema_type = "CartClearRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["cartId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartId")]], + ["hMAC", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HMAC")]], + ["mergeCart", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MergeCart")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]] + ] + + attr_accessor :cartId + attr_accessor :hMAC + attr_accessor :mergeCart + attr_accessor :responseGroup + + def initialize(cartId = nil, hMAC = nil, mergeCart = nil, responseGroup = []) + @cartId = cartId + @hMAC = hMAC + @mergeCart = mergeCart + @responseGroup = responseGroup + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}TransactionLookupRequest +class TransactionLookupRequest + @@schema_type = "TransactionLookupRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]], + ["transactionId", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionId")]] + ] + + attr_accessor :responseGroup + attr_accessor :transactionId + + def initialize(responseGroup = [], transactionId = []) + @responseGroup = responseGroup + @transactionId = transactionId + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerListingSearchRequest +class SellerListingSearchRequest + @@schema_type = "SellerListingSearchRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["keywords", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Keywords")]], + ["listingPage", ["SOAP::SOAPPositiveInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListingPage")]], + ["offerStatus", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "OfferStatus")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]], + ["sellerId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerId")]], + ["sort", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Sort")]], + ["title", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Title")]] + ] + + attr_accessor :keywords + attr_accessor :listingPage + attr_accessor :offerStatus + attr_accessor :responseGroup + attr_accessor :sellerId + attr_accessor :sort + attr_accessor :title + + def initialize(keywords = nil, listingPage = nil, offerStatus = nil, responseGroup = [], sellerId = nil, sort = nil, title = nil) + @keywords = keywords + @listingPage = listingPage + @offerStatus = offerStatus + @responseGroup = responseGroup + @sellerId = sellerId + @sort = sort + @title = title + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}SellerListingLookupRequest +class SellerListingLookupRequest + @@schema_type = "SellerListingLookupRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["id", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Id")]], + ["sellerId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerId")]], + ["idType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IdType")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]] + ] + + attr_accessor :id + attr_accessor :sellerId + attr_accessor :idType + attr_accessor :responseGroup + + def initialize(id = nil, sellerId = nil, idType = nil, responseGroup = []) + @id = id + @sellerId = sellerId + @idType = idType + @responseGroup = responseGroup + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}BrowseNodeLookupRequest +class BrowseNodeLookupRequest + @@schema_type = "BrowseNodeLookupRequest" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["browseNodeId", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNodeId")]], + ["responseGroup", ["SOAP::SOAPString[]", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ResponseGroup")]] + ] + + attr_accessor :browseNodeId + attr_accessor :responseGroup + + def initialize(browseNodeId = [], responseGroup = []) + @browseNodeId = browseNodeId + @responseGroup = responseGroup + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}CartItem +class CartItem + @@schema_type = "CartItem" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["cartItemId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartItemId")]], + ["aSIN", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ASIN")]], + ["exchangeId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ExchangeId")]], + ["merchantId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MerchantId")]], + ["sellerId", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerId")]], + ["sellerNickname", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerNickname")]], + ["quantity", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Quantity")]], + ["title", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Title")]], + ["productGroup", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ProductGroup")]], + ["listOwner", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListOwner")]], + ["listType", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListType")]], + ["price", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Price")]], + ["itemTotal", ["Price", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemTotal")]] + ] + + attr_accessor :cartItemId + attr_accessor :aSIN + attr_accessor :exchangeId + attr_accessor :merchantId + attr_accessor :sellerId + attr_accessor :sellerNickname + attr_accessor :quantity + attr_accessor :title + attr_accessor :productGroup + attr_accessor :listOwner + attr_accessor :listType + attr_accessor :price + attr_accessor :itemTotal + + def initialize(cartItemId = nil, aSIN = nil, exchangeId = nil, merchantId = nil, sellerId = nil, sellerNickname = nil, quantity = nil, title = nil, productGroup = nil, listOwner = nil, listType = nil, price = nil, itemTotal = nil) + @cartItemId = cartItemId + @aSIN = aSIN + @exchangeId = exchangeId + @merchantId = merchantId + @sellerId = sellerId + @sellerNickname = sellerNickname + @quantity = quantity + @title = title + @productGroup = productGroup + @listOwner = listOwner + @listType = listType + @price = price + @itemTotal = itemTotal + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Address +class Address + @@schema_type = "Address" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["name", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Name")]], + ["address1", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Address1")]], + ["address2", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Address2")]], + ["address3", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Address3")]], + ["city", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "City")]], + ["state", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "State")]], + ["postalCode", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "PostalCode")]], + ["country", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Country")]] + ] + + attr_accessor :name + attr_accessor :address1 + attr_accessor :address2 + attr_accessor :address3 + attr_accessor :city + attr_accessor :state + attr_accessor :postalCode + attr_accessor :country + + def initialize(name = nil, address1 = nil, address2 = nil, address3 = nil, city = nil, state = nil, postalCode = nil, country = nil) + @name = name + @address1 = address1 + @address2 = address2 + @address3 = address3 + @city = city + @state = state + @postalCode = postalCode + @country = country + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Price +class Price + @@schema_type = "Price" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["amount", ["SOAP::SOAPInteger", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Amount")]], + ["currencyCode", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CurrencyCode")]], + ["formattedPrice", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "FormattedPrice")]] + ] + + attr_accessor :amount + attr_accessor :currencyCode + attr_accessor :formattedPrice + + def initialize(amount = nil, currencyCode = nil, formattedPrice = nil) + @amount = amount + @currencyCode = currencyCode + @formattedPrice = formattedPrice + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}Image +class Image + @@schema_type = "Image" + @@schema_ns = "http://webservices.amazon.com/AWSECommerceService/2006-06-07" + @@schema_element = [ + ["uRL", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "URL")]], + ["height", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Height")]], + ["width", ["DecimalWithUnits", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Width")]], + ["isVerified", ["SOAP::SOAPString", XSD::QName.new("http://webservices.amazon.com/AWSECommerceService/2006-06-07", "IsVerified")]] + ] + + attr_accessor :uRL + attr_accessor :height + attr_accessor :width + attr_accessor :isVerified + + def initialize(uRL = nil, height = nil, width = nil, isVerified = nil) + @uRL = uRL + @height = height + @width = width + @isVerified = isVerified + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}NonNegativeIntegerWithUnits +# contains SOAP::SOAPNonNegativeInteger +class NonNegativeIntegerWithUnits < ::String + @@schema_attribute = { + XSD::QName.new(nil, "Units") => "SOAP::SOAPString" + } + + def xmlattr_Units + (@__xmlattr ||= {})[XSD::QName.new(nil, "Units")] + end + + def xmlattr_Units=(value) + (@__xmlattr ||= {})[XSD::QName.new(nil, "Units")] = value + end + + def initialize(*arg) + super + @__xmlattr = {} + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}DecimalWithUnits +# contains SOAP::SOAPDecimal +class DecimalWithUnits < ::String + @@schema_attribute = { + XSD::QName.new(nil, "Units") => "SOAP::SOAPString" + } + + def xmlattr_Units + (@__xmlattr ||= {})[XSD::QName.new(nil, "Units")] + end + + def xmlattr_Units=(value) + (@__xmlattr ||= {})[XSD::QName.new(nil, "Units")] = value + end + + def initialize(*arg) + super + @__xmlattr = {} + end +end + +# {http://webservices.amazon.com/AWSECommerceService/2006-06-07}StringWithUnits +# contains SOAP::SOAPString +class StringWithUnits < ::String + @@schema_attribute = { + XSD::QName.new(nil, "Units") => "SOAP::SOAPString" + } + + def xmlattr_Units + (@__xmlattr ||= {})[XSD::QName.new(nil, "Units")] + end + + def xmlattr_Units=(value) + (@__xmlattr ||= {})[XSD::QName.new(nil, "Units")] = value + end + + def initialize(*arg) + super + @__xmlattr = {} + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/amazonEcDriver.rb b/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/amazonEcDriver.rb new file mode 100644 index 00000000..df1a924f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/amazonEcDriver.rb @@ -0,0 +1,171 @@ +require 'amazonEc.rb' + +require 'soap/rpc/driver' + +class AWSECommerceServicePortType < ::SOAP::RPC::Driver + DefaultEndpointUrl = "http://soap.amazon.com/onca/soap?Service=AWSECommerceService" + MappingRegistry = ::SOAP::Mapping::Registry.new + + Methods = [ + [ "http://soap.amazon.com", + "help", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "Help"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "HelpResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "itemSearch", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemSearch"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemSearchResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "itemLookup", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemLookup"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ItemLookupResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "browseNodeLookup", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNodeLookup"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "BrowseNodeLookupResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "listSearch", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListSearch"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListSearchResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "listLookup", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListLookup"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "ListLookupResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "customerContentSearch", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerContentSearch"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerContentSearchResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "customerContentLookup", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerContentLookup"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CustomerContentLookupResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "similarityLookup", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarityLookup"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SimilarityLookupResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "sellerLookup", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerLookup"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerLookupResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "cartGet", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartGet"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartGetResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "cartCreate", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartCreate"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartCreateResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "cartAdd", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartAdd"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartAddResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "cartModify", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartModify"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartModifyResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "cartClear", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartClear"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "CartClearResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "transactionLookup", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionLookup"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "TransactionLookupResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "sellerListingSearch", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListingSearch"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListingSearchResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "sellerListingLookup", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListingLookup"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "SellerListingLookupResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ], + [ "http://soap.amazon.com", + "multiOperation", + [ ["in", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MultiOperation"], true], + ["out", "body", ["::SOAP::SOAPElement", "http://webservices.amazon.com/AWSECommerceService/2006-06-07", "MultiOperationResponse"], true] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal } + ] + ] + + 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/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/amazonresponse.xml b/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/amazonresponse.xml new file mode 100644 index 00000000..e4d02e51 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/amazonresponse.xml @@ -0,0 +1,100 @@ + + + + + + +
+
+
+ 00000000000000000000 + + + + + 0.17442512512207 +
+ + + True + + 11 + 2 + + B000AMF800 + the_url_is_too_long + + Andreas Bieber, Pia Douwes, Thomas Borchert, Felix Martin Uwe + Ar-Express (Sony BMG) + Music + Musical Stars + + + + 852 + EUR + EUR 8,52 + + + 852 + EUR + EUR 8,52 + + 12 + 2 + 0 + 0 + + + + Totale Finsternis (Tanz der Vampire) + Ich mir (Elisabeth) + The Winner Takes It All ("Mamma Mia") + Cindy (Cindy) + Beauty And The Beast (Disney's Beauty & The Best) + Somewhere Out There (American Tail) + Mamma Mia - Musicalstars singen Abba-Hits + Dies ist die Stunde (Jekyll & Hyde) + Bring ihn heim (Les ) + New Hampshire Nights (An Unfinished Song) + The Door Is Open + Pinball Wizard (Tommy) + Ocean Of Love (Poe: Pech und Schwefel) + + + Written In The Stars ("Aida" + I Am (Hero) + Waterloo - Musicalstars singen Abba-Hits + Don't Cry For Me Argentina (Evita) + Gib mir Kraft (Bonifatius: Das Musical) + Break The Silence (Paradise Of Pain) + Irgendetwas fehlt (Letterland) + A Dangerous Game (Jekyll & Hyde) + I Am A Mirror (Freudiana) + Easy Terms (Blood Brothers) + The Shades Of Night (Elisabeth) + Gold von den Sternen (Mozart!) + Die Musik der Nacht (Das Phantom der Oper) + + + Schlag ein (Poe: Pech und Schwefel) - Edited Version + Ein Leben lang (Bonifatius: Das Musical) + Memory (Cats) + Any Fool Could Se / Oh, Paris (Paris) + Does Your Mother Know (Mamma Mia) + Out Of My Pain + Lullaby From Faraway + Die unstillbare Gier (Tanz der Vampire) + Make A Wish Come True (Make-A-Wish-Foundation Song) + Somewhere In Heaven (Arena) + Are We Really Angels + Lost My Mind (Peggy: Das Musical) + Our Time (Merrily We Roll Along) + Follow Your Star + + + + +
+
+
diff --git a/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/test_definedarray.rb b/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/test_definedarray.rb new file mode 100644 index 00000000..4a87e2d9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/literalArrayMapping/test_definedarray.rb @@ -0,0 +1,34 @@ +require 'test/unit' +require 'soap/mapping' +require 'soap/processor' +require 'soap/rpc/element' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module SOAP +module Marshal + + +class TestDefinedArray < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + + def pathname(filename) + File.join(DIR, filename) + end + + def setup + TestUtil.require(DIR, 'amazonEcDriver.rb') + end + + def test_amazonresponse + drv = AWSECommerceServicePortType.new + drv.wiredump_dev = STDOUT if $DEBUG + drv.test_loopback_response << File.read(pathname('amazonresponse.xml')) + obj = drv.itemSearch(ItemSearch.new) + assert_equal(3, obj.items.item.tracks.disc.size) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/marshal/marshaltestlib.rb b/vendor/gems/soap4r-1.5.8/test/soap/marshal/marshaltestlib.rb new file mode 100644 index 00000000..ffac6aa2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/marshal/marshaltestlib.rb @@ -0,0 +1,494 @@ +module MarshalTestLib + # include this module to a Test::Unit::TestCase and definde encode(o) and + # decode(s) methods. e.g. + # + # def encode(o) + # SOAPMarshal.dump(o) + # end + # + # def decode(s) + # SOAPMarshal.load(s) + # end + + NegativeZero = (-1.0 / (1.0 / 0.0)) + + module Mod1; end + module Mod2; end + + def marshaltest(o1) + str = encode(o1) + print str, "\n" if $DEBUG + o2 = decode(str) + o2 + end + + def marshal_equal(o1, msg = nil) + msg = msg ? msg + "(#{ caller[0] })" : caller[0] + o2 = marshaltest(o1) + assert_equal(o1.class, o2.class, msg) + iv1 = o1.instance_variables.sort + iv2 = o2.instance_variables.sort + assert_equal(iv1, iv2) + val1 = iv1.map {|var| o1.instance_eval {eval var}} + val2 = iv1.map {|var| o2.instance_eval {eval var}} + assert_equal(val1, val2, msg) + if block_given? + assert_equal(yield(o1), yield(o2), msg) + else + assert_equal(o1, o2, msg) + end + end + + class MyObject; def initialize(v) @v = v end; attr_reader :v; end + def test_object + o1 = Object.new + o1.instance_eval { @iv = 1 } + marshal_equal(o1) {|o| o.instance_eval { @iv }} + end + + def test_object_subclass + marshal_equal(MyObject.new(2)) {|o| o.v} + end + + def test_object_extend + o1 = Object.new + o1.extend(Mod1) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + o1.extend(Mod2) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + end + + def test_object_subclass_extend + o1 = MyObject.new(2) + o1.extend(Mod1) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + o1.extend(Mod2) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + end + + class MyArray < Array + def initialize(v, *args) + super(args) + @v = v + end + end + def test_array + marshal_equal(5) + marshal_equal([1,2,3]) + end + + def test_array_subclass + marshal_equal(MyArray.new(0, 1, 2, 3)) + end + + def test_array_ivar + o1 = Array.new + o1.instance_eval { @iv = 1 } + marshal_equal(o1) {|o| o.instance_eval { @iv }} + end + + class MyException < Exception; def initialize(v, *args) super(*args); @v = v; end; attr_reader :v; end + def test_exception + marshal_equal(Exception.new('foo')) {|o| o.message} + marshal_equal(assert_raise(NoMethodError) {no_such_method()}) {|o| o.message} + end + + def test_exception_subclass + marshal_equal(MyException.new(20, "bar")) {|o| [o.message, o.v]} + end + + def test_false + marshal_equal(false) + end + + class MyHash < Hash; def initialize(v, *args) super(*args); @v = v; end end + def test_hash + marshal_equal({1=>2, 3=>4}) + end + + def test_hash_default + h = Hash.new(:default) + h[5] = 6 + marshal_equal(h) + end + + def test_hash_subclass + h = MyHash.new(7, 8) + h[4] = 5 + marshal_equal(h) + end + + def test_hash_default_proc + h = Hash.new {} + assert_raises(TypeError) { marshaltest(h) } + end + + def test_hash_ivar + o1 = Hash.new + o1.instance_eval { @iv = 1 } + marshal_equal(o1) {|o| o.instance_eval { @iv }} + end + + def test_hash_extend + o1 = Hash.new + o1.extend(Mod1) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + o1.extend(Mod2) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + end + + def test_hash_subclass_extend + o1 = MyHash.new(2) + o1.extend(Mod1) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + o1.extend(Mod2) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + end + + def test_bignum + marshal_equal(-0x4000_0000_0000_0001) + marshal_equal(-0x4000_0001) + marshal_equal(0x4000_0000) + marshal_equal(0x4000_0000_0000_0000) + end + + def test_fixnum + marshal_equal(-0x4000_0000) + marshal_equal(-0x3fff_ffff) + marshal_equal(-1) + marshal_equal(0) + marshal_equal(1) + marshal_equal(0x3fff_ffff) + end + + def test_fixnum_ivar + o1 = 1 + o1.instance_eval { @iv = 2 } + marshal_equal(o1) {|o| o.instance_eval { @iv }} + ensure + 1.instance_eval { remove_instance_variable("@iv") } + end + + def test_fixnum_ivar_self + o1 = 1 + o1.instance_eval { @iv = 1 } + marshal_equal(o1) {|o| o.instance_eval { @iv }} + ensure + 1.instance_eval { remove_instance_variable("@iv") } + end + + def test_float + marshal_equal(-1.0) + marshal_equal(0.0) + marshal_equal(1.0) + end + + def test_float_inf_nan + marshal_equal(1.0/0.0) + marshal_equal(-1.0/0.0) + marshal_equal(0.0/0.0) {|o| o.nan?} + marshal_equal(NegativeZero) {|o| 1.0/o} + end + + def test_float_ivar + o1 = 1.23 + o1.instance_eval { @iv = 1 } + marshal_equal(o1) {|o| o.instance_eval { @iv }} + end + + def test_float_ivar_self + o1 = 5.5 + o1.instance_eval { @iv = o1 } + marshal_equal(o1) {|o| o.instance_eval { @iv }} + end + + def test_float_extend + o1 = 0.0/0.0 + o1.extend(Mod1) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + o1.extend(Mod2) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + end + + class MyRange < Range; def initialize(v, *args) super(*args); @v = v; end end + def test_range + marshal_equal(1..2) + marshal_equal(1...3) + end + + def test_range_subclass + marshal_equal(MyRange.new(4,5,8, false)) + end + + class MyRegexp < Regexp; def initialize(v, *args) super(*args); @v = v; end end + def test_regexp + marshal_equal(/a/) + marshal_equal(/A/i) + marshal_equal(/A/mx) + end + + def test_regexp_subclass + marshal_equal(MyRegexp.new(10, "a")) + end + + class MyString < String; def initialize(v, *args) super(*args); @v = v; end end + def test_string + marshal_equal("abc") + end + + def test_string_ivar + o1 = "" + o1.instance_eval { @iv = 1 } + marshal_equal(o1) {|o| o.instance_eval { @iv }} + end + + def test_string_subclass + marshal_equal(MyString.new(10, "a")) + end + + def test_string_subclass_cycle + str = MyString.new(10, "b") + str.instance_eval { @v = str } + marshal_equal(str) { |o| + assert_equal(o.__id__, o.instance_eval { @v }.__id__) + o.instance_eval { @v } + } + end + + def test_string_subclass_extend + o = "abc" + o.extend(Mod1) + str = MyString.new(o, "c") + marshal_equal(str) { |o| + assert(o.instance_eval { @v }).kind_of?(Mod1) + } + end + + MyStruct = Struct.new("MyStruct", :a, :b) + if RUBY_VERSION < "1.8.0" + # Struct#== is not defined in ruby/1.6 + class MyStruct + def ==(rhs) + return true if __id__ == rhs.__id__ + return false unless rhs.is_a?(::Struct) + return false if self.class != rhs.class + members.each do |member| + return false if self.__send__(member) != rhs.__send__(member) + end + return true + end + end + end + class MySubStruct < MyStruct; def initialize(v, *args) super(*args); @v = v; end end + def test_struct + marshal_equal(MyStruct.new(1,2)) + end + + def test_struct_subclass + if RUBY_VERSION < "1.8.0" + # Substruct instance cannot be dumped in ruby/1.6 + # ::Marshal.dump(MySubStruct.new(10, 1, 2)) #=> uninitialized struct + return false + end + marshal_equal(MySubStruct.new(10,1,2)) + end + + def test_struct_ivar + o1 = MyStruct.new + o1.instance_eval { @iv = 1 } + marshal_equal(o1) {|o| o.instance_eval { @iv }} + end + + def test_struct_subclass_extend + o1 = MyStruct.new + o1.extend(Mod1) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + o1.extend(Mod2) + marshal_equal(o1) { |o| + (class << self; self; end).ancestors + } + end + + def test_symbol + marshal_equal(:a) + marshal_equal(:a?) + marshal_equal(:a!) + marshal_equal(:a=) + marshal_equal(:|) + marshal_equal(:^) + marshal_equal(:&) + marshal_equal(:<=>) + marshal_equal(:==) + marshal_equal(:===) + marshal_equal(:=~) + marshal_equal(:>) + marshal_equal(:>=) + marshal_equal(:<) + marshal_equal(:<=) + marshal_equal(:<<) + marshal_equal(:>>) + marshal_equal(:+) + marshal_equal(:-) + marshal_equal(:*) + marshal_equal(:/) + marshal_equal(:%) + marshal_equal(:**) + marshal_equal(:~) + marshal_equal(:+@) + marshal_equal(:-@) + marshal_equal(:[]) + marshal_equal(:[]=) + marshal_equal(:`) #` + marshal_equal("a b".intern) + end + + class MyTime < Time; def initialize(v, *args) super(*args); @v = v; end end + def test_time + # once there was a bug caused by usec overflow. try a little harder. + 10.times do + t = Time.now + marshal_equal(t, t.usec.to_s) + end + end + + def test_time_subclass + marshal_equal(MyTime.new(10)) + end + + def test_time_ivar + o1 = Time.now + o1.instance_eval { @iv = 1 } + marshal_equal(o1) {|o| o.instance_eval { @iv }} + end + + def test_true + marshal_equal(true) + end + + def test_nil + marshal_equal(nil) + end + + def test_share + o = [:share] + o1 = [o, o] + o2 = marshaltest(o1) + assert_same(o2.first, o2.last) + end + + class CyclicRange < Range + def <=>(other); true; end + end + def test_range_cyclic + return unless CyclicRange.respond_to?(:allocate) # test for 1.8 + o1 = CyclicRange.allocate + o1.instance_eval { initialize(o1, o1) } + o2 = marshaltest(o1) + assert_same(o2, o2.begin) + assert_same(o2, o2.end) + end + + def test_singleton + o = Object.new + def o.m() end + assert_raises(TypeError) { marshaltest(o) } + o = Object.new + c = class << o + @v = 1 + class C; self; end + end + assert_raises(TypeError) { marshaltest(o) } + assert_raises(TypeError) { marshaltest(c) } + assert_raises(TypeError) { marshaltest(ARGF) } + assert_raises(TypeError) { marshaltest(ENV) } + end + + def test_extend + o = Object.new + o.extend Mod1 + marshal_equal(o) { |obj| obj.kind_of? Mod1 } + o = Object.new + o.extend Mod1 + o.extend Mod2 + marshal_equal(o) {|obj| class << obj; ancestors end} + o = Object.new + o.extend Module.new + assert_raises(TypeError) { marshaltest(o) } + end + + def test_extend_string + o = "" + o.extend Mod1 + marshal_equal(o) { |obj| obj.kind_of? Mod1 } + o = "" + o.extend Mod1 + o.extend Mod2 + marshal_equal(o) {|obj| class << obj; ancestors end} + o = "" + o.extend Module.new + assert_raises(TypeError) { marshaltest(o) } + end + + def test_anonymous + c = Class.new + assert_raises(TypeError) { marshaltest(c) } + o = c.new + assert_raises(TypeError) { marshaltest(o) } + m = Module.new + assert_raises(TypeError) { marshaltest(m) } + end + + def test_string_empty + marshal_equal("") + end + + def test_string_crlf + marshal_equal("\r\n") + end + + def test_string_escape + marshal_equal("<;;>&\r'\";;>") + end + + MyStruct2 = Struct.new(:a, :b) + if RUBY_VERSION < "1.8.0" + # Struct#== is not defined in ruby/1.6 + class MyStruct2 + def ==(rhs) + return true if __id__ == rhs.__id__ + return false unless rhs.is_a?(::Struct) + return false if self.class != rhs.class + members.each do |member| + return false if self.__send__(member) != rhs.__send__(member) + end + return true + end + end + end + def test_struct_toplevel + o = MyStruct2.new(1,2) + marshal_equal(o) + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/marshal/test_digraph.rb b/vendor/gems/soap4r-1.5.8/test/soap/marshal/test_digraph.rb new file mode 100644 index 00000000..d7f30654 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/marshal/test_digraph.rb @@ -0,0 +1,56 @@ +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/vendor/gems/soap4r-1.5.8/test/soap/marshal/test_marshal.rb b/vendor/gems/soap4r-1.5.8/test/soap/marshal/test_marshal.rb new file mode 100644 index 00000000..d8f900cb --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/marshal/test_marshal.rb @@ -0,0 +1,26 @@ +require 'test/unit' +require 'soap/marshal' +require File.join(File.dirname(File.expand_path(__FILE__)), 'marshaltestlib') + + +if RUBY_VERSION > "1.7.0" + + +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 + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/marshal/test_struct.rb b/vendor/gems/soap4r-1.5.8/test/soap/marshal/test_struct.rb new file mode 100644 index 00000000..33975c31 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/marshal/test_struct.rb @@ -0,0 +1,47 @@ +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/vendor/gems/soap4r-1.5.8/test/soap/ssl/README b/vendor/gems/soap4r-1.5.8/test/soap/ssl/README new file mode 100644 index 00000000..927c738f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/ssl/README @@ -0,0 +1 @@ +* certificates and keys in this directory is copied from httpclient test. diff --git a/vendor/gems/soap4r-1.5.8/test/soap/ssl/ca.cert b/vendor/gems/soap4r-1.5.8/test/soap/ssl/ca.cert new file mode 100644 index 00000000..bcabbee4 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/ssl/ca.cert @@ -0,0 +1,23 @@ +-----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/vendor/gems/soap4r-1.5.8/test/soap/ssl/client.cert b/vendor/gems/soap4r-1.5.8/test/soap/ssl/client.cert new file mode 100644 index 00000000..ad13c4b7 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/ssl/client.cert @@ -0,0 +1,19 @@ +-----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/vendor/gems/soap4r-1.5.8/test/soap/ssl/client.key b/vendor/gems/soap4r-1.5.8/test/soap/ssl/client.key new file mode 100644 index 00000000..37bc62f2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/ssl/client.key @@ -0,0 +1,15 @@ +-----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/vendor/gems/soap4r-1.5.8/test/soap/ssl/server.cert b/vendor/gems/soap4r-1.5.8/test/soap/ssl/server.cert new file mode 100644 index 00000000..998ccc58 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/ssl/server.cert @@ -0,0 +1,19 @@ +-----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/vendor/gems/soap4r-1.5.8/test/soap/ssl/server.key b/vendor/gems/soap4r-1.5.8/test/soap/ssl/server.key new file mode 100644 index 00000000..9ba2218a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/ssl/server.key @@ -0,0 +1,15 @@ +-----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/vendor/gems/soap4r-1.5.8/test/soap/ssl/sslsvr.rb b/vendor/gems/soap4r-1.5.8/test/soap/ssl/sslsvr.rb new file mode 100644 index 00000000..4f67eb94 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/ssl/sslsvr.rb @@ -0,0 +1,57 @@ +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/vendor/gems/soap4r-1.5.8/test/soap/ssl/subca.cert b/vendor/gems/soap4r-1.5.8/test/soap/ssl/subca.cert new file mode 100644 index 00000000..1e471851 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/ssl/subca.cert @@ -0,0 +1,21 @@ +-----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/vendor/gems/soap4r-1.5.8/test/soap/ssl/test_ssl.rb b/vendor/gems/soap4r-1.5.8/test/soap/ssl/test_ssl.rb new file mode 100644 index 00000000..8da4e5ef --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/ssl/test_ssl.rb @@ -0,0 +1,235 @@ +require 'test/unit' +begin + require 'httpclient' +rescue LoadError +end +require 'soap/rpc/driver' + +if defined?(HTTPClient) 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( + Config::CONFIG["bindir"], + Config::CONFIG["ruby_install_name"] + Config::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:+SSLv2:@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 + begin + @verify_callback_called = false + @client.hello_world("ssl client") + assert(false) + rescue OpenSSL::SSL::SSLError => ssle + assert(/certificate verify failed/ =~ ssle.message) + assert(@verify_callback_called) + end + # + 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 + begin + @client.hello_world("ssl client") + assert(false) + rescue OpenSSL::SSL::SSLError => ssle + assert(/certificate verify failed/ =~ ssle.message) + assert(@verify_callback_called) + end + # + cfg["protocol.http.ssl_config.ca_file"] = File.join(DIR, "ca.cert") + @verify_callback_called = false + begin + @client.hello_world("ssl client") + assert(false) + rescue OpenSSL::SSL::SSLError => ssle + assert(/certificate verify failed/ =~ ssle.message) + assert(@verify_callback_called) + end + # + 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 + begin + @client.hello_world("ssl client") + assert(false) + rescue OpenSSL::SSL::SSLError => ssle + assert(/certificate verify failed/ =~ ssle.message) + assert(@verify_callback_called) + end + # + 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 + begin + @client.hello_world("ssl client") + assert(false) + rescue OpenSSL::SSL::SSLError => ssle + assert(/certificate verify failed/ =~ ssle.message) + end + # + 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 + begin + @client.hello_world("ssl client") + assert(false) + rescue OpenSSL::SSL::SSLError => ssle + assert(/certificate verify failed/ =~ ssle.message) + assert(@verify_callback_called) + end + # NG with Integer + @client.options["protocol.http.ssl_config.verify_depth"] = 0 + begin + @client.hello_world("ssl client") + assert(false) + rescue OpenSSL::SSL::SSLError => ssle + assert(/certificate verify failed/ =~ ssle.message) + assert(@verify_callback_called) + end + # 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" + # + begin + @client.hello_world("ssl client") + assert(false) + rescue OpenSSL::SSL::SSLError => ssle + # 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) + end + # + 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 << 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/vendor/gems/soap4r-1.5.8/test/soap/struct/test_struct.rb b/vendor/gems/soap4r-1.5.8/test/soap/struct/test_struct.rb new file mode 100644 index 00000000..2363ba3c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/struct/test_struct.rb @@ -0,0 +1,70 @@ +require 'test/unit' +require 'soap/rpc/httpserver' +require 'soap/rpc/driver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +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 = TestUtil.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 if @server + teardown_client if @client + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def teardown_client + @client.reset_stream + 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/vendor/gems/soap4r-1.5.8/test/soap/styleuse/client.rb b/vendor/gems/soap4r-1.5.8/test/soap/styleuse/client.rb new file mode 100644 index 00000000..57fe569b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/styleuse/client.rb @@ -0,0 +1,20 @@ +require 'soap/rpc/driver' + +server = 'http://localhost:7000/' + +app = SOAP::RPC::Driver.new(server, 'urn:styleuse') +app.add_rpc_method('rpc_serv', 'obj1', 'obj2') +app.add_document_method('doc_serv', 'urn:doc_serv#doc_serv', + [XSD::QName.new('urn:styleuse', 'req')], + [XSD::QName.new('urn:styleuse', 'res')]) +app.add_document_method('doc_serv2', 'urn:doc_serv#doc_serv2', + [XSD::QName.new('urn:styleuse', 'req')], + [XSD::QName.new('urn:styleuse', 'res')]) +app.wiredump_dev = STDOUT + +p app.rpc_serv(true, false) +p app.rpc_serv("foo", "bar") +p app.doc_serv({"a" => "2"}) +p app.doc_serv({"a" => {"b" => "2"}}) +p app.doc_serv2({"a" => "2"}) +p app.doc_serv2({"a" => {"b" => "2"}}) diff --git a/vendor/gems/soap4r-1.5.8/test/soap/styleuse/server.rb b/vendor/gems/soap4r-1.5.8/test/soap/styleuse/server.rb new file mode 100644 index 00000000..6e61c41b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/styleuse/server.rb @@ -0,0 +1,86 @@ +#!/usr/bin/env ruby + +require 'soap/rpc/standaloneServer' + +class Server < SOAP::RPC::StandaloneServer + class RpcServant + def rpc_serv(obj1, obj2) + [obj1, obj2] + end + end + + class DocumentServant + def doc_serv(hash) + hash + end + + def doc_serv2(hash) + { 'newroot' => hash } + end + end + + class GenericServant + + # method name style: requeststyle_requestuse_responsestyle_responseuse + + def rpc_enc_rpc_enc(obj1, obj2) + [obj1, obj2] + end + + alias rpc_enc_rpc_lit rpc_enc_rpc_enc + + def rpc_enc_doc_enc(obj1, obj2) + obj1 + end + + alias rpc_enc_doc_lit rpc_enc_doc_enc + + def doc_enc_rpc_enc(obj) + [obj, obj] + end + + alias doc_enc_rpc_lit doc_enc_rpc_enc + + def doc_enc_doc_enc(obj) + obj + end + + alias doc_enc_doc_lit doc_enc_doc_enc + end + + def initialize(*arg) + super + rpcservant = RpcServant.new + docservant = DocumentServant.new + add_rpc_servant(rpcservant) + add_document_method(docservant, 'urn:doc_serv#doc_serv', 'doc_serv', + [XSD::QName.new('urn:styleuse', 'req')], + [XSD::QName.new('urn:styleuse', 'res')]) + add_document_method(docservant, 'urn:doc_serv#doc_serv2', 'doc_serv2', + [XSD::QName.new('urn:styleuse', 'req')], + [XSD::QName.new('urn:styleuse', 'res')]) + + #servant = Servant.new + # ToDo: too plain: should add bare test case + #qname ||= XSD::QName.new(@default_namespace, name) + #add_operation(qname, nil, servant, "rpc_enc_rpc_enc", param_def, + # opt(:rpc, :rpc, :encoded, :encoded)) + end + + def 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 +end + +if $0 == __FILE__ + server = Server.new('Server', 'urn:styleuse', '0.0.0.0', 7000) + trap(:INT) do + server.shutdown + end + server.start +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/swa/test_file.rb b/vendor/gems/soap4r-1.5.8/test/soap/swa/test_file.rb new file mode 100644 index 00000000..09dd91a3 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/swa/test_file.rb @@ -0,0 +1,75 @@ +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 if @server + if @t + @t.kill + @t.join + end + @client.reset_stream if @client + 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/vendor/gems/soap4r-1.5.8/test/soap/test_basetype.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_basetype.rb new file mode 100644 index 00000000..5a420aab --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_basetype.rb @@ -0,0 +1,1090 @@ +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) + back = XSD::XSDString.strict_ces_validation + XSD::XSDString.strict_ces_validation = true + begin + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPString.new("\0") + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPString.new("\xC0\xC0").to_s + end + ensure + XSD::XSDString.strict_ces_validation = back + end + end + + def test_SOAPNormalizedString + XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_encoding = "NONE" } + begin + o = SOAP::SOAPNormalizedString.new + assert_equal(XSD::Namespace, o.type.namespace) + assert_equal(XSD::NormalizedStringLiteral, o.type.name) + assert_equal(nil, o.data) + assert_equal(true, o.is_nil) + + str = "abc" + assert_equal(str, SOAP::SOAPNormalizedString.new(str).data) + assert_equal(str, SOAP::SOAPNormalizedString.new(str).to_s) + back = SOAP::SOAPString.strict_ces_validation + SOAP::SOAPString.strict_ces_validation = true + begin + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPNormalizedString.new("\0") + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPNormalizedString.new("\xC0\xC0").to_s + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPNormalizedString.new("a\tb").to_s + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPNormalizedString.new("a\r").to_s + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPNormalizedString.new("\nb").to_s + end + ensure + SOAP::SOAPString.strict_ces_validation = back + end + ensure + XSD::Charset.module_eval { @internal_encoding = @encoding_backup } + end + end + + def test_SOAPToken + XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_encoding = "NONE" } + begin + o = SOAP::SOAPToken.new + assert_equal(XSD::Namespace, o.type.namespace) + assert_equal(XSD::TokenLiteral, o.type.name) + assert_equal(nil, o.data) + assert_equal(true, o.is_nil) + + str = "abc" + assert_equal(str, SOAP::SOAPToken.new(str).data) + assert_equal(str, SOAP::SOAPToken.new(str).to_s) + back = XSD::XSDString.strict_ces_validation + XSD::XSDString.strict_ces_validation = true + begin + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPToken.new("\0") + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPToken.new("\xC0\xC0").to_s + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPToken.new("a\tb").to_s + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPToken.new("a\r").to_s + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPToken.new("\nb").to_s + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPToken.new(" a").to_s + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPToken.new("b ").to_s + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPToken.new("a b").to_s + end + assert_equal("a b", SOAP::SOAPToken.new("a b").data) + ensure + XSD::XSDString.strict_ces_validation = back + end + ensure + XSD::Charset.module_eval { @internal_encoding = @encoding_backup } + end + end + + def test_SOAPLanguage + o = SOAP::SOAPLanguage.new + assert_equal(XSD::Namespace, o.type.namespace) + assert_equal(XSD::LanguageLiteral, o.type.name) + assert_equal(nil, o.data) + assert_equal(true, o.is_nil) + + str = "ja" + assert_equal(str, SOAP::SOAPLanguage.new(str).data) + assert_equal(str, SOAP::SOAPLanguage.new(str).to_s) + str = "ja-jp" + assert_equal(str, SOAP::SOAPLanguage.new(str).data) + assert_equal(str, SOAP::SOAPLanguage.new(str).to_s) + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPLanguage.new("ja-jp-") + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPLanguage.new("-ja-") + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPLanguage.new("ja-") + end + assert_raises(XSD::ValueSpaceError) do + SOAP::SOAPLanguage.new("a1-01") + end + assert_equal("aA-01", SOAP::SOAPLanguage.new("aA-01").to_s) + 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", + "PT3456H7890M1234.5678S", + "P1234Y5678M9012D", + "-P1234Y5678M9012DT3456H7890M1234.5678S", + "P5678M9012DT3456H7890M1234.5678S", + "-P1234Y9012DT3456H7890M1234.5678S", + "+P1234Y5678MT3456H7890M1234.5678S", + "P1234Y5678M9012DT7890M1234.5678S", + "-P1234Y5678M9012DT3456H1234.5678S", + "+P1234Y5678M9012DT3456H7890M", + "P123400000000000Y", + "-P567800000000000M", + "+P901200000000000D", + "PT345600000000000H", + "-PT789000000000000M", + "+PT123400000000000.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/vendor/gems/soap4r-1.5.8/test/soap/test_cookie.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_cookie.rb new file mode 100644 index 00000000..eae956b3 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_cookie.rb @@ -0,0 +1,112 @@ +require 'test/unit' +require 'soap/rpc/driver' +require 'webrick' +require 'logger' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', 'testutil.rb') + + +module SOAP + + +class TestCookie < Test::Unit::TestCase + Port = 17171 + + class CookieFilter < SOAP::Filter::StreamHandler + attr_accessor :cookie_value + + def initialize + @cookie_value = nil + end + + def on_http_outbound(req) + if @cookie_value + req.header.delete('Cookie') + req.header['Cookie'] = @cookie_value + end + end + + def on_http_inbound(req, res) + # this sample filter only caputures the first cookie. + cookie = res.header['Set-Cookie'][0] + cookie.sub!(/;.*\z/, '') if cookie + @cookie_value = cookie + # do not save cookie value. + end + end + + 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 if @client + teardown_server if @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 = TestUtil.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 do_server_proc(req, res) + cookie = req['Cookie'].to_s + cookie = "var=hello world" if cookie.empty? + res['content-type'] = 'text/xml' + res['Set-Cookie'] = cookie + res.body = <<__EOX__ + + + + + + + + +__EOX__ + end + + def test_normal + @client.wiredump_dev = STDOUT if $DEBUG + filter = CookieFilter.new + @client.streamhandler.filterchain << filter + assert_nil(@client.do_server_proc) + assert_equal('var=hello world', filter.cookie_value) + filter.cookie_value = 'var=empty' + assert_nil(@client.do_server_proc) + assert_equal('var=empty', filter.cookie_value) + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_custom_ns.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_custom_ns.rb new file mode 100644 index 00000000..51cadc64 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_custom_ns.rb @@ -0,0 +1,105 @@ +require 'test/unit' +require 'soap/processor' + + +module SOAP + + +class TestCustomNs < Test::Unit::TestCase + NORMAL_XML = <<__XML__.chomp + + + + hi + + + bi + + +__XML__ + + CUSTOM_NS_XML = <<__XML__.chomp + + + + hi + + + bi + + +__XML__ + + XML_WITH_DEFAULT_NS = <<__XML__.chomp + + + + hi + + + bi + + +__XML__ + + def test_custom_ns + # create test env + header = SOAP::SOAPHeader.new() + hi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "headeritem"), 'hi') + header.add("test", hi) + body = SOAP::SOAPBody.new() + bi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "bodyitem"), 'bi') + bi.extraattr[XSD::QName.new('my:bar', 'baz')] = 'qux' + body.add("test", bi) + env = SOAP::SOAPEnvelope.new(header, body) + # normal + opt = {} + result = SOAP::Processor.marshal(env, opt) + assert_equal(NORMAL_XML, result) + # Envelope ns customize + env = SOAP::SOAPEnvelope.new(header, body) + ns = XSD::NS.new + ns.assign(SOAP::EnvelopeNamespace, 'ENV') + ns.assign('my:foo', 'myns') + # tag customize + tag = XSD::NS.new + tag.assign('my:bar', 'bar') + opt = { :default_ns => ns, :default_ns_tag => tag } + result = SOAP::Processor.marshal(env, opt) + assert_equal(CUSTOM_NS_XML, result) + end + + def test_default_namespace + # create test env + header = SOAP::SOAPHeader.new() + hi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "headeritem"), 'hi') + header.add("test", hi) + body = SOAP::SOAPBody.new() + bi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "bodyitem"), 'bi') + bi.extraattr[XSD::QName.new('my:bar', 'baz')] = 'qux' + bi.extraattr[XSD::QName.new('my:foo', 'quxx')] = 'quxxx' + body.add("test", bi) + env = SOAP::SOAPEnvelope.new(header, body) + # normal + opt = {:use_default_namespace => true} + result = SOAP::Processor.marshal(env, opt) + assert_equal(XML_WITH_DEFAULT_NS, result) + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_custommap.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_custommap.rb new file mode 100644 index 00000000..c17407c5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_custommap.rb @@ -0,0 +1,110 @@ +require 'test/unit' +require 'soap/marshal' +require 'soap/rpc/standaloneServer' +require 'soap/rpc/driver' + + +module SOAP + + +class TestMap < Test::Unit::TestCase + + class CustomHashFactory < SOAP::Mapping::Factory + def initialize(itemname) + @itemname = itemname + end + + def obj2soap(soap_class, obj, info, map) + soap_obj = SOAP::SOAPStruct.new(SOAP::Mapping::MapQName) + mark_marshalled_obj(obj, soap_obj) + obj.each do |key, value| + elem = SOAP::SOAPStruct.new + elem.add('key', Mapping._obj2soap(key, map)) + elem.add('value', Mapping._obj2soap(value, map)) + soap_obj.add(@itemname, elem) + end + soap_obj + end + + def soap2obj(obj_class, node, info, map) + false + end + end + + Map = SOAP::Mapping::Registry.new + Map.add(Hash, SOAP::SOAPStruct, CustomHashFactory.new('customname')) + + Port = 17171 + + class MapServer < SOAP::RPC::StandaloneServer + def initialize(*arg) + super + add_rpc_method(self, 'echo', 'map') + add_rpc_method(self, 'setmap') + end + + def echo(map) + map + end + + def setmap + self.mapping_registry = Map + nil + end + end + + def setup + @server = MapServer.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('echo', 'map') + @client.add_rpc_method('setmap') + @client.wiredump_dev = STDOUT if $DEBUG + end + + def teardown + @server.shutdown if @server + if @t + @t.kill + @t.join + end + @client.reset_stream if @client + end + + def test_map + h = {'a' => 1, 'b' => 2} + soap = SOAP::Marshal.marshal(h) + puts soap if $DEBUG + obj = SOAP::Marshal.unmarshal(soap) + assert_equal(h, obj) + # + soap = SOAP::Marshal.marshal(h, Map) + puts soap if $DEBUG + obj = SOAP::Marshal.unmarshal(soap, Map) + assert_equal(h, obj) + end + + def test_rpc + h = {'a' => 1, 'b' => 2} + @client.wiredump_dev = str = '' + assert_equal(h, @client.echo(h)) + assert_equal(0, str.scan(/customname/).size) + # + @client.setmap + @client.wiredump_dev = str = '' + assert_equal(h, @client.echo(h)) + assert_equal(4, str.scan(/customname/).size) + # + @client.mapping_registry = Map + @client.wiredump_dev = str = '' + assert_equal(h, @client.echo(h)) + assert_equal(8, str.scan(/customname/).size) + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_empty.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_empty.rb new file mode 100644 index 00000000..fd8c2d0f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_empty.rb @@ -0,0 +1,105 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'soap/rpc/driver' +require 'soap/header/handler' + + +module SOAP + + +class TestEmpty < Test::Unit::TestCase + Port = 17171 + + class EmptyHeaderHandler < SOAP::Header::Handler + def on_outbound(header) + # dump Header even if no header item given. + header.force_encode = true + # no additional header item + nil + end + end + + class NopServer < SOAP::RPC::StandaloneServer + def initialize(*arg) + super + add_document_method(self, 'urn:empty:nop', 'nop', [], []) + add_document_method(self, 'urn:empty:nop', 'nop_nil', nil, nil) + end + + def nop + [1, 2, 3] # ignored + end + + def nop_nil + [1, 2, 3] # ignored + 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_document_method('nop', 'urn:empty:nop', [], []) + @client.add_document_method('nop_nil', 'urn:empty:nop', nil, nil) + end + + def teardown + @server.shutdown if @server + if @t + @t.kill + @t.join + end + @client.reset_stream if @client + end + + EMPTY_XML = %q[ + + +] + + EMPTY_HEADER_XML = %q[ + + + +] + + def test_nop + @client.wiredump_dev = str = '' + @client.nop + assert_equal(EMPTY_XML, parse_requestxml(str)) + assert_equal(EMPTY_XML, parse_responsexml(str)) + end + + def test_nop_nil + @client.wiredump_dev = str = '' + @client.nop_nil + assert_equal(EMPTY_XML, parse_requestxml(str)) + assert_equal(EMPTY_XML, parse_responsexml(str)) + end + + def test_empty_header + @client.headerhandler << EmptyHeaderHandler.new(nil) + @client.wiredump_dev = str = '' + @client.nop + assert_equal(EMPTY_HEADER_XML, parse_requestxml(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 diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_envelopenamespace.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_envelopenamespace.rb new file mode 100644 index 00000000..cd39c1a2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_envelopenamespace.rb @@ -0,0 +1,85 @@ +require 'test/unit' +require 'soap/rpc/driver' +require 'webrick' +require 'logger' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', 'testutil.rb') + + +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 if @client + teardown_server if @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 = TestUtil.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 do_server_proc(req, res) + res['content-type'] = 'text/xml' + res.body = <<__EOX__ + + + + + hello world + + + +__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/vendor/gems/soap4r-1.5.8/test/soap/test_extraattr.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_extraattr.rb new file mode 100644 index 00000000..d0812907 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_extraattr.rb @@ -0,0 +1,54 @@ +require 'test/unit' +require 'soap/processor' + + +module SOAP + + +class TestExtrAttr < Test::Unit::TestCase + + HEADER_XML = %q[ + + + + + + + +] + + def test_extraattr + header = SOAP::SOAPHeader.new() + header.extraattr["Id"] = "extraattr" + hi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "headeritem")) + hi.extraattr["Id"] = "extraattr" + header.add("test", hi) + body = SOAP::SOAPBody.new() + body.extraattr["Id"] = "extraattr<>" + bi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "bodyitem")) + bi.extraattr["Id"] = "extraattr" + body.add("test", bi) + env = SOAP::SOAPEnvelope.new(header, body) + env.extraattr["Id"] = "extraattr" + g = SOAP::Generator.new() + xml = g.generate(env) + assert_equal(HEADER_XML, xml) + # + parser = SOAP::Parser.new + env = parser.parse(xml) + header = env.header + body = env.body + assert_equal("extraattr", env.extraattr[XSD::QName.new(nil, "Id")]) + assert_equal("extraattr", header.extraattr[XSD::QName.new(nil, "Id")]) + assert_equal("extraattr<>", body.extraattr[XSD::QName.new(nil, "Id")]) + assert_equal("extraattr", header["headeritem"].element.extraattr[XSD::QName.new(nil, "Id")]) + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_generator.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_generator.rb new file mode 100644 index 00000000..975b2dd6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_generator.rb @@ -0,0 +1,27 @@ +require 'test/unit' +require 'soap/processor' + + +module SOAP + + +class TestGenerator < Test::Unit::TestCase + # based on #417, reported by Kou. + def test_encode + str = "\343\201\217<" + g = SOAP::Generator.new + g.generate(SOAPElement.new('foo')) + assert_equal("<", g.encode_string(str)[-4, 4]) + # + begin + kc_backup = $KCODE.dup + $KCODE = 'EUC-JP' + assert_equal("<", g.encode_string(str)[-4, 4]) + ensure + $KCODE = kc_backup + end + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_httpconfigloader.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_httpconfigloader.rb new file mode 100644 index 00000000..d3ca8bd5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_httpconfigloader.rb @@ -0,0 +1,71 @@ +require 'test/unit' +require 'soap/httpconfigloader' +require 'soap/rpc/driver' + +if defined?(HTTPClient) + +module SOAP + + +class TestHTTPConfigLoader < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + + def setup + @client = SOAP::RPC::Driver.new(nil, nil) + end + + class Request + class Header + attr_reader :request_uri + def initialize(request_uri) + @request_uri = request_uri + end + end + + attr_reader :header + def initialize(request_uri) + @header = Header.new(request_uri) + end + end + + def test_property + testpropertyname = File.join(DIR, 'soapclient.properties') + File.open(testpropertyname, "w") do |f| + f <<<<__EOP__ +protocol.http.proxy = http://myproxy:8080 +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 +protocol.http.basic_auth.1.url = http://www.example.com/foo1/ +protocol.http.basic_auth.1.userid = user1 +protocol.http.basic_auth.1.password = password1 +protocol.http.basic_auth.2.url = http://www.example.com/foo2/ +protocol.http.basic_auth.2.userid = user2 +protocol.http.basic_auth.2.password = password2 +__EOP__ + end + begin + @client.loadproperty(testpropertyname) + assert_equal('ALL', @client.options['protocol.http.ssl_config.ciphers']) + @client.options['protocol.http.basic_auth'] << + ['http://www.example.com/foo3/', 'user3', 'password3'] + h = @client.streamhandler.client + basic_auth = h.www_auth.basic_auth + cred1 = ["user1:password1"].pack('m').tr("\n", '') + cred2 = ["user2:password2"].pack('m').tr("\n", '') + cred3 = ["user3:password3"].pack('m').tr("\n", '') + basic_auth.challenge(URI.parse("http://www.example.com/"), nil) + assert_equal(cred1, basic_auth.get(Request.new(URI.parse("http://www.example.com/foo1/baz")))) + assert_equal(cred2, basic_auth.get(Request.new(URI.parse("http://www.example.com/foo2/")))) + assert_equal(cred3, basic_auth.get(Request.new(URI.parse("http://www.example.com/foo3/baz/qux")))) + ensure + File.unlink(testpropertyname) + end + end +end + + +end + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_mapping.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_mapping.rb new file mode 100644 index 00000000..e41be7ac --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_mapping.rb @@ -0,0 +1,131 @@ +require 'test/unit' +require 'soap/mapping' +require 'soap/marshal' + + +module SOAP + + +class TestMapping < Test::Unit::TestCase + + class MappablePerson + attr_reader :name + attr_reader :age + + def initialize(name, age) + @name, @age = name, age + end + + def self.soap_marshallable + true + end + end + + class UnmappablePerson + attr_reader :name + attr_reader :age + + def initialize(name, age) + @name, @age = name, age + end + + def self.soap_marshallable + false + end + end + + def test_mappable + xml = <<__XML__ + + + + + nahi + 37 + + + +__XML__ + obj = SOAP::Marshal.load(xml) + assert_equal(SOAP::TestMapping::MappablePerson, obj.class) + # + xml = <<__XML__ + + + + + nahi + 37 + + + +__XML__ + obj = SOAP::Marshal.load(xml) + assert_equal(SOAP::Mapping::Object, obj.class) + end + + def test_nestedexception + ele = Thread.new {} + obj = [ele] + begin + SOAP::Marshal.dump(obj) + rescue ::SOAP::Mapping::MappingError => e + assert(e.backtrace.find { |line| /\[NESTED\]/ =~ line }) + end + end + + 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/vendor/gems/soap4r-1.5.8/test/soap/test_nestedexception.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_nestedexception.rb new file mode 100644 index 00000000..2bd65411 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_nestedexception.rb @@ -0,0 +1,56 @@ +require 'test/unit' +require 'soap/soap' + + +module SOAP + + +class TestNestedException < Test::Unit::TestCase + class MyError < SOAP::Error; end + + def foo + begin + bar + rescue + raise MyError.new("foo", $!) + end + end + + def bar + begin + baz + rescue + raise MyError.new("bar", $!) + end + end + + def baz + raise MyError.new("baz", $!) + end + + def test_nestedexception + begin + foo + rescue MyError => e + trace = e.backtrace.find_all { |line| /test\/unit/ !~ line && /\d\z/ !~ line } + trace = trace.map { |line| line.sub(/\A[^:]*/, '') } + assert_equal(TOBE, trace) + end + end + + TOBE = [ + ":15:in `foo'", + ":33:in `test_nestedexception'", + ":23:in `bar': bar (SOAP::TestNestedException::MyError) [NESTED]", + ":13:in `foo'", + ":33:in `test_nestedexception'", + ":28:in `baz': baz (SOAP::TestNestedException::MyError) [NESTED]", + ":21:in `bar'", + ":13:in `foo'", + ":33:in `test_nestedexception'", + ] + +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_nil.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_nil.rb new file mode 100644 index 00000000..689c57aa --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_nil.rb @@ -0,0 +1,57 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'soap/rpc/driver' +require 'soap/header/handler' + + +module SOAP + + +class TestNil < Test::Unit::TestCase + Port = 17171 + + class NilServer < SOAP::RPC::StandaloneServer + def initialize(*arg) + super + add_method(self, 'nop') + end + + def nop + 1 + end + end + + def setup + @server = NilServer.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 if @server + if @t + @t.kill + @t.join + end + @client.reset_stream if @client + end + + require 'rexml/document' + # emulates SOAP::Lite's nil request + def test_soaplite_nil + body = SOAP::SOAPBody.new(REXML::Document.new(<<-__XML__)) + + __XML__ + @client.wiredump_dev = STDOUT if $DEBUG + header, body = @client.invoke(nil, body) + assert_equal(1, body.root_node["return"].data) + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_no_indent.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_no_indent.rb new file mode 100644 index 00000000..43d617dd --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_no_indent.rb @@ -0,0 +1,88 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'soap/rpc/driver' + +if defined?(HTTPClient) + +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 if @server + if @t + @t.kill + @t.join + end + @client.reset_stream if @client + end + + INDENT_XML = +%q[ + + + + + +] + + NO_INDENT_XML = +%q[ + + + + + +] + + 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/vendor/gems/soap4r-1.5.8/test/soap/test_property.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_property.rb new file mode 100644 index 00000000..0bd8eb9b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_property.rb @@ -0,0 +1,427 @@ +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 +a.b.3 = 日本語 +a.b.表 = 1表2 +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", prop["a.b.表"]) + assert_equal(["1", "1表2", "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/vendor/gems/soap4r-1.5.8/test/soap/test_response_as_xml.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_response_as_xml.rb new file mode 100644 index 00000000..dcc14973 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_response_as_xml.rb @@ -0,0 +1,117 @@ +require 'test/unit' +require 'soap/rpc/httpserver' +require 'soap/rpc/driver' +require 'rexml/document' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', 'testutil.rb') + + +module SOAP + + +class TestResponseAsXml < Test::Unit::TestCase + Namespace = "urn:example.com:hello" + class Server < ::SOAP::RPC::HTTPServer + def on_init + add_method(self, 'hello', 'name') + end + + def hello(name) + "hello #{name}" + 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 = TestUtil.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('hello', 'name') + @client.add_document_method('hellodoc', Namespace, XSD::QName.new(Namespace, 'helloRequest'), XSD::QName.new(Namespace, 'helloResponse')) + end + + def teardown + teardown_server if @server + teardown_client if @client + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def teardown_client + @client.reset_stream + end + + RESPONSE_AS_XML=<<__XML__.chomp + + + + + hello world + + + +__XML__ + + def test_hello + assert_equal("hello world", @client.hello("world")) + @client.return_response_as_xml = true + xml = @client.hello("world") + assert_equal(RESPONSE_AS_XML, xml, [RESPONSE_AS_XML, xml].join("\n\n")) + doc = REXML::Document.new(@client.hello("world")) + assert_equal("hello world", + REXML::XPath.match(doc, "//*[name()='return']")[0].text) + end + + RESPONSE_CDATA = <<__XML__.chomp + + + + + some html]]> + + + + +__XML__ + def test_cdata + @client.return_response_as_xml = false + @client.test_loopback_response << RESPONSE_CDATA + ret = @client.hellodoc(nil) + assert_equal("\n some html\n ", ret.htmlContent) + # + @client.return_response_as_xml = true + @client.test_loopback_response << RESPONSE_CDATA + xml = @client.hello(nil) + assert_equal(RESPONSE_CDATA, xml) + require 'rexml/document' + doc = REXML::Document.new(xml) + assert_equal("some html", + REXML::XPath.match(doc, "//*[name()='gno:htmlContent']")[0][1].value) + # + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_soapelement.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_soapelement.rb new file mode 100644 index 00000000..165b7d9d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_soapelement.rb @@ -0,0 +1,138 @@ +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"]) + child = d("foo") + obj.add(child) + assert_equal(child, obj["foo"]) + child = d("_?a?b_") + obj.add(child) + assert_equal(child, obj["_?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 + + def test_from_obj_xmlattr + source = { "xmlattr_c1" => "t1", + "ymlattr_c2" => { + XSD::QName.new("urn:foo", "xmlattr_c2") => "t2", + XSD::QName.new("urn:foo", "ymlattr_c3") => "t3" }} + obj = SOAPElement.from_obj(source) + assert_equal("t1", obj.extraattr[XSD::QName.new(nil, "c1")]) + assert_equal("t2", obj["ymlattr_c2"].extraattr[XSD::QName.new("urn:foo", "c2")]) + assert_equal("t3", obj["ymlattr_c2"]["ymlattr_c3"].text) + # + source = { "xmlattr_xmlattr_c1" => "t1", + "xmlele_xmlattr_c2" => { + XSD::QName.new("urn:foo", "xmlele_xmlele_c3") => "t3" }} + obj = SOAPElement.from_obj(source) + assert_equal("t1", obj.extraattr[XSD::QName.new(nil, "xmlattr_c1")]) + assert_equal("t3", obj["xmlattr_c2"]["xmlele_c3"].text) + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_streamhandler.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_streamhandler.rb new file mode 100644 index 00000000..72f15a9c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_streamhandler.rb @@ -0,0 +1,270 @@ +require 'test/unit' +require 'soap/rpc/driver' +require 'webrick' +require 'webrick/httpproxy' +require 'logger' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', 'testutil.rb') + + +module SOAP + + +class TestStreamHandler < Test::Unit::TestCase + Port = 17171 + ProxyPort = 17172 + + def setup + @logger = Logger.new(STDERR) + @logger.level = Logger::Severity::FATAL + @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 if @client + teardown_proxyserver if @proxyserver + teardown_server if @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) + ) + htpasswd = File.join(File.dirname(__FILE__), 'htpasswd') + htpasswd_userdb = WEBrick::HTTPAuth::Htpasswd.new(htpasswd) + @basic_auth = WEBrick::HTTPAuth::BasicAuth.new( + :Logger => @logger, + :Realm => 'auth', + :UserDB => htpasswd_userdb + ) + @server.mount( + '/basic_auth', + WEBrick::HTTPServlet::ProcHandler.new(method(:do_server_proc_basic_auth).to_proc) + ) + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_proxyserver + @proxyserver = WEBrick::HTTPProxyServer.new( + :BindAddress => "0.0.0.0", + :Logger => @logger, + :Port => ProxyPort, + :AccessLog => [] + ) + @proxyserver_thread = TestUtil.start_server_thread(@proxyserver) + end + + def setup_client + @client = SOAP::RPC::Driver.new(@url, '') + @client.add_method("do_server_proc") + @client.add_method("do_server_proc_basic_auth") + 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 do_server_proc(req, res) + res['content-type'] = 'text/xml' + res.body = <<__EOX__ + + + + + + + + +__EOX__ + end + + def do_server_proc_basic_auth(req, res) + @basic_auth.authenticate(req, res) + do_server_proc(req, res) + end + + def parse_req_header(str) + 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?('HTTPClient') + # soap4r + net/http + basic_auth is not supported. + # use httpclient instead. + assert(true) + return + end + @client.endpoint_url = @url + 'basic_auth' + str = "" + @client.wiredump_dev = str + @client.options['protocol.http.basic_auth']['0'] = [@url, "admin", "admin"] + assert_nil(@client.do_server_proc_basic_auth) + @client.options["protocol.http.basic_auth"] << [@url, "admin", "admin"] + assert_nil(@client.do_server_proc_basic_auth) + end + + def test_proxy + if Object.const_defined?('HTTPClient') + backup = HTTPClient::NO_PROXY_HOSTS.dup + HTTPClient::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?('HTTPClient') + HTTPClient::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 + + def test_custom_streamhandler + @client.options["protocol.streamhandler"] = MyStreamHandler + assert_equal("hello", @client.do_server_proc) + @client.options["protocol.streamhandler"] = ::SOAP::HTTPStreamHandler + assert_nil(@client.do_server_proc) + @client.options["protocol.streamhandler"] = MyStreamHandler + assert_equal("hello", @client.do_server_proc) + @client.options["protocol.streamhandler"] = ::SOAP::HTTPStreamHandler + assert_nil(@client.do_server_proc) + end + + class MyStreamHandler < SOAP::StreamHandler + def self.create(options) + new + end + + def send(endpoint_url, conn_data, soapaction = nil, charset = nil) + conn_data.receive_string = %q[ + + + + hello + + +] + conn_data + end + + def reset(endpoint_url = nil) + # nothing to do + end + end + + # not used + class ExternalProcessStreamHandler < SOAP::StreamHandler + def self.create(options) + new + end + + def send(endpoint_url, conn_data, soapaction = nil, charset = nil) + cmd = "cat" # !! + IO.popen(cmd, "w+") do |io| + io.write(conn_data.send_string) + io.close_write + conn_data.receive_string = io.read + end + conn_data + end + + def reset(endpoint_url = nil) + end + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/test_styleuse.rb b/vendor/gems/soap4r-1.5.8/test/soap/test_styleuse.rb new file mode 100644 index 00000000..2f1e616d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/test_styleuse.rb @@ -0,0 +1,326 @@ +require 'test/unit' +require 'soap/rpc/httpserver' +require 'soap/rpc/driver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', 'testutil.rb') + + +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 = TestUtil.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 if @server + teardown_client if @client + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def teardown_client + @client.reset_stream + 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/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/README.txt b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/README.txt new file mode 100644 index 00000000..b4d45a04 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/README.txt @@ -0,0 +1,2 @@ +echo_version.rb is generated by wsdl2ruby.rb; +% wsdl2ruby.rb --wsdl simpletype.wsdl --classdef --force diff --git a/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/calc.wsdl b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/calc.wsdl new file mode 100644 index 00000000..694a01e8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/calc.wsdl @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + calculator service + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/document.wsdl b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/document.wsdl new file mode 100644 index 00000000..5e9e74b9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/document.wsdl @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/echo_version.rb b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/echo_version.rb new file mode 100644 index 00000000..a96179ce --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/echo_version.rb @@ -0,0 +1,29 @@ +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 = [ + ["myversion", ["SOAP::SOAPString", XSD::QName.new(nil, "myversion")]], + ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]] + ] + + attr_accessor :myversion + attr_accessor :msg + + def initialize(myversion = nil, msg = nil) + @myversion = myversion + @msg = msg + end +end + +# {urn:example.com:simpletype-rpc-type}myversions +class Myversions < ::String + @@schema_type = "myversions" + @@schema_ns = "urn:example.com:simpletype-rpc-type" + + C_16 = Myversions.new("1.6") + C_18 = Myversions.new("1.8") + C_19 = Myversions.new("1.9") +end diff --git a/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/simpletype.wsdl b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/simpletype.wsdl new file mode 100644 index 00000000..6781dda5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/simpletype.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/test_calc.rb b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/test_calc.rb new file mode 100644 index 00000000..4a0f8556 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/test_calc.rb @@ -0,0 +1,83 @@ +require 'test/unit' +require 'soap/rpc/httpserver' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +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 = TestUtil.start_server_thread(@server) + end + + def setup_client + @wsdl = File.join(DIR, 'calc.wsdl') + end + + def teardown + teardown_server if @server + teardown_client if @client + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def teardown_client + @client.reset_stream if @client + 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 + TestUtil.silent do + @client = ::SOAP::WSDLDriverFactory.new(@wsdl).create_driver + end + @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/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/test_document.rb b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/test_document.rb new file mode 100644 index 00000000..1c0f26d8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/test_document.rb @@ -0,0 +1,71 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +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 = TestUtil.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 if @server + teardown_client if @client + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def teardown_client + @client.reset_stream + 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/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/test_simpletype.rb b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/test_simpletype.rb new file mode 100644 index 00000000..08b8224c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/soap/wsdlDriver/test_simpletype.rb @@ -0,0 +1,80 @@ +require 'test/unit' +require 'soap/rpc/httpserver' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +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 = TestUtil.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 if @server + teardown_client if @client + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def teardown_client + @client.reset_stream + end + + def test_ping + result = @client.echo_version("1.9") + assert_equal("1.9", result.myversion) + 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/vendor/gems/soap4r-1.5.8/test/testutil.rb b/vendor/gems/soap4r-1.5.8/test/testutil.rb new file mode 100644 index 00000000..8bab07e0 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/testutil.rb @@ -0,0 +1,54 @@ +module TestUtil + # MT-unsafe + def self.require(dir, *features) + begin + # avoid 'already initialized constant FizzBuzz' warning + silent do + Dir.chdir(dir) do + features.each do |feature| + Kernel.require feature + end + end + end + ensure + features.each do |feature| + $".delete(feature) + end + end + end + + # MT-unsafe + def self.silent + if $DEBUG + yield + else + back = $VERBOSE + $VERBOSE = nil + begin + yield + ensure + $VERBOSE = back + end + end + end + + def self.filecompare(expectedfile, actualfile) + expected = loadfile(expectedfile) + actual = loadfile(actualfile) + if expected != actual + raise "#{File.basename(actualfile)} is different from #{File.basename(expectedfile)}" + end + end + + def self.loadfile(file) + File.open(file) { |f| f.read } + end + + def self.start_server_thread(server) + t = Thread.new { + Thread.current.abort_on_exception = true + server.start + } + t + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/abstract/abstract.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/abstract/abstract.wsdl new file mode 100644 index 00000000..4d3a29a3 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/abstract/abstract.wsdl @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/abstract/test_abstract.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/abstract/test_abstract.rb new file mode 100644 index 00000000..80357d3b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/abstract/test_abstract.rb @@ -0,0 +1,159 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module Abstract + + +class TestAbstract < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + def on_init + add_rpc_method(self, 'echo', 'name', 'author') + add_rpc_method(self, 'echoDerived', 'parameter') + add_document_operation( + self, + "", + "echoLiteral", + [ ["in", "author", ["::SOAP::SOAPElement", "urn:www.example.org:abstract", "Author"]], + ["out", "return", ["::SOAP::SOAPElement", "urn:www.example.org:abstract", "Book"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {} } + ) + self.mapping_registry = AbstractMappingRegistry::EncodedRegistry + self.literal_mapping_registry = AbstractMappingRegistry::LiteralRegistry + end + + def echo(name, author) + Book.new(name, author) + end + + def echoLiteral(author) + author + end + + def echoDerived(parameter) + parameter + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('abstract.rb')) + File.unlink(pathname('abstractMappingRegistry.rb')) + File.unlink(pathname('abstractDriver.rb')) + end + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', "urn:www.example.org:abstract", '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("abstract.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'abstractDriver.rb', 'abstract.rb', 'abstractMappingRegistry.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_wsdl + wsdl = File.join(DIR, 'abstract.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.mapping_registry = AbstractMappingRegistry::EncodedRegistry + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDERR if $DEBUG + + author = UserAuthor.new("first", "last", "uid") + ret = @client.echo("book1", author) + assert_equal("book1", ret.name) + assert_equal(author.firstname, ret.author.firstname) + assert_equal(author.lastname, ret.author.lastname) + assert_equal(author.userid, ret.author.userid) + + author = NonUserAuthor.new("first", "last", "nonuserid") + ret = @client.echo("book2", author) + assert_equal("book2", ret.name) + assert_equal(author.firstname, ret.author.firstname) + assert_equal(author.lastname, ret.author.lastname) + assert_equal(author.nonuserid, ret.author.nonuserid) + end + + def test_stub + @client = AbstractService.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDERR if $DEBUG + + author = UserAuthor.new("first", "last", "uid") + ret = @client.echo("book1", author) + assert_equal("book1", ret.name) + assert_equal(author.firstname, ret.author.firstname) + assert_equal(author.lastname, ret.author.lastname) + assert_equal(author.userid, ret.author.userid) + # + author = NonUserAuthor.new("first", "last", "nonuserid") + ret = @client.echo("book2", author) + assert_equal("book2", ret.name) + assert_equal(author.firstname, ret.author.firstname) + assert_equal(author.lastname, ret.author.lastname) + assert_equal(author.nonuserid, ret.author.nonuserid) + end + + def test_literal_stub + @client = AbstractService.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDERR if $DEBUG + author = NonUserAuthor.new("first", "last", "nonuserid") + ret = @client.echoLiteral(author) + assert_equal(author.firstname, ret.firstname) + assert_equal(author.lastname, ret.lastname) + assert_equal(author.nonuserid, ret.nonuserid) + assert_equal(NonUserAuthor, ret.class) + end + + def test_stub_derived + @client = AbstractService.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDERR if $DEBUG + + parameter = DerivedClass1.new(123, "someVar1") + ret = @client.echoDerived(parameter) + assert_equal(123, ret.id) + assert_equal(["someVar1"], ret.someVar1) + assert_equal(DerivedClass1, ret.class) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/expectedClassDef.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/expectedClassDef.rb new file mode 100644 index 00000000..fec47b7b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/expectedClassDef.rb @@ -0,0 +1,128 @@ +require 'xsd/qname' + +module WSDL; module Anonymous + + +# {urn:lp}Header +# header3 - SOAP::SOAPString +class Header + attr_accessor :header3 + + def initialize(header3 = nil) + @header3 = header3 + end +end + +# {urn:lp}ExtraInfo +class ExtraInfo < ::Array + + # {}Entry + # key - SOAP::SOAPString + # value - SOAP::SOAPString + class Entry + attr_accessor :key + attr_accessor :value + + def initialize(key = nil, value = nil) + @key = key + @value = value + end + end +end + +# {urn:lp}loginResponse +# loginResult - WSDL::Anonymous::LoginResponse::LoginResult +class LoginResponse + + # inner class for member: loginResult + # {}loginResult + # sessionID - SOAP::SOAPString + class LoginResult + attr_accessor :sessionID + + def initialize(sessionID = nil) + @sessionID = sessionID + end + end + + attr_accessor :loginResult + + def initialize(loginResult = nil) + @loginResult = loginResult + end +end + +# {urn:lp}Pack +# header - WSDL::Anonymous::Pack::Header +class Pack + + # inner class for member: Header + # {}Header + # header1 - SOAP::SOAPString + class Header + attr_accessor :header1 + + def initialize(header1 = nil) + @header1 = header1 + end + end + + attr_accessor :header + + def initialize(header = nil) + @header = header + end +end + +# {urn:lp}Envelope +# header - WSDL::Anonymous::Envelope::Header +class Envelope + + # inner class for member: Header + # {}Header + # header2 - SOAP::SOAPString + class Header + attr_accessor :header2 + + def initialize(header2 = nil) + @header2 = header2 + end + end + + attr_accessor :header + + def initialize(header = nil) + @header = header + end +end + +# {urn:lp}login +# loginRequest - WSDL::Anonymous::Login::LoginRequest +class Login + + # inner class for member: loginRequest + # {}loginRequest + # username - SOAP::SOAPString + # password - SOAP::SOAPString + # timezone - SOAP::SOAPString + class LoginRequest + attr_accessor :username + attr_accessor :password + attr_accessor :timezone + + def initialize(username = nil, password = nil, timezone = nil) + @username = username + @password = password + @timezone = timezone + end + end + + attr_accessor :loginRequest + + def initialize(loginRequest = nil) + @loginRequest = loginRequest + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/expectedDriver.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/expectedDriver.rb new file mode 100644 index 00000000..7f3451f6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/expectedDriver.rb @@ -0,0 +1,59 @@ +require 'lp.rb' +require 'lpMappingRegistry.rb' +require 'soap/rpc/driver' + +module WSDL::Anonymous + +class Lp_porttype < ::SOAP::RPC::Driver + DefaultEndpointUrl = "http://localhost:17171/" + + Methods = [ + [ "urn:lp:login", + "login", + [ ["in", "parameters", ["::SOAP::SOAPElement", "urn:lp", "login"]], + ["out", "parameters", ["::SOAP::SOAPElement", "urn:lp", "loginResponse"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {} } + ], + [ "urn:lp:echo", + "echo", + [ ["in", "parameters", ["::SOAP::SOAPElement", "urn:lp", "Pack"]], + ["out", "parameters", ["::SOAP::SOAPElement", "urn:lp", "Envelope"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {} } + ] + ] + + def initialize(endpoint_url = nil) + endpoint_url ||= DefaultEndpointUrl + super(endpoint_url, nil) + self.mapping_registry = LpMappingRegistry::EncodedRegistry + self.literal_mapping_registry = LpMappingRegistry::LiteralRegistry + 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 + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/expectedMappingRegistry.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/expectedMappingRegistry.rb new file mode 100644 index 00000000..371fbdf9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/expectedMappingRegistry.rb @@ -0,0 +1,176 @@ +require 'lp.rb' +require 'soap/mapping' + +module WSDL; module Anonymous + +module LpMappingRegistry + EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new + LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new + NsLp = "urn:lp" + + EncodedRegistry.register( + :class => WSDL::Anonymous::Header, + :schema_type => XSD::QName.new(NsLp, "Header"), + :schema_element => [ + ["header3", ["SOAP::SOAPString", XSD::QName.new(nil, "Header3")]] + ] + ) + + EncodedRegistry.register( + :class => WSDL::Anonymous::ExtraInfo, + :schema_type => XSD::QName.new(NsLp, "ExtraInfo"), + :schema_element => [ + ["entry", ["WSDL::Anonymous::ExtraInfo::Entry[]", XSD::QName.new(nil, "Entry")], [1, nil]] + ] + ) + + EncodedRegistry.register( + :class => WSDL::Anonymous::ExtraInfo::Entry, + :schema_name => XSD::QName.new(nil, "Entry"), + :is_anonymous => true, + :schema_qualified => false, + :schema_element => [ + ["key", ["SOAP::SOAPString", XSD::QName.new(nil, "Key")]], + ["value", ["SOAP::SOAPString", XSD::QName.new(nil, "Value")]] + ] + ) + + EncodedRegistry.register( + :class => WSDL::Anonymous::LoginResponse, + :schema_type => XSD::QName.new(NsLp, "loginResponse"), + :schema_element => [ + ["loginResult", ["WSDL::Anonymous::LoginResponse::LoginResult", XSD::QName.new(nil, "loginResult")]] + ] + ) + + EncodedRegistry.register( + :class => WSDL::Anonymous::LoginResponse::LoginResult, + :schema_name => XSD::QName.new(nil, "loginResult"), + :is_anonymous => true, + :schema_qualified => false, + :schema_element => [ + ["sessionID", "SOAP::SOAPString"] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::Header, + :schema_type => XSD::QName.new(NsLp, "Header"), + :schema_element => [ + ["header3", ["SOAP::SOAPString", XSD::QName.new(nil, "Header3")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::ExtraInfo, + :schema_type => XSD::QName.new(NsLp, "ExtraInfo"), + :schema_element => [ + ["entry", ["WSDL::Anonymous::ExtraInfo::Entry[]", XSD::QName.new(nil, "Entry")], [1, nil]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::ExtraInfo::Entry, + :schema_name => XSD::QName.new(nil, "Entry"), + :is_anonymous => true, + :schema_qualified => false, + :schema_element => [ + ["key", ["SOAP::SOAPString", XSD::QName.new(nil, "Key")]], + ["value", ["SOAP::SOAPString", XSD::QName.new(nil, "Value")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::LoginResponse, + :schema_type => XSD::QName.new(NsLp, "loginResponse"), + :schema_element => [ + ["loginResult", ["WSDL::Anonymous::LoginResponse::LoginResult", XSD::QName.new(nil, "loginResult")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::LoginResponse::LoginResult, + :schema_name => XSD::QName.new(nil, "loginResult"), + :is_anonymous => true, + :schema_qualified => false, + :schema_element => [ + ["sessionID", "SOAP::SOAPString"] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::Pack, + :schema_name => XSD::QName.new(NsLp, "Pack"), + :schema_element => [ + ["header", ["WSDL::Anonymous::Pack::Header", XSD::QName.new(nil, "Header")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::Pack::Header, + :schema_name => XSD::QName.new(nil, "Header"), + :is_anonymous => true, + :schema_qualified => false, + :schema_element => [ + ["header1", ["SOAP::SOAPString", XSD::QName.new(nil, "Header1")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::Envelope, + :schema_name => XSD::QName.new(NsLp, "Envelope"), + :schema_element => [ + ["header", ["WSDL::Anonymous::Envelope::Header", XSD::QName.new(nil, "Header")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::Envelope::Header, + :schema_name => XSD::QName.new(nil, "Header"), + :is_anonymous => true, + :schema_qualified => false, + :schema_element => [ + ["header2", ["SOAP::SOAPString", XSD::QName.new(nil, "Header2")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::Login, + :schema_name => XSD::QName.new(NsLp, "login"), + :schema_element => [ + ["loginRequest", ["WSDL::Anonymous::Login::LoginRequest", XSD::QName.new(nil, "loginRequest")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::Login::LoginRequest, + :schema_name => XSD::QName.new(nil, "loginRequest"), + :is_anonymous => true, + :schema_qualified => false, + :schema_element => [ + ["username", "SOAP::SOAPString"], + ["password", "SOAP::SOAPString"], + ["timezone", "SOAP::SOAPString", [0, 1]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::LoginResponse, + :schema_name => XSD::QName.new(NsLp, "loginResponse"), + :schema_element => [ + ["loginResult", ["WSDL::Anonymous::LoginResponse::LoginResult", XSD::QName.new(nil, "loginResult")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Anonymous::LoginResponse::LoginResult, + :schema_name => XSD::QName.new(nil, "loginResult"), + :is_anonymous => true, + :schema_qualified => false, + :schema_element => [ + ["sessionID", "SOAP::SOAPString"] + ] + ) +end + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/lp.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/lp.wsdl new file mode 100644 index 00000000..896866d6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/lp.wsdl @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Service specific information. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/test_anonymous.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/test_anonymous.rb new file mode 100644 index 00000000..d0aacca4 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/anonymous/test_anonymous.rb @@ -0,0 +1,130 @@ +require 'test/unit' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +if defined?(HTTPClient) + +module WSDL; module Anonymous + + +class TestAnonymous < 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') + ) + add_document_method( + self, + Namespace + ':echo', + 'echo', + XSD::QName.new(Namespace, 'Pack'), + XSD::QName.new(Namespace, 'Envelope') + ) + self.literal_mapping_registry = LpMappingRegistry::LiteralRegistry + end + + def login(arg) + req = arg.loginRequest + sess = [req.username, req.password, req.timezone].join + LoginResponse.new(LoginResponse::LoginResult.new(sess)) + end + + def echo(pack) + raise unless pack.class == Pack + raise unless pack.header.class == Pack::Header + Envelope.new(Envelope::Header.new(pack.header.header1)) + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + Port = 17171 + + def setup + setup_clientdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('lp.rb')) + File.unlink(pathname('lpMappingRegistry.rb')) + File.unlink(pathname('lpDriver.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 = TestUtil.start_server_thread(@server) + end + + def setup_clientdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("lp.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'lpDriver.rb', 'lpMappingRegistry.rb', 'lp.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def compare(expected, actual) + TestUtil.filecompare(pathname(expected), pathname(actual)) + end + + def test_stubgeneration + compare("expectedClassDef.rb", "lp.rb") + compare("expectedMappingRegistry.rb", "lpMappingRegistry.rb") + compare("expectedDriver.rb", "lpDriver.rb") + end + + def test_stub + @client = Lp_porttype.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDERR if $DEBUG + request = Login.new(Login::LoginRequest.new("username", "password", "tz")) + response = @client.login(request) + assert_equal(LoginResponse::LoginResult, response.loginResult.class) + assert_equal("usernamepasswordtz", response.loginResult.sessionID) + end + + def test_anonymous_mapping + @client = Lp_porttype.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDERR if $DEBUG + request = Pack.new(Pack::Header.new("pack_header")) + response = @client.echo(request) + assert_equal(Envelope, response.class) + assert_equal(Envelope::Header, response.header.class) + assert_equal("pack_header", response.header.header2) + end +end + + +end; end + +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/any/any.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/any/any.wsdl new file mode 100644 index 00000000..6e09f888 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/any/any.wsdl @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedDriver.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedDriver.rb new file mode 100644 index 00000000..cfd16a72 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedDriver.rb @@ -0,0 +1,68 @@ +require 'echo.rb' +require 'echoMappingRegistry.rb' +require 'soap/rpc/driver' + +module WSDL::Any + +class Echo_port_type < ::SOAP::RPC::Driver + DefaultEndpointUrl = "http://localhost:10080" + NsEcho = "urn:example.com:echo" + + Methods = [ + [ "urn:example.com:echo", + "echo", + [ ["in", "parameters", ["::SOAP::SOAPElement", "urn:example.com:echo-type", "foo.bar"]], + ["out", "parameters", ["::SOAP::SOAPElement", "urn:example.com:echo-type", "foo.bar"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {} } + ], + [ XSD::QName.new(NsEcho, "echoAny"), + "urn:example.com:echoAny", + "echoAny", + [ ["retval", "echoany_return", [nil]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ "urn:example.com:echo", + "setOutputAndComplete", + [ ["in", "parameters", ["::SOAP::SOAPElement", "urn:example.com:echo-type", "setOutputAndCompleteRequest"]], + ["out", "parameters", ["::SOAP::SOAPElement", "urn:example.com:echo-type", "setOutputAndCompleteRequest"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {} } + ] + ] + + def initialize(endpoint_url = nil) + endpoint_url ||= DefaultEndpointUrl + super(endpoint_url, nil) + self.mapping_registry = EchoMappingRegistry::EncodedRegistry + self.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + 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 + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedEcho.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedEcho.rb new file mode 100644 index 00000000..bc406e7c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedEcho.rb @@ -0,0 +1,57 @@ +require 'xsd/qname' + +module WSDL; module Any + + +# {urn:example.com:echo-type}foo.bar +# before - SOAP::SOAPString +# after - SOAP::SOAPString +class FooBar + attr_accessor :before + attr_reader :__xmlele_any + attr_accessor :after + + def set_any(elements) + @__xmlele_any = elements + end + + def initialize(before = nil, after = nil) + @before = before + @__xmlele_any = nil + @after = after + end +end + +# {urn:example.com:echo-type}setOutputAndCompleteRequest +# taskId - SOAP::SOAPString +# data - WSDL::Any::SetOutputAndCompleteRequest::C_Data +# participantToken - SOAP::SOAPString +class SetOutputAndCompleteRequest + + # inner class for member: data + # {}data + class C_Data + attr_reader :__xmlele_any + + def set_any(elements) + @__xmlele_any = elements + end + + def initialize + @__xmlele_any = nil + end + end + + attr_accessor :taskId + attr_accessor :data + attr_accessor :participantToken + + def initialize(taskId = nil, data = nil, participantToken = nil) + @taskId = taskId + @data = data + @participantToken = participantToken + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedMappingRegistry.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedMappingRegistry.rb new file mode 100644 index 00000000..870ae8f7 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedMappingRegistry.rb @@ -0,0 +1,63 @@ +require 'echo.rb' +require 'soap/mapping' + +module WSDL; module Any + +module EchoMappingRegistry + EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new + LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new + NsEchoType = "urn:example.com:echo-type" + NsXMLSchema = "http://www.w3.org/2001/XMLSchema" + + EncodedRegistry.register( + :class => WSDL::Any::FooBar, + :schema_type => XSD::QName.new(NsEchoType, "foo.bar"), + :schema_element => [ + ["before", ["SOAP::SOAPString", XSD::QName.new(nil, "before")]], + ["any", [nil, XSD::QName.new(NsXMLSchema, "anyType")]], + ["after", ["SOAP::SOAPString", XSD::QName.new(nil, "after")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Any::FooBar, + :schema_type => XSD::QName.new(NsEchoType, "foo.bar"), + :schema_element => [ + ["before", ["SOAP::SOAPString", XSD::QName.new(nil, "before")]], + ["any", [nil, XSD::QName.new(NsXMLSchema, "anyType")]], + ["after", ["SOAP::SOAPString", XSD::QName.new(nil, "after")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Any::FooBar, + :schema_name => XSD::QName.new(NsEchoType, "foo.bar"), + :schema_element => [ + ["before", ["SOAP::SOAPString", XSD::QName.new(nil, "before")]], + ["any", [nil, XSD::QName.new(NsXMLSchema, "anyType")]], + ["after", ["SOAP::SOAPString", XSD::QName.new(nil, "after")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Any::SetOutputAndCompleteRequest, + :schema_name => XSD::QName.new(NsEchoType, "setOutputAndCompleteRequest"), + :schema_element => [ + ["taskId", ["SOAP::SOAPString", XSD::QName.new(nil, "taskId")]], + ["data", ["WSDL::Any::SetOutputAndCompleteRequest::C_Data", XSD::QName.new(nil, "data")]], + ["participantToken", ["SOAP::SOAPString", XSD::QName.new(nil, "participantToken")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::Any::SetOutputAndCompleteRequest::C_Data, + :schema_name => XSD::QName.new(nil, "data"), + :is_anonymous => true, + :schema_qualified => false, + :schema_element => [ + ["any", [nil, XSD::QName.new(NsXMLSchema, "anyType")]] + ] + ) +end + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedService.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedService.rb new file mode 100644 index 00000000..60ebe115 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/any/expectedService.rb @@ -0,0 +1,69 @@ +#!/usr/bin/env ruby +require 'echoServant.rb' +require 'echoMappingRegistry.rb' +require 'soap/rpc/standaloneServer' + +module WSDL; module Any + +class Echo_port_type + NsEcho = "urn:example.com:echo" + + Methods = [ + [ "urn:example.com:echo", + "echo", + [ ["in", "parameters", ["::SOAP::SOAPElement", "urn:example.com:echo-type", "foo.bar"]], + ["out", "parameters", ["::SOAP::SOAPElement", "urn:example.com:echo-type", "foo.bar"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {} } + ], + [ XSD::QName.new(NsEcho, "echoAny"), + "urn:example.com:echoAny", + "echoAny", + [ ["retval", "echoany_return", [nil]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ "urn:example.com:echo", + "setOutputAndComplete", + [ ["in", "parameters", ["::SOAP::SOAPElement", "urn:example.com:echo-type", "setOutputAndCompleteRequest"]], + ["out", "parameters", ["::SOAP::SOAPElement", "urn:example.com:echo-type", "setOutputAndCompleteRequest"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {} } + ] + ] +end + +end; end + +module WSDL; module Any + +class Echo_port_typeApp < ::SOAP::RPC::StandaloneServer + def initialize(*arg) + super(*arg) + servant = WSDL::Any::Echo_port_type.new + WSDL::Any::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 = EchoMappingRegistry::EncodedRegistry + self.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + end +end + +end; end + +if $0 == __FILE__ + # Change listen port. + server = WSDL::Any::Echo_port_typeApp.new('app', nil, '0.0.0.0', 10080) + trap(:INT) do + server.shutdown + end + server.start +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/any/test_any.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/any/test_any.rb new file mode 100644 index 00000000..647a4f22 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/any/test_any.rb @@ -0,0 +1,193 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module Any + + +class TestAny < Test::Unit::TestCase + Namespace = 'urn:example.com:echo' + TypeNamespace = 'urn:example.com:echo-type' + + class Server < ::SOAP::RPC::StandaloneServer + def on_init + # use WSDL to serialize/deserialize + wsdlfile = File.join(DIR, 'any.wsdl') + wsdl = WSDL::Importer.import(wsdlfile) + port = wsdl.services[0].ports[0] + 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) + @router.mapping_registry = + ::SOAP::Mapping::WSDLEncodedRegistry.new(rpc_decode_typemap) + @router.literal_mapping_registry = + ::SOAP::Mapping::WSDLLiteralRegistry.new(wsdl_types, wsdl_elements) + # add method + add_document_method( + self, + Namespace + ':echo', + 'echo', + XSD::QName.new(TypeNamespace, 'foo.bar'), + XSD::QName.new(TypeNamespace, 'foo.bar') + ) + add_rpc_operation(self, + XSD::QName.new("urn:example.com:echo", "echoAny"), + "urn:example.com:echoAny", + "echoAny", + [ ["retval", "echoany_return", [XSD::QName.new("http://www.w3.org/2001/XMLSchema", "anyType")]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ) + end + + def echo(arg) + res = FooBar.new(arg.before, arg.after) + res.set_any([ + ::SOAP::SOAPElement.new("foo", "bar"), + ::SOAP::SOAPElement.new("baz", "qux") + ]) + res + # TODO: arg + end + + AnyStruct = Struct.new(:a, :b) + def echoAny + AnyStruct.new(1, Time.mktime(2007, 1, 1)) + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_server + setup_classdef + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('echo.rb')) if File.exist?(pathname('echo.rb')) + File.unlink(pathname('echoMappingRegistry.rb')) if File.exist?(pathname('echoMappingRegistry.rb')) + File.unlink(pathname('echoDriver.rb')) if File.exist?(pathname('echoDriver.rb')) + File.unlink(pathname('echoServant.rb')) if File.exist?(pathname('echoServant.rb')) + File.unlink(pathname('echo_service.rb')) if File.exist?(pathname('echo_service.rb')) + File.unlink(pathname('echo_serviceClient.rb')) if File.exist?(pathname('echo_serviceClient.rb')) + end + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', Namespace, '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("any.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'echoDriver.rb', 'echoMappingRegistry.rb', 'echo.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + 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['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = 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 + TestUtil.silent do + gen.run + end + compare("expectedEcho.rb", "echo.rb") + compare("expectedMappingRegistry.rb", "echoMappingRegistry.rb") + compare("expectedDriver.rb", "echoDriver.rb") + compare("expectedService.rb", "echo_service.rb") + end + + def compare(expected, actual) + TestUtil.filecompare(pathname(expected), pathname(actual)) + end + + def test_anyreturl_wsdl + wsdl = File.join(DIR, 'any.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + res = @client.echoAny + assert_equal(1, res.a) + assert_equal(2007, res.b.year) + end + + def test_wsdl + wsdl = File.join(DIR, 'any.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + arg = FooBar.new("before", "after") + arg.set_any( + [ + ::SOAP::SOAPElement.new("foo", "bar"), + ::SOAP::SOAPElement.new("baz", "qux") + ] + ) + res = @client.echo(arg) + assert_equal(arg.before, res.before) + assert_equal("bar", res.foo) + assert_equal("qux", res.baz) + assert_equal(arg.after, res.after) + end + + def test_naive + @client = Echo_port_type.new + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + arg = FooBar.new("before", "after") + arg.set_any( + [ + ::SOAP::SOAPElement.new("foo", "bar"), + ::SOAP::SOAPElement.new("baz", "qux") + ] + ) + res = @client.echo(arg) + assert_equal(arg.before, res.before) + assert_equal("bar", res.foo) + assert_equal("qux", res.baz) + assert_equal(arg.after, res.after) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/axisArray/axisArray.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/axisArray/axisArray.wsdl new file mode 100644 index 00000000..1ad06f34 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/axisArray/axisArray.wsdl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/axisArray/test_axisarray.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/axisArray/test_axisarray.rb new file mode 100644 index 00000000..152f18bb --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/axisArray/test_axisarray.rb @@ -0,0 +1,124 @@ +require 'test/unit' +require 'soap/processor' +require 'soap/mapping' +require 'soap/rpc/element' +require 'wsdl/importer' +require 'wsdl/soap/wsdl2ruby' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL +module AxisArray + + +class TestAxisArray < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + + def setup + @xml =<<__EOX__ + + + + + + + + + + + + + name3 + + + name1 + + + name2 + + + +__EOX__ + setup_classdef + end + + def teardown + unless $DEBUG + File.unlink(pathname('itemList.rb')) + File.unlink(pathname('itemListMappingRegistry.rb')) + File.unlink(pathname('itemListDriver.rb')) + end + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("axisArray.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'itemListDriver.rb', 'itemList.rb', 'itemListMappingRegistry.rb') + end + + def test_by_stub + driver = ItemListPortType.new + driver.test_loopback_response << @xml + ary = driver.listItem + 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 + +XML_LONG = <<__XML__ + + + + + + + + + + 105759347 + + +__XML__ + + def test_multiref_long + driver = ItemListPortType.new + driver.test_loopback_response << XML_LONG + ret = driver.getMeetingInfo + assert_equal(105759347, ret.meetingId) + end + + def pathname(filename) + File.join(DIR, filename) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/choice/choice.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/choice/choice.wsdl new file mode 100644 index 00000000..924bcd10 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/choice/choice.wsdl @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/choice/test_choice.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/choice/test_choice.rb new file mode 100644 index 00000000..6de9a5d7 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/choice/test_choice.rb @@ -0,0 +1,310 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module Choice + + +class TestChoice < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + Namespace = 'urn:choice' + + def on_init + add_document_method( + self, + Namespace + ':echo', + 'echo', + XSD::QName.new(Namespace, 'echoele'), + XSD::QName.new(Namespace, 'echo_response') + ) + add_document_method( + self, + Namespace + ':echo_complex', + 'echo_complex', + XSD::QName.new(Namespace, 'echoele_complex'), + XSD::QName.new(Namespace, 'echo_complex_response') + ) + add_document_method( + self, + Namespace + ':echo_complex_emptyArrayAtFirst', + 'echo_complex_emptyArrayAtFirst', + XSD::QName.new(Namespace, 'echoele_complex_emptyArrayAtFirst'), + XSD::QName.new(Namespace, 'echoele_complex_emptyArrayAtFirst') + ) + @router.literal_mapping_registry = ChoiceMappingRegistry::LiteralRegistry + end + + def echo(arg) + arg + end + + def echo_complex(arg) + Echo_complex_response.new(arg.data) + end + + def echo_complex_emptyArrayAtFirst(arg) + arg + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('choice.rb')) + File.unlink(pathname('choiceMappingRegistry.rb')) + File.unlink(pathname('choiceDriver.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 = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("choice.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'choiceDriver.rb', 'choiceMappingRegistry.rb', 'choice.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_wsdl + wsdl = File.join(DIR, 'choice.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + @client.literal_mapping_registry = ChoiceMappingRegistry::LiteralRegistry + + ret = @client.echo(Echoele.new(TerminalID.new("imei", nil))) + assert_equal("imei", ret.terminalID.imei) + assert_nil(ret.terminalID.devId) + ret = @client.echo(Echoele.new(TerminalID.new(nil, 'devId'))) + assert_equal("devId", ret.terminalID.devId) + assert_nil(ret.terminalID.imei) + end + + include ::SOAP + def test_naive + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/") + @client.add_document_method('echo', 'urn:choice:echo', + XSD::QName.new('urn:choice', 'echoele'), + XSD::QName.new('urn:choice', 'echo_response')) + @client.wiredump_dev = STDOUT if $DEBUG + @client.literal_mapping_registry = ChoiceMappingRegistry::LiteralRegistry + + echo = SOAPElement.new('echoele') + echo.add(terminalID = SOAPElement.new('terminalID')) + terminalID.add(SOAPElement.new('imei', 'imei')) + ret = @client.echo(echo) + assert_equal("imei", ret.terminalID.imei) + assert_nil(ret.terminalID.devId) + + echo = SOAPElement.new('echoele') + echo.add(terminalID = SOAPElement.new('terminalID')) + terminalID.add(SOAPElement.new('devId', 'devId')) + ret = @client.echo(echo) + assert_equal("devId", ret.terminalID.devId) + assert_nil(ret.terminalID.imei) + end + + def test_wsdl_with_map_complex + wsdl = File.join(DIR, 'choice.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + do_test_with_map_complex(@client) + end + + def test_wsdl_with_stub_complex + wsdl = File.join(DIR, 'choice.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + @client.literal_mapping_registry = ChoiceMappingRegistry::LiteralRegistry + do_test_with_stub_complex(@client) + end + + def test_naive_with_map_complex + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/") + @client.add_document_method('echo_complex', 'urn:choice:echo_complex', + XSD::QName.new('urn:choice', 'echoele_complex'), + XSD::QName.new('urn:choice', 'echo_complex_response')) + @client.wiredump_dev = STDOUT if $DEBUG + do_test_with_map_complex(@client) + end + + def test_naive_with_stub_complex + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/") + @client.add_document_method('echo_complex', 'urn:choice:echo_complex', + XSD::QName.new('urn:choice', 'echoele_complex'), + XSD::QName.new('urn:choice', 'echo_complex_response')) + @client.wiredump_dev = STDOUT if $DEBUG + @client.literal_mapping_registry = ChoiceMappingRegistry::LiteralRegistry + do_test_with_stub_complex(@client) + end + + def do_test_with_map_complex(client) + req = { + :data => { + :A => "A", + :B1 => "B1", + :C1 => "C1", + :C2 => "C2" + } + } + ret = client.echo_complex(req) + assert_equal("A", ret.data["A"]) + assert_equal("B1", ret.data["B1"]) + assert_equal(nil, ret.data["B2a"]) + assert_equal(nil, ret.data["B2b"]) + assert_equal(nil, ret.data["B3a"]) + assert_equal(nil, ret.data["B3b"]) + assert_equal("C1", ret.data["C1"]) + assert_equal("C2", ret.data["C2"]) + # + req = { + :data => { + :A => "A", + :B2a => "B2a", + :B2b => "B2b", + :C1 => "C1", + :C2 => "C2" + } + } + ret = client.echo_complex(req) + assert_equal("A", ret.data["A"]) + assert_equal(nil, ret.data["B1"]) + assert_equal("B2a", ret.data["B2a"]) + assert_equal("B2b", ret.data["B2b"]) + assert_equal(nil, ret.data["B3a"]) + assert_equal(nil, ret.data["B3b"]) + assert_equal("C1", ret.data["C1"]) + assert_equal("C2", ret.data["C2"]) + # + req = { + :data => { + :A => "A", + :B3a => "B3a", + :C1 => "C1", + :C2 => "C2" + } + } + ret = client.echo_complex(req) + assert_equal("A", ret.data["A"]) + assert_equal(nil, ret.data["B1"]) + assert_equal(nil, ret.data["B2a"]) + assert_equal(nil, ret.data["B2b"]) + assert_equal("B3a", ret.data["B3a"]) + assert_equal(nil, ret.data["B3b"]) + assert_equal("C1", ret.data["C1"]) + assert_equal("C2", ret.data["C2"]) + # + req = { + :data => { + :A => "A", + :B3b => "B3b", + :C1 => "C1", + :C2 => "C2" + } + } + ret = client.echo_complex(req) + assert_equal("A", ret.data["A"]) + assert_equal(nil, ret.data["B1"]) + assert_equal(nil, ret.data["B2a"]) + assert_equal(nil, ret.data["B2b"]) + assert_equal(nil, ret.data["B3a"]) + assert_equal("B3b", ret.data["B3b"]) + assert_equal("C1", ret.data["C1"]) + assert_equal("C2", ret.data["C2"]) + end + + def do_test_with_stub_complex(client) + ret = client.echo_complex(Echoele_complex.new(Andor.new("A", "B1", nil, nil, nil, nil, "C1", "C2"))) + assert_equal("A", ret.data.a) + assert_equal("B1", ret.data.b1) + assert_equal(nil, ret.data.b2a) + assert_equal(nil, ret.data.b2b) + assert_equal(nil, ret.data.b3a) + assert_equal(nil, ret.data.b3b) + assert_equal("C1", ret.data.c1) + assert_equal("C2", ret.data.c2) + # + ret = client.echo_complex(Echoele_complex.new(Andor.new("A", nil, "B2a", "B2b", nil, nil, "C1", "C2"))) + assert_equal("A", ret.data.a) + assert_equal(nil, ret.data.b1) + assert_equal("B2a", ret.data.b2a) + assert_equal("B2b", ret.data.b2b) + assert_equal(nil, ret.data.b3a) + assert_equal(nil, ret.data.b3b) + assert_equal("C1", ret.data.c1) + assert_equal("C2", ret.data.c2) + # + ret = client.echo_complex(Echoele_complex.new(Andor.new("A", nil, nil, nil, "B3a", nil, "C1", "C2"))) + assert_equal("A", ret.data.a) + assert_equal(nil, ret.data.b1) + assert_equal(nil, ret.data.b2a) + assert_equal(nil, ret.data.b2b) + assert_equal("B3a", ret.data.b3a) + assert_equal(nil, ret.data.b3b) + assert_equal("C1", ret.data.c1) + assert_equal("C2", ret.data.c2) + # + ret = client.echo_complex(Echoele_complex.new(Andor.new("A", nil, nil, nil, nil, "B3b", "C1", "C2"))) + assert_equal("A", ret.data.a) + assert_equal(nil, ret.data.b1) + assert_equal(nil, ret.data.b2a) + assert_equal(nil, ret.data.b2b) + assert_equal(nil, ret.data.b3a) + assert_equal("B3b", ret.data.b3b) + assert_equal("C1", ret.data.c1) + assert_equal("C2", ret.data.c2) + end + + def test_stub_emptyArrayAtFirst + @client = Choice_porttype.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDOUT if $DEBUG + # + arg = EmptyArrayAtFirst.new + arg.b1 = "b1" + ret = @client.echo_complex_emptyArrayAtFirst(Echoele_complex_emptyArrayAtFirst.new(arg)) + assert_nil(ret.data.a) + assert_equal("b1", ret.data.b1) + assert_nil(ret.data.b2) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/complexcontent/complexContent.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/complexcontent/complexContent.wsdl new file mode 100644 index 00000000..3ff1fdc8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/complexcontent/complexContent.wsdl @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/complexcontent/test_echo.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/complexcontent/test_echo.rb new file mode 100644 index 00000000..2b4df583 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/complexcontent/test_echo.rb @@ -0,0 +1,90 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module ComplexContent + + +class TestEcho < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + Namespace = 'urn:complexContent' + + def on_init + add_document_method( + self, + nil, + 'echo', + XSD::QName.new(Namespace, 'echo'), + XSD::QName.new(Namespace, 'echo') + ) + end + + def echo(arg) + arg + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + Port = 17171 + + def setup + setup_server + setup_classdef + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('complexContent.rb')) + File.unlink(pathname('complexContentMappingRegistry.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 = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("complexContent.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'complexContentMappingRegistry.rb', 'complexContent.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_wsdl + wsdl = File.join(DIR, 'complexContent.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.literal_mapping_registry = ComplexContentMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + d = Derived.new + d.name = "NaHi" + assert_instance_of(Echo, @client.echo(Echo.new(d))) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/DatetimeService.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/DatetimeService.rb new file mode 100644 index 00000000..800e06d6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/DatetimeService.rb @@ -0,0 +1,44 @@ +#!/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/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/datetime.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/datetime.rb new file mode 100644 index 00000000..e69de29b diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/datetime.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/datetime.wsdl new file mode 100644 index 00000000..4998dc48 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/datetime.wsdl @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/datetimeServant.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/datetimeServant.rb new file mode 100644 index 00000000..c6215def --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/datetimeServant.rb @@ -0,0 +1,21 @@ +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 + return nil if now.nil? + now + 1 + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/test_datetime.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/test_datetime.rb new file mode 100644 index 00000000..0138173f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/datetime/test_datetime.rb @@ -0,0 +1,86 @@ +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 if @server + teardown_client if @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 + + def test_nil + assert_nil(@client.now(nil)) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/document/array/double.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/document/array/double.wsdl new file mode 100644 index 00000000..0a744c05 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/document/array/double.wsdl @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/document/array/test_array.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/document/array/test_array.rb new file mode 100644 index 00000000..479aa626 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/document/array/test_array.rb @@ -0,0 +1,201 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', '..', 'testutil.rb') + + +module WSDL; module Document + + +class TestArray < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + Namespace = 'http://tempuri.org/' + + def on_init + add_document_method( + self, + Namespace + 'echo', + 'echo', + XSD::QName.new(Namespace, 'echo'), + XSD::QName.new(Namespace, 'echoResponse') + ) + add_document_method( + self, + Namespace + 'echo2', + 'echo2', + XSD::QName.new(Namespace, 'echo2'), + XSD::QName.new(Namespace, 'echo2Response') + ) + add_document_method( + self, + Namespace + 'echo3', + 'echo3', + XSD::QName.new(Namespace, 'ArrayOfRecord'), + XSD::QName.new(Namespace, 'ArrayOfRecord') + ) + self.literal_mapping_registry = DoubleMappingRegistry::LiteralRegistry + end + + def echo(arg) + arg + end + + def echo2(arg) + arg + end + + def echo3(arg) + arg + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('double.rb')) + File.unlink(pathname('doubleMappingRegistry.rb')) + File.unlink(pathname('doubleDriver.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 = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("double.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'doubleDriver.rb', 'doubleMappingRegistry.rb', 'double.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_stub + @client = PricerSoap.new + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + arg = ArrayOfComplex[c1 = Complex.new, c2 = Complex.new, c3 = Complex.new] + c1.string = "str_c1" + c1.double = 1.1 + c2.string = "str_c2" + c2.double = 2.2 + c3.string = "str_c3" + c3.double = 3.3 + ret = @client.echo2(Echo2.new(arg)) + assert_equal(ArrayOfComplex, ret.arg.class) + assert_equal(Complex, ret.arg[0].class) + assert_equal(arg[0].string, ret.arg[0].string) + assert_equal(arg[1].string, ret.arg[1].string) + assert_equal(arg[2].string, ret.arg[2].string) + end + + def test_wsdl_stubclassdef + wsdl = File.join(DIR, 'double.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.literal_mapping_registry = DoubleMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + arg = ArrayOfDouble[0.1, 0.2, 0.3] + assert_equal(arg, @client.echo(Echo.new(arg)).ary) + end + + def test_wsdl + wsdl = File.join(DIR, 'double.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.literal_mapping_registry = DoubleMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + double = [0.1, 0.2, 0.3] + assert_equal(double, @client.echo(:ary => double).ary) + end + + def test_stub + @client = ::WSDL::Document::PricerSoap.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDOUT if $DEBUG + double = [0.1, 0.2, 0.3] + assert_equal(double, @client.echo(:ary => double).ary) + end + + def test_stub_nil + @client = ::WSDL::Document::PricerSoap.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDOUT if $DEBUG + assert_equal(nil, @client.echo(Echo.new).ary) + end + + def test_attribute_array + @client = ::WSDL::Document::PricerSoap.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDOUT if $DEBUG + # + r1 = ReportRecord.new + r1.xmlattr_a = "r1_xmlattr_a" + r1.xmlattr_b = "r1_xmlattr_b" + r1.xmlattr_c = "r1_xmlattr_c" + r2 = ReportRecord.new + r2.xmlattr_a = "r2_xmlattr_a" + r2.xmlattr_b = "r2_xmlattr_b" + r2.xmlattr_c = "r2_xmlattr_c" + arg = ArrayOfRecord[r1, r2] + ret = @client.echo3(arg) + assert_equal(arg.class , ret.class) + assert_equal(arg.size , ret.size) + assert_equal(2, ret.size) + assert_equal(arg[0].class, ret[0].class) + assert_equal(arg[0].xmlattr_a, ret[0].xmlattr_a) + assert_equal(arg[0].xmlattr_b, ret[0].xmlattr_b) + assert_equal(arg[0].xmlattr_c, ret[0].xmlattr_c) + assert_equal(arg[1].class, ret[1].class) + assert_equal(arg[1].xmlattr_a, ret[1].xmlattr_a) + assert_equal(arg[1].xmlattr_b, ret[1].xmlattr_b) + assert_equal(arg[1].xmlattr_c, ret[1].xmlattr_c) + # + arg = ArrayOfRecord[r1] + ret = @client.echo3(arg) + assert_equal(arg.class , ret.class) + assert_equal(arg.size , ret.size) + assert_equal(1, ret.size) + assert_equal(arg[0].class, ret[0].class) + assert_equal(arg[0].xmlattr_a, ret[0].xmlattr_a) + assert_equal(arg[0].xmlattr_b, ret[0].xmlattr_b) + assert_equal(arg[0].xmlattr_c, ret[0].xmlattr_c) + # + arg = ArrayOfRecord[] + ret = @client.echo3(arg) + assert_equal(arg.class , ret.class) + assert_equal(arg.size , ret.size) + assert_equal(0, ret.size) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/document/document.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/document/document.wsdl new file mode 100644 index 00000000..9b7baf62 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/document/document.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/document/number.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/document/number.wsdl new file mode 100644 index 00000000..cc3dd8e9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/document/number.wsdl @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/document/ping_nosoapaction.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/document/ping_nosoapaction.wsdl new file mode 100644 index 00000000..20c31e5d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/document/ping_nosoapaction.wsdl @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/document/test_nosoapaction.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/document/test_nosoapaction.rb new file mode 100644 index 00000000..551547d8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/document/test_nosoapaction.rb @@ -0,0 +1,102 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require 'soap/rpc/driver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +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 if @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 = TestUtil.start_server_thread(@server) + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + 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/vendor/gems/soap4r-1.5.8/test/wsdl/document/test_number.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/document/test_number.rb new file mode 100644 index 00000000..8c348fa6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/document/test_number.rb @@ -0,0 +1,92 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +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 if @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 = TestUtil.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 + TestUtil.require(DIR, 'foo.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + 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/vendor/gems/soap4r-1.5.8/test/wsdl/document/test_rpc.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/document/test_rpc.rb new file mode 100644 index 00000000..81a227e2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/document/test_rpc.rb @@ -0,0 +1,355 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +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') + ) + add_document_method( + self, + Namespace + ':return_nil', + 'return_nil', + nil, + XSD::QName.new(Namespace, 'echo_response') + ) + add_document_method( + self, + Namespace + ':return_empty', + 'return_empty', + nil, + XSD::QName.new(Namespace, 'echo_response') + ) + self.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + 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 + + def return_nil + e = Echoele.new + e.struct1 = Echo_struct.new(nil, nil) + e.struct_2 = Echo_struct.new(nil, nil) + e.long = nil + e + end + + def return_empty + e = Echoele.new + e.struct1 = Echo_struct.new("", nil) + e.struct_2 = Echo_struct.new("", nil) + e.long = 0 + e + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + File.unlink(pathname('echo.rb')) unless $DEBUG + File.unlink(pathname('echoMappingRegistry.rb')) unless $DEBUG + File.unlink(pathname('echoDriver.rb')) unless $DEBUG + @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 = TestUtil.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['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'echoDriver.rb', 'echoMappingRegistry.rb', 'echo.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + 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 + @client.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + do_test_with_stub(@client) + end + + def test_driver_stub + @client = ::WSDL::Document::Docrpc_porttype.new + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + do_test_with_stub(@client) + end + + def test_nil_attribute + @client = ::WSDL::Document::Docrpc_porttype.new + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + struct1 = Echo_struct.new("mystring1", now1 = Time.now) + struct1.xmlattr_m_attr = nil + struct2 = Echo_struct.new("mystr<>ing2", now2 = Time.now) + struct2.xmlattr_m_attr = '' + echo = Echoele.new(struct1, struct2, 105759347) + echo.xmlattr_attr_string = '' + echo.xmlattr_attr_int = nil + ret = @client.echo(echo) + # struct1 and struct2 are swapped + assert_equal('', ret.struct1.xmlattr_m_attr) + assert_equal(nil, ret.struct_2.xmlattr_m_attr) + assert_equal('', ret.xmlattr_attr_string) + assert_equal(nil, ret.xmlattr_attr_int) + assert_equal(105759347, ret.long) + end + + def do_test_with_stub(client) + struct1 = Echo_struct.new("mystring1", now1 = Time.now) + struct1.xmlattr_m_attr = 'myattr1' + struct2 = Echo_struct.new("mystr<>ing2", now2 = Time.now) + struct2.xmlattr_m_attr = 'myattr2' + echo = Echoele.new(struct1, struct2, 105759347) + echo.xmlattr_attr_string = 'attr_str<>ing' + 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("mystr<>ing2", 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_str<>ing", ret.xmlattr_attr_string) + assert_equal(5, ret.xmlattr_attr_int) + assert_equal(105759347, ret.long) + end + + def test_wsdl_with_map + 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 = { + :m_string => "mystring1", + :m_datetime => (now1 = Time.now), + :xmlattr_m_attr => "myattr1" + } + struct2 = { + "m_string" => "mystr<>ing2", + "m_datetime" => now2 = (Time.now), + "xmlattr_m_attr" => "myattr2" + } + echo = { + :struct1 => struct1, + "struct-2" => struct2, + :xmlattr_attr_string => 'attr_str<>ing', + "xmlattr_attr-int" => 5 + } + ret = @client.echo(echo) + # + now1str = XSD::XSDDateTime.new(now1).to_s + now2str = XSD::XSDDateTime.new(now2).to_s + assert_equal("mystr<>ing2", ret.struct1.m_string) + assert_equal(now2str, ret.struct1.m_datetime) + assert_equal("mystring1", ret.struct_2.m_string) + assert_equal(now1str, ret.struct_2.m_datetime) + assert_equal("attr_str<>ing", 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.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + + echo = SOAPElement.new('foo') + echo.extraattr['attr_string'] = 'attr_str<>ing' + 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_str<>ing', 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 + + def test_to_xml + @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.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + + require 'rexml/document' + echo = REXML::Document.new(<<__XML__.chomp) + + + mystring1 + 2005-03-17T19:47:31+01:00 + + + mystring2 + 2005-03-17T19:47:32+02:00 + + +__XML__ + 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) + # + echoele = REXML::Document.new(<<__XML__.chomp) + + + 2005-03-17T19:47:32+02:00 + mystring2 + + + 2005-03-17T19:47:31+01:00 + mystring1 + + +__XML__ + ret = @client.echo(echoele) + 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 + + def test_nil + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/") + @client.add_document_method('return_nil', 'urn:docrpc:return_nil', + nil, + XSD::QName.new('urn:docrpc', 'return_nil')) + @client.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + + ret = @client.return_nil + assert_nil(ret.struct1.m_string) + assert_nil(ret.struct_2.m_string) + assert_nil(ret.long) + end + + def test_empty + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/") + @client.add_document_method('return_empty', 'urn:docrpc:return_empty', + nil, + XSD::QName.new('urn:docrpc', 'return_empty')) + @client.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + + ret = @client.return_empty + assert_equal("", ret.struct1.m_string) + assert_equal("", ret.struct_2.m_string) + assert_equal(0, ret.long) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/emptycomplextype.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/emptycomplextype.wsdl new file mode 100644 index 00000000..4f8dc484 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/emptycomplextype.wsdl @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/fault/fault.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/fault/fault.wsdl new file mode 100644 index 00000000..84319d3d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/fault/fault.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/fault/multifault.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/fault/multifault.wsdl new file mode 100644 index 00000000..2752fbc6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/fault/multifault.wsdl @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/fault/test_fault.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/fault/test_fault.rb new file mode 100644 index 00000000..2273c36e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/fault/test_fault.rb @@ -0,0 +1,119 @@ +require 'test/unit' +require 'wsdl/soap/wsdl2ruby' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module Fault + + +class TestFault < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('Add.rb')) + File.unlink(pathname('AddMappingRegistry.rb')) + File.unlink(pathname('AddServant.rb')) + File.unlink(pathname('AddService.rb')) + end + @client.reset_stream if @client + end + + def setup_server + AddPortType.class_eval do + define_method(:add) do |request| + @sum ||= 0 + if (request.value > 100) + fault = AddFault.new("Value #{request.value} is too large", "Critical") + raise fault + end + @sum += request.value + return AddResponse.new(@sum) + end + end + @server = AddPortTypeApp.new('app', nil, '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("fault.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['servant_skelton'] = nil + gen.opt['standalone_server_stub'] = nil + gen.opt['force'] = true + TestUtil.silent do + gen.run + end + TestUtil.require(DIR, 'Add.rb', 'AddMappingRegistry.rb', 'AddServant.rb', 'AddService.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_driver + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/") + @client.mapping_registry = AddMappingRegistry::EncodedRegistry + @client.literal_mapping_registry = AddMappingRegistry::LiteralRegistry + @client.add_document_operation( + "Add", + "add", + [ ["in", "request", ["::SOAP::SOAPElement", "http://fault.test/Faulttest", "Add"]], + ["out", "response", ["::SOAP::SOAPElement", "http://fault.test/Faulttest", "AddResponse"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {"AddFault"=>{:namespace=>nil, :name=>"AddFault", :use=>"literal", :encodingstyle=>"document", :ns=>"http://fault.test/Faulttest"}} } + ) + @client.wiredump_dev = STDOUT if $DEBUG + do_test(@client) + end + + def test_wsdl + wsdl = File.join(DIR, 'fault.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.mapping_registry = AddMappingRegistry::EncodedRegistry + @client.literal_mapping_registry = AddMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + do_test(@client) + end + + def do_test(client) + assert_equal(100, client.add(Add.new(100)).sum) + assert_equal(100, client.add(Add.new(0)).sum) + assert_equal(150, client.add(Add.new(50)).sum) + begin + client.add(Add.new(101)) + assert(false) + rescue Exception => e + assert_equal(::SOAP::FaultError, e.class) + assert_equal("WSDL::Fault::AddFault", e.faultstring.data) + assert_equal("Value 101 is too large", e.detail.addFault.reason) + assert_equal("Critical", e.detail.addFault.severity) + end + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/fault/test_multifault.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/fault/test_multifault.rb new file mode 100644 index 00000000..2e78dc6c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/fault/test_multifault.rb @@ -0,0 +1,134 @@ +require 'test/unit' +require 'wsdl/soap/wsdl2ruby' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module Fault + + +class TestMultiFault < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('Add.rb')) + File.unlink(pathname('AddMappingRegistry.rb')) + File.unlink(pathname('AddServant.rb')) + File.unlink(pathname('AddService.rb')) + end + @client.reset_stream if @client + end + + def setup_server + AddPortType.class_eval do + define_method(:add) do |request| + @sum ||= 0 + if (request.value > 100) + fault = AddFault.new("Value #{request.value} is too large", "Critical") + raise fault + end + + if (request.value < 0) + fault = NegativeValueFault.new("Value #{request.value} is negative", "Fatal") + raise fault + end + + @sum += request.value + return AddResponse.new(@sum) + end + end + @server = AddPortTypeApp.new('app', nil, '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("multifault.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['servant_skelton'] = nil + gen.opt['standalone_server_stub'] = nil + gen.opt['force'] = true + TestUtil.silent do + gen.run + end + TestUtil.require(DIR, 'Add.rb', 'AddMappingRegistry.rb', 'AddServant.rb', 'AddService.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_driver + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/") + @client.mapping_registry = AddMappingRegistry::EncodedRegistry + @client.literal_mapping_registry = AddMappingRegistry::LiteralRegistry + @client.add_document_operation( + "Add", + "add", + [ ["in", "request", ["::SOAP::SOAPElement", "http://fault.test/Faulttest", "Add"]], + ["out", "response", ["::SOAP::SOAPElement", "http://fault.test/Faulttest", "AddResponse"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {"AddFault"=>{:namespace=>nil, :name=>"AddFault", :use=>"literal", :encodingstyle=>"document", :ns=>"http://fault.test/Faulttest"}} } + ) + @client.wiredump_dev = STDOUT if $DEBUG + do_test(@client) + end + + def test_wsdl + wsdl = File.join(DIR, 'multifault.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.mapping_registry = AddMappingRegistry::EncodedRegistry + @client.literal_mapping_registry = AddMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + do_test(@client) + end + + def do_test(client) + assert_equal(100, client.add(Add.new(100)).sum) + assert_equal(100, client.add(Add.new(0)).sum) + assert_equal(150, client.add(Add.new(50)).sum) + begin + client.add(Add.new(101)) + assert(false) + rescue Exception => e + assert_equal(::SOAP::FaultError, e.class) + assert_equal("WSDL::Fault::AddFault", e.faultstring.data) + assert_equal("Value 101 is too large", e.detail.addFault.reason) + assert_equal("Critical", e.detail.addFault.severity) + end + begin + client.add(Add.new(-50)) + assert(false) + rescue Exception => e + assert_equal(::SOAP::FaultError, e.class) + assert_equal("WSDL::Fault::NegativeValueFault", e.faultstring.data) + assert_equal("Value -50 is negative", e.detail.negativeValueFault.reason) + assert_equal("Fatal", e.detail.negativeValueFault.severity) + end + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/group/expectedClassdef.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/group/expectedClassdef.rb new file mode 100644 index 00000000..6919294e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/group/expectedClassdef.rb @@ -0,0 +1,58 @@ +require 'xsd/qname' + +module WSDL; module Group + + +# {urn:grouptype}groupele_type +# comment - SOAP::SOAPString +# element - SOAP::SOAPString +# eletype - SOAP::SOAPString +# var - SOAP::SOAPString +# xmlattr_attr_min - SOAP::SOAPDecimal +# xmlattr_attr_max - SOAP::SOAPDecimal +class Groupele_type + AttrAttr_max = XSD::QName.new(nil, "attr_max") + AttrAttr_min = XSD::QName.new(nil, "attr_min") + + attr_accessor :comment + attr_reader :__xmlele_any + attr_accessor :element + attr_accessor :eletype + attr_accessor :var + + def set_any(elements) + @__xmlele_any = elements + end + + def __xmlattr + @__xmlattr ||= {} + end + + def xmlattr_attr_min + __xmlattr[AttrAttr_min] + end + + def xmlattr_attr_min=(value) + __xmlattr[AttrAttr_min] = value + end + + def xmlattr_attr_max + __xmlattr[AttrAttr_max] + end + + def xmlattr_attr_max=(value) + __xmlattr[AttrAttr_max] = value + end + + def initialize(comment = nil, element = nil, eletype = nil, var = nil) + @comment = comment + @__xmlele_any = nil + @element = element + @eletype = eletype + @var = var + @__xmlattr = {} + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/group/expectedDriver.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/group/expectedDriver.rb new file mode 100644 index 00000000..9dffebf8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/group/expectedDriver.rb @@ -0,0 +1,51 @@ +require 'echo.rb' +require 'echoMappingRegistry.rb' +require 'soap/rpc/driver' + +module WSDL::Group + +class Group_porttype < ::SOAP::RPC::Driver + DefaultEndpointUrl = "http://localhost:17171/" + + Methods = [ + [ "urn:group:echo", + "echo", + [ ["in", "parameters", ["::SOAP::SOAPElement", "urn:grouptype", "groupele"]], + ["out", "parameters", ["::SOAP::SOAPElement", "urn:grouptype", "groupele"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {} } + ] + ] + + def initialize(endpoint_url = nil) + endpoint_url ||= DefaultEndpointUrl + super(endpoint_url, nil) + self.mapping_registry = EchoMappingRegistry::EncodedRegistry + self.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + 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 + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/group/expectedMappingRegistry.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/group/expectedMappingRegistry.rb new file mode 100644 index 00000000..1c9d8fff --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/group/expectedMappingRegistry.rb @@ -0,0 +1,67 @@ +require 'echo.rb' +require 'soap/mapping' + +module WSDL; module Group + +module EchoMappingRegistry + EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new + LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new + NsGrouptype = "urn:grouptype" + NsXMLSchema = "http://www.w3.org/2001/XMLSchema" + + EncodedRegistry.register( + :class => WSDL::Group::Groupele_type, + :schema_type => XSD::QName.new(NsGrouptype, "groupele_type"), + :schema_element => [ + ["comment", "SOAP::SOAPString", [0, 1]], + ["any", [nil, XSD::QName.new(NsXMLSchema, "anyType")]], + [ :choice, + ["element", ["SOAP::SOAPString", XSD::QName.new(nil, "element")]], + ["eletype", ["SOAP::SOAPString", XSD::QName.new(nil, "eletype")]] + ], + ["var", ["SOAP::SOAPString", XSD::QName.new(nil, "var")]] + ], + :schema_attribute => { + XSD::QName.new(nil, "attr_min") => "SOAP::SOAPDecimal", + XSD::QName.new(nil, "attr_max") => "SOAP::SOAPDecimal" + } + ) + + LiteralRegistry.register( + :class => WSDL::Group::Groupele_type, + :schema_type => XSD::QName.new(NsGrouptype, "groupele_type"), + :schema_element => [ + ["comment", "SOAP::SOAPString", [0, 1]], + ["any", [nil, XSD::QName.new(NsXMLSchema, "anyType")]], + [ :choice, + ["element", ["SOAP::SOAPString", XSD::QName.new(nil, "element")]], + ["eletype", ["SOAP::SOAPString", XSD::QName.new(nil, "eletype")]] + ], + ["var", ["SOAP::SOAPString", XSD::QName.new(nil, "var")]] + ], + :schema_attribute => { + XSD::QName.new(nil, "attr_min") => "SOAP::SOAPDecimal", + XSD::QName.new(nil, "attr_max") => "SOAP::SOAPDecimal" + } + ) + + LiteralRegistry.register( + :class => WSDL::Group::Groupele_type, + :schema_name => XSD::QName.new(NsGrouptype, "groupele"), + :schema_element => [ + ["comment", "SOAP::SOAPString", [0, 1]], + ["any", [nil, XSD::QName.new(NsXMLSchema, "anyType")]], + [ :choice, + ["element", ["SOAP::SOAPString", XSD::QName.new(nil, "element")]], + ["eletype", ["SOAP::SOAPString", XSD::QName.new(nil, "eletype")]] + ], + ["var", ["SOAP::SOAPString", XSD::QName.new(nil, "var")]] + ], + :schema_attribute => { + XSD::QName.new(nil, "attr_min") => "SOAP::SOAPDecimal", + XSD::QName.new(nil, "attr_max") => "SOAP::SOAPDecimal" + } + ) +end + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/group/group.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/group/group.wsdl new file mode 100644 index 00000000..4012ea6f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/group/group.wsdl @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/group/test_rpc.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/group/test_rpc.rb new file mode 100644 index 00000000..4e6c8255 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/group/test_rpc.rb @@ -0,0 +1,145 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module Group + + +class TestGroup < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + Namespace = 'urn:group' + TypeNamespace = 'urn:grouptype' + + def on_init + add_document_method( + self, + Namespace + ':echo', + 'echo', + XSD::QName.new(TypeNamespace, 'groupele'), + XSD::QName.new(TypeNamespace, 'groupele') + ) + self.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + end + + def echo(arg) + # arg + # need to convert for 'any' + ret = Groupele_type.new(arg.comment, arg.element, arg.eletype, arg.var) + ret.xmlattr_attr_max = arg.xmlattr_attr_max + ret.xmlattr_attr_min = arg.xmlattr_attr_min + ret.set_any([::SOAP::SOAPElement.new("foo", arg.foo)]) + ret + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + File.unlink(pathname('echo.rb')) unless $DEBUG + File.unlink(pathname('echoMappingRegistry.rb')) unless $DEBUG + File.unlink(pathname('echoDriver.rb')) unless $DEBUG + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', "urn:group", '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("group.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'echoDriver.rb', 'echoMappingRegistry.rb', 'echo.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def compare(expected, actual) + TestUtil.filecompare(pathname(expected), pathname(actual)) + end + + def test_generate + compare("expectedClassdef.rb", "echo.rb") + compare("expectedMappingRegistry.rb", "echoMappingRegistry.rb") + compare("expectedDriver.rb", "echoDriver.rb") + end + + def test_wsdl + wsdl = File.join(DIR, 'group.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + @client.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + # + do_test_arg + end + + def test_naive + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/") + @client.add_document_method('echo', 'urn:group:echo', + XSD::QName.new('urn:grouptype', 'groupele'), + XSD::QName.new('urn:grouptype', 'groupele')) + @client.literal_mapping_registry = EchoMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + # + do_test_arg + end + + def test_stub + @client = Group_porttype.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDOUT if $DEBUG + # + do_test_arg + end + + def do_test_arg + arg = Groupele_type.new + arg.comment = "comment" + arg.set_any( + [::SOAP::SOAPElement.new("foo", "bar")] + ) + arg.eletype = "eletype" + arg.var = "var" + arg.xmlattr_attr_min = -3 + arg.xmlattr_attr_max = 3 + ret = @client.echo(arg) + assert_equal(arg.comment, ret.comment) + assert_equal(arg.eletype, ret.eletype) + assert_nil(ret.element) + assert_equal(arg.var, ret.var) + assert_equal("bar", ret.foo) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/list/list.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/list/list.wsdl new file mode 100644 index 00000000..e54dcef2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/list/list.wsdl @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/list/test_list.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/list/test_list.rb new file mode 100644 index 00000000..02867c77 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/list/test_list.rb @@ -0,0 +1,124 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module List + + +class TestList < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + Namespace = 'urn:list' + + def on_init + add_document_method( + self, + Namespace + ':echo', + 'echo', + XSD::QName.new(Namespace, 'echoele'), + XSD::QName.new(Namespace, 'echo_response') + ) + end + + def echo(arg) + arg + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_server + setup_classdef + @client = nil + end + + def teardown + teardown_server if @server + File.unlink(pathname('list.rb')) unless $DEBUG + File.unlink(pathname('listMappingRegistry.rb')) unless $DEBUG + File.unlink(pathname('listDriver.rb')) unless $DEBUG + @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 = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("list.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'listDriver.rb', 'listMappingRegistry.rb', 'list.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_wsdl + wsdl = File.join(DIR, 'list.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + e1 = Langlistinline.new([Langlistinline::Inlineruby, + Langlistinline::Inlineperl]) + e2 = Langlist.new([Language::Python, Language::Smalltalk]) + ret = @client.echo(Echoele.new(e1, e2)) + # in the future... + # assert_equal(e1, ret.e1) + # assert_equal(e2, ret.e2) + assert_equal(e1.join(" "), ret.e1) + assert_equal(e2.join(" "), ret.e2) + end + + def test_naive + @client = List_porttype.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDOUT if $DEBUG + e1 = Langlistinline.new([Langlistinline::Inlineruby, + Langlistinline::Inlineperl]) + e2 = Langlist.new([Language::Python, Language::Smalltalk]) + ret = @client.echo(Echoele.new(e1, e2)) + # in the future... + # assert_equal(e1, ret.e1) + # assert_equal(e2, ret.e2) + assert_equal(e1.join(" "), ret.e1) + assert_equal(e2.join(" "), ret.e2) + end + + def test_string_as_a_value + @client = List_porttype.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDOUT if $DEBUG + e1 = ['inlineruby', 'inlineperl'] + e2 = 'python smalltalk' + ret = @client.echo(Echoele.new(e1, e2)) + # in the future... + # assert_equal(e1, ret.e1) + # assert_equal(e2, ret.e2) + assert_equal(e1.join(" "), ret.e1) + assert_equal(e2, ret.e2) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/map/map.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/map/map.wsdl new file mode 100644 index 00000000..e418a4cb --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/map/map.wsdl @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/map/map.xml b/vendor/gems/soap4r-1.5.8/test/wsdl/map/map.xml new file mode 100644 index 00000000..7106735f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/map/map.xml @@ -0,0 +1,43 @@ + + + + + + + a + + + a1 + + a1 + + + + a2 + + a2 + + + + + + b + + + b1 + + b1 + + + + b2 + + b2 + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/map/test_map.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/map/test_map.rb new file mode 100644 index 00000000..bf38387e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/map/test_map.rb @@ -0,0 +1,99 @@ +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 if @server + teardown_client if @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/vendor/gems/soap4r-1.5.8/test/wsdl/marshal/person.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/marshal/person.wsdl new file mode 100644 index 00000000..a43c0545 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/marshal/person.wsdl @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/marshal/person_org.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/marshal/person_org.rb new file mode 100644 index 00000000..0c80ebe5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/marshal/person_org.rb @@ -0,0 +1,23 @@ +require 'xsd/qname' + +# {http://www.jin.gr.jp/~nahi/xmlns/sample/Person}Person +# familyname - SOAP::SOAPString +# givenname - SOAP::SOAPString +# var1 - SOAP::SOAPInt +# var2 - SOAP::SOAPDouble +# var3 - SOAP::SOAPString +class Person + 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/vendor/gems/soap4r-1.5.8/test/wsdl/marshal/test_wsdlmarshal.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/marshal/test_wsdlmarshal.rb new file mode 100644 index 00000000..e9d20ec8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/marshal/test_wsdlmarshal.rb @@ -0,0 +1,76 @@ +require 'test/unit' +require 'wsdl/parser' +require 'soap/mapping/wsdlencodedregistry' +require 'soap/marshal' +require 'wsdl/soap/wsdl2ruby' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +class WSDLMarshaller + 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 = ::SOAP::Mapping::WSDLEncodedRegistry.new(types) + end + + def dump(obj, io = nil) + ele = ::SOAP::Mapping.obj2soap(obj, @mapping_registry) + ele.elename = XSD::QName.new(nil, ele.type.name.to_s) + ::SOAP::Processor.marshal(::SOAP::SOAPEnvelope.new(nil, ::SOAP::SOAPBody.new(ele)), @opt, io) + end + + def load(io) + header, body = ::SOAP::Processor.unmarshal(io, @opt) + ::SOAP::Mapping.soap2obj(body.root_node, @mapping_registry) + 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) + puts str if $DEBUG + 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')) unless $DEBUG + end + + def compare(expected, actual) + TestUtil.filecompare(pathname(expected), pathname(actual)) + end + + def pathname(filename) + File.join(DIR, filename) + end +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/multiplefault.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/multiplefault.wsdl new file mode 100644 index 00000000..a3ac139e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/multiplefault.wsdl @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/oneway/oneway.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/oneway/oneway.wsdl new file mode 100644 index 00000000..da7004d8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/oneway/oneway.wsdl @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/oneway/test_oneway.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/oneway/test_oneway.rb new file mode 100644 index 00000000..9b9abe47 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/oneway/test_oneway.rb @@ -0,0 +1,108 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'wsdl/soap/wsdl2ruby' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL +module Oneway + + +class TestOneway < Test::Unit::TestCase + NS = 'http://www.example.com/oneway' + class Server < ::SOAP::RPC::StandaloneServer + Methods = [ + [ "initiate", + "initiate", + [ ["in", "payload", ["::SOAP::SOAPElement", "http://www.example.com/oneway", "onewayProcessRequest"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => nil, + :faults => {} } + ] + ] + + def on_init + Methods.each do |definition| + add_document_operation(self, *definition) + end + self.mapping_registry = OnewayMappingRegistry::EncodedRegistry + self.literal_mapping_registry = OnewayMappingRegistry::LiteralRegistry + end + + def initiate(payload) + raise unless payload.msg + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('oneway.rb')) + File.unlink(pathname('onewayMappingRegistry.rb')) + File.unlink(pathname('onewayDriver.rb')) + end + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', "http://www.example.com/oneway", '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("oneway.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.opt['module_path'] = 'WSDL::Oneway' + gen.run + TestUtil.require(DIR, 'oneway.rb', 'onewayDriver.rb', 'onewayMappingRegistry.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_stub + @client = OnewayPort.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDERR if $DEBUG + # not raised + @client.initiate(OnewayProcessRequest.new("msg")) + @client.initiate(OnewayProcessRequest.new(nil)) + end + + def test_wsdl + @client = ::SOAP::WSDLDriverFactory.new(pathname('oneway.wsdl')).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDERR if $DEBUG + # not raised + @client.initiate(OnewayProcessRequest.new("msg")) + @client.initiate(OnewayProcessRequest.new(nil)) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/overload/overload.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/overload/overload.wsdl new file mode 100644 index 00000000..bc7f056e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/overload/overload.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/overload/test_overload.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/overload/test_overload.rb new file mode 100644 index 00000000..ded462cb --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/overload/test_overload.rb @@ -0,0 +1,111 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module Overload + + +class TestOverload < Test::Unit::TestCase + TNS = "http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1" + + Methods = [ + [ + XSD::QName.new(TNS, 'methodAlpha'), "methodAlpha1", "method_alpha_1", + [ ["in", "in0", ["::SOAP::SOAPString"]], + ["in", "in1", ["::SOAP::SOAPString"]], + ["in", "in2", ["::SOAP::SOAPString"]], + ["retval", "methodAlphaReturn", ["::SOAP::SOAPLong"]] ] + ], + [ + XSD::QName.new(TNS, 'methodAlpha'), "methodAlpha2", "method_alpha_2", + [ ["in", "in0", ["::SOAP::SOAPString"]], + ["in", "in1", ["::SOAP::SOAPString"]], + ["retval", "methodAlphaReturn", ["::SOAP::SOAPLong"]] ] + ] + ] + + class Server < ::SOAP::RPC::StandaloneServer + def on_init + TestOverload::Methods.each do |definition| + add_rpc_operation(self, *definition) + end + end + + def method_alpha_1(in0, in1, in2) + 3 + end + + def method_alpha_2(in0, in1) + 2 + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_server + setup_classdef + @client = nil + end + + def teardown + teardown_server if @server + File.unlink(pathname('default.rb')) unless $DEBUG + @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 = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("overload.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'default.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_wsdl + wsdl = File.join(DIR, 'overload.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + assert_equal(3, @client.call("methodAlpha1", "1", "2", "3")) + assert_equal(2, @client.call("methodAlpha2", "1", "2")) + end + + def test_native + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/") + Methods.each do |definition| + @client.add_rpc_operation(*definition) + end + @client.wiredump_dev = STDOUT if $DEBUG + assert_equal(3, @client.call("methodAlpha1", "1", "2", "3")) + assert_equal(2, @client.call("methodAlpha2", "1", "2")) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/lp.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/lp.wsdl new file mode 100644 index 00000000..b107b7b3 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/lp.wsdl @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/lp.xsd b/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/lp.xsd new file mode 100644 index 00000000..12bcbd8c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/lp.xsd @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/np.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/np.wsdl new file mode 100644 index 00000000..b5a10d0c --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/np.wsdl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/test_qualified.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/test_qualified.rb new file mode 100644 index 00000000..a2595397 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/test_qualified.rb @@ -0,0 +1,137 @@ +require 'test/unit' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +if defined?(HTTPClient) + +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 if @server + unless $DEBUG + File.unlink(pathname('default.rb')) + File.unlink(pathname('defaultMappingRegistry.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 = TestUtil.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['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + require 'default.rb' + ensure + $".delete('default.rb') + Dir.chdir(backupdir) + end + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + LOGIN_REQUEST_QUALIFIED = +%q[ + + + + 2 + 10 + + +] + + 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(:Min => 2, :Max => 10) + assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str), + [LOGIN_REQUEST_QUALIFIED, parse_requestxml(str)].join("\n\n")) + end + + include ::SOAP + def test_naive + TestUtil.require(DIR, 'defaultDriver.rb', 'defaultMappingRegistry.rb', 'default.rb') + @client = PnumSoap.new("http://localhost:#{Port}/") + + @client.wiredump_dev = str = '' + @client.getPrimeNumbers(GetPrimeNumbers.new(2, 10)) + assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str), + [LOGIN_REQUEST_QUALIFIED, parse_requestxml(str)].join("\n\n")) + end + + def parse_requestxml(str) + str.split(/\r?\n\r?\n/)[3] + end +end + + +end + +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/test_unqualified.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/test_unqualified.rb new file mode 100644 index 00000000..62c2e267 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/qualified/test_unqualified.rb @@ -0,0 +1,138 @@ +require 'test/unit' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +if defined?(HTTPClient) + +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 if @server + unless $DEBUG + File.unlink(pathname('lp.rb')) + File.unlink(pathname('lpMappingRegistry.rb')) + File.unlink(pathname('lpDriver.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 = TestUtil.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['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + require 'lp.rb' + ensure + $".delete('lp.rb') + Dir.chdir(backupdir) + end + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + LOGIN_REQUEST_QUALIFIED_UNTYPED = +%q[ + + + + NaHi + passwd + JST + + +] + + 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') + # untyped because of passing a Hash + assert_equal(LOGIN_REQUEST_QUALIFIED_UNTYPED, parse_requestxml(str)) + end + + include ::SOAP + def test_naive + TestUtil.require(DIR, 'lpDriver.rb', 'lpMappingRegistry.rb', 'lp.rb') + @client = Lp_porttype.new("http://localhost:#{Port}/") + + @client.wiredump_dev = str = '' + @client.login(Login.new('NaHi', 'passwd', 'JST')) + assert_equal(LOGIN_REQUEST_QUALIFIED_UNTYPED, parse_requestxml(str)) + end + + def parse_requestxml(str) + str.split(/\r?\n\r?\n/)[3] + end +end + + +end + +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/raa/RAAService.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/RAAService.rb new file mode 100644 index 00000000..dcd53dd5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/RAAService.rb @@ -0,0 +1,125 @@ +#!/usr/bin/env ruby +require 'soap/rpc/standaloneServer' + +module WSDL; module RAA + +class RAABaseServicePortTypeServer + def getAllListings + ["ruby", "soap4r"] + end + + def getProductTree + raise NotImplementedError.new + end + + def getInfoFromCategory(category) + raise NotImplementedError.new + end + + def getModifiedInfoSince(timeInstant) + raise NotImplementedError.new + end + + def getInfoFromName(productName) + Info.new( + Category.new("major", "minor"), + Product.new(123, productName, "short description", "version", "status", + URI.parse("http://example.com/homepage"), + URI.parse("http://example.com/download"), + "license", "description"), + Owner.new(456, URI.parse("mailto:email@example.com"), "name"), + Time.now, + Time.now) + end + + def getInfoFromOwnerId(ownerId) + raise NotImplementedError.new + end + + Methods = [ + [ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getAllListings"), + "", + "getAllListings", + [ ["retval", "return", ["WSDL::RAA::C_String[]", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "StringArray"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getProductTree"), + "", + "getProductTree", + [ ["retval", "return", ["Hash", "http://xml.apache.org/xml-soap", "Map"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getInfoFromCategory"), + "", + "getInfoFromCategory", + [ ["in", "category", ["WSDL::RAA::Category", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category"]], + ["retval", "return", ["WSDL::RAA::Info[]", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "InfoArray"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getModifiedInfoSince"), + "", + "getModifiedInfoSince", + [ ["in", "timeInstant", ["::SOAP::SOAPDateTime"]], + ["retval", "return", ["WSDL::RAA::Info[]", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "InfoArray"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getInfoFromName"), + "", + "getInfoFromName", + [ ["in", "productName", ["::SOAP::SOAPString"]], + ["retval", "return", ["WSDL::RAA::Info", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "getInfoFromOwnerId"), + "", + "getInfoFromOwnerId", + [ ["in", "ownerId", ["::SOAP::SOAPInt"]], + ["retval", "return", ["WSDL::RAA::Info[]", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "InfoArray"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ] + ] +end + +end; end + +module WSDL; module RAA + +class RAABaseServicePortTypeApp < ::SOAP::RPC::StandaloneServer + def initialize(*arg) + super(*arg) + servant = WSDL::RAA::RAABaseServicePortTypeServer.new + WSDL::RAA::RAABaseServicePortType::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 = RAAMappingRegistry::EncodedRegistry + self.literal_mapping_registry = RAAMappingRegistry::LiteralRegistry + end +end + +end; end + +if $0 == __FILE__ + # Change listen port. + server = WSDL::RAA::RAABaseServicePortTypeApp.new('app', nil, '0.0.0.0', 10080) + trap(:INT) do + server.shutdown + end + server.start +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/raa/README.txt b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/README.txt new file mode 100644 index 00000000..efbaf9d8 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/README.txt @@ -0,0 +1,8 @@ +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/vendor/gems/soap4r-1.5.8/test/wsdl/raa/expectedClassDef.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/expectedClassDef.rb new file mode 100644 index 00000000..cefcd3f5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/expectedClassDef.rb @@ -0,0 +1,100 @@ +require 'xsd/qname' + +module WSDL; module RAA + + +# {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}Category +# major - SOAP::SOAPString +# minor - SOAP::SOAPString +class Category + attr_accessor :major + attr_accessor :minor + + def initialize(major = nil, minor = nil) + @major = major + @minor = minor + end +end + +# {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}Product +# id - SOAP::SOAPInt +# name - SOAP::SOAPString +# short_description - SOAP::SOAPString +# version - SOAP::SOAPString +# status - SOAP::SOAPString +# homepage - SOAP::SOAPAnyURI +# download - SOAP::SOAPAnyURI +# license - SOAP::SOAPString +# description - SOAP::SOAPString +class Product + attr_accessor :id + attr_accessor :name + attr_accessor :short_description + attr_accessor :version + attr_accessor :status + attr_accessor :homepage + attr_accessor :download + attr_accessor :license + attr_accessor :description + + 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/}Owner +# id - SOAP::SOAPInt +# email - SOAP::SOAPAnyURI +# name - SOAP::SOAPString +class Owner + attr_accessor :id + attr_accessor :email + attr_accessor :name + + 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/}Info +# category - WSDL::RAA::Category +# product - WSDL::RAA::Product +# owner - WSDL::RAA::Owner +# created - SOAP::SOAPDateTime +# updated - SOAP::SOAPDateTime +class Info + attr_accessor :category + attr_accessor :product + attr_accessor :owner + attr_accessor :created + attr_accessor :updated + + 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/}InfoArray +class InfoArray < ::Array +end + +# {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}StringArray +class StringArray < ::Array +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/raa/expectedDriver.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/expectedDriver.rb new file mode 100644 index 00000000..b7e1e66a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/expectedDriver.rb @@ -0,0 +1,96 @@ +require 'RAA.rb' +require 'RAAMappingRegistry.rb' +require 'soap/rpc/driver' + +module WSDL::RAA + +class RAABaseServicePortType < ::SOAP::RPC::Driver + DefaultEndpointUrl = "http://raa.ruby-lang.org/soap/1.0.2/" + NsC_002 = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/" + + Methods = [ + [ XSD::QName.new(NsC_002, "getAllListings"), + "", + "getAllListings", + [ ["retval", "return", ["WSDL::RAA::StringArray", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "StringArray"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ XSD::QName.new(NsC_002, "getProductTree"), + "", + "getProductTree", + [ ["retval", "return", ["Hash", "http://xml.apache.org/xml-soap", "Map"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ XSD::QName.new(NsC_002, "getInfoFromCategory"), + "", + "getInfoFromCategory", + [ ["in", "category", ["WSDL::RAA::Category", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category"]], + ["retval", "return", ["WSDL::RAA::InfoArray", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "InfoArray"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ XSD::QName.new(NsC_002, "getModifiedInfoSince"), + "", + "getModifiedInfoSince", + [ ["in", "timeInstant", ["::SOAP::SOAPDateTime"]], + ["retval", "return", ["WSDL::RAA::InfoArray", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "InfoArray"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ XSD::QName.new(NsC_002, "getInfoFromName"), + "", + "getInfoFromName", + [ ["in", "productName", ["::SOAP::SOAPString"]], + ["retval", "return", ["WSDL::RAA::Info", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ], + [ XSD::QName.new(NsC_002, "getInfoFromOwnerId"), + "", + "getInfoFromOwnerId", + [ ["in", "ownerId", ["::SOAP::SOAPInt"]], + ["retval", "return", ["WSDL::RAA::InfoArray", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "InfoArray"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ] + ] + + def initialize(endpoint_url = nil) + endpoint_url ||= DefaultEndpointUrl + super(endpoint_url, nil) + self.mapping_registry = RAAMappingRegistry::EncodedRegistry + self.literal_mapping_registry = RAAMappingRegistry::LiteralRegistry + 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 + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/raa/expectedMappingRegistry.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/expectedMappingRegistry.rb new file mode 100644 index 00000000..a48a51dc --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/expectedMappingRegistry.rb @@ -0,0 +1,121 @@ +require 'RAA.rb' +require 'soap/mapping' + +module WSDL; module RAA + +module RAAMappingRegistry + EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new + LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new + NsC_002 = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/" + + EncodedRegistry.register( + :class => WSDL::RAA::Category, + :schema_type => XSD::QName.new(NsC_002, "Category"), + :schema_element => [ + ["major", ["SOAP::SOAPString", XSD::QName.new(nil, "major")]], + ["minor", ["SOAP::SOAPString", XSD::QName.new(nil, "minor")]] + ] + ) + + EncodedRegistry.register( + :class => WSDL::RAA::Product, + :schema_type => XSD::QName.new(NsC_002, "Product"), + :schema_element => [ + ["id", ["SOAP::SOAPInt", XSD::QName.new(nil, "id")]], + ["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], + ["short_description", ["SOAP::SOAPString", XSD::QName.new(nil, "short_description")]], + ["version", ["SOAP::SOAPString", XSD::QName.new(nil, "version")]], + ["status", ["SOAP::SOAPString", XSD::QName.new(nil, "status")]], + ["homepage", ["SOAP::SOAPAnyURI", XSD::QName.new(nil, "homepage")]], + ["download", ["SOAP::SOAPAnyURI", XSD::QName.new(nil, "download")]], + ["license", ["SOAP::SOAPString", XSD::QName.new(nil, "license")]], + ["description", ["SOAP::SOAPString", XSD::QName.new(nil, "description")]] + ] + ) + + EncodedRegistry.register( + :class => WSDL::RAA::Owner, + :schema_type => XSD::QName.new(NsC_002, "Owner"), + :schema_element => [ + ["id", ["SOAP::SOAPInt", XSD::QName.new(nil, "id")]], + ["email", ["SOAP::SOAPAnyURI", XSD::QName.new(nil, "email")]], + ["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]] + ] + ) + + EncodedRegistry.register( + :class => WSDL::RAA::Info, + :schema_type => XSD::QName.new(NsC_002, "Info"), + :schema_element => [ + ["category", ["WSDL::RAA::Category", XSD::QName.new(nil, "category")]], + ["product", ["WSDL::RAA::Product", XSD::QName.new(nil, "product")]], + ["owner", ["WSDL::RAA::Owner", XSD::QName.new(nil, "owner")]], + ["created", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "created")]], + ["updated", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "updated")]] + ] + ) + + EncodedRegistry.set( + WSDL::RAA::InfoArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory, + { :type => XSD::QName.new(NsC_002, "Info") } + ) + + EncodedRegistry.set( + WSDL::RAA::StringArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") } + ) + + LiteralRegistry.register( + :class => WSDL::RAA::Category, + :schema_type => XSD::QName.new(NsC_002, "Category"), + :schema_element => [ + ["major", ["SOAP::SOAPString", XSD::QName.new(nil, "major")]], + ["minor", ["SOAP::SOAPString", XSD::QName.new(nil, "minor")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::RAA::Product, + :schema_type => XSD::QName.new(NsC_002, "Product"), + :schema_element => [ + ["id", ["SOAP::SOAPInt", XSD::QName.new(nil, "id")]], + ["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], + ["short_description", ["SOAP::SOAPString", XSD::QName.new(nil, "short_description")]], + ["version", ["SOAP::SOAPString", XSD::QName.new(nil, "version")]], + ["status", ["SOAP::SOAPString", XSD::QName.new(nil, "status")]], + ["homepage", ["SOAP::SOAPAnyURI", XSD::QName.new(nil, "homepage")]], + ["download", ["SOAP::SOAPAnyURI", XSD::QName.new(nil, "download")]], + ["license", ["SOAP::SOAPString", XSD::QName.new(nil, "license")]], + ["description", ["SOAP::SOAPString", XSD::QName.new(nil, "description")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::RAA::Owner, + :schema_type => XSD::QName.new(NsC_002, "Owner"), + :schema_element => [ + ["id", ["SOAP::SOAPInt", XSD::QName.new(nil, "id")]], + ["email", ["SOAP::SOAPAnyURI", XSD::QName.new(nil, "email")]], + ["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]] + ] + ) + + LiteralRegistry.register( + :class => WSDL::RAA::Info, + :schema_type => XSD::QName.new(NsC_002, "Info"), + :schema_element => [ + ["category", ["WSDL::RAA::Category", XSD::QName.new(nil, "category")]], + ["product", ["WSDL::RAA::Product", XSD::QName.new(nil, "product")]], + ["owner", ["WSDL::RAA::Owner", XSD::QName.new(nil, "owner")]], + ["created", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "created")]], + ["updated", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "updated")]] + ] + ) + +end + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/raa/raa.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/raa.wsdl new file mode 100644 index 00000000..b478d31a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/raa.wsdl @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/raa/test_raa.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/test_raa.rb new file mode 100644 index 00000000..dd809f0b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/raa/test_raa.rb @@ -0,0 +1,126 @@ +require 'test/unit' +require 'soap/wsdlDriver' +require 'wsdl/soap/wsdl2ruby' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL +module RAA + + +class TestRAA < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_stub + setup_server + setup_client + end + + def setup_stub + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("raa.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'RAADriver.rb', 'RAAMappingRegistry.rb', 'RAA.rb') + end + + def setup_server + require pathname('RAAService.rb') + @server = RAABaseServicePortTypeApp.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}/" + @raa.wiredump_dev = STDOUT if $DEBUG + @raa.mapping_registry = RAAMappingRegistry::EncodedRegistry + @raa.literal_mapping_registry = RAAMappingRegistry::LiteralRegistry + end + + def teardown + teardown_server if @server + teardown_client if @client + unless $DEBUG + File.unlink(pathname('RAA.rb')) + File.unlink(pathname('RAAMappingRegistry.rb')) + File.unlink(pathname('RAADriver.rb')) + end + end + + def teardown_server + @server.shutdown + @t.kill + @t.join + end + + def teardown_client + @raa.reset_stream + end + + def test_stubgeneration + compare("expectedClassDef.rb", "RAA.rb") + compare("expectedMappingRegistry.rb", "RAAMappingRegistry.rb") + compare("expectedDriver.rb", "RAADriver.rb") + end + + def test_raa + do_test_raa(@raa) + end + + def test_stub + client = RAABaseServicePortType.new("http://localhost:#{Port}/") + do_test_raa(client) + end + + def do_test_raa(client) + assert_equal(["ruby", "soap4r"], client.getAllListings) + info = client.getInfoFromName("SOAP4R") + assert_equal(Info, info.class) + assert_equal(Category, info.category.class) + assert_equal(Product, info.product.class) + assert_equal(Owner, info.owner.class) + assert_equal("major", info.category.major) + assert_equal("minor", info.category.minor) + assert_equal(123, info.product.id) + assert_equal("SOAP4R", info.product.name) + assert_equal("short description", info.product.short_description) + assert_equal("version", info.product.version) + assert_equal("status", info.product.status) + assert_equal("http://example.com/homepage", info.product.homepage.to_s) + assert_equal("http://example.com/download", info.product.download.to_s) + assert_equal("license", info.product.license) + assert_equal("description", info.product.description) + assert_equal(456, info.owner.id) + assert_equal("mailto:email@example.com", info.owner.email.to_s) + assert_equal("name", info.owner.name) + assert(!info.created.nil?) + assert(!info.updated.nil?) + end + + def compare(expected, actual) + TestUtil.filecompare(pathname(expected), pathname(actual)) + end + + def pathname(filename) + File.join(DIR, filename) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/ref/expectedDriver.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/ref/expectedDriver.rb new file mode 100644 index 00000000..b9a559a6 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/ref/expectedDriver.rb @@ -0,0 +1,51 @@ +require 'product.rb' +require 'productMappingRegistry.rb' +require 'soap/rpc/driver' + +module WSDL::Ref + +class Ref_porttype < ::SOAP::RPC::Driver + DefaultEndpointUrl = "http://localhost:17171/" + + Methods = [ + [ "urn:ref:echo", + "echo", + [ ["in", "parameters", ["::SOAP::SOAPElement", "urn:ref", "Product-Bag"]], + ["out", "parameters", ["::SOAP::SOAPElement", "urn:ref", "Creator"]] ], + { :request_style => :document, :request_use => :literal, + :response_style => :document, :response_use => :literal, + :faults => {} } + ] + ] + + def initialize(endpoint_url = nil) + endpoint_url ||= DefaultEndpointUrl + super(endpoint_url, nil) + self.mapping_registry = ProductMappingRegistry::EncodedRegistry + self.literal_mapping_registry = ProductMappingRegistry::LiteralRegistry + 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 + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/ref/expectedProduct.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/ref/expectedProduct.rb new file mode 100644 index 00000000..54d16e29 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/ref/expectedProduct.rb @@ -0,0 +1,243 @@ +require 'xsd/qname' + +module WSDL; module Ref + + +# {urn:ref}Product +# name - SOAP::SOAPString +# rating - SOAP::SOAPString +class Product + attr_accessor :name + attr_accessor :rating + + def initialize(name = nil, rating = nil) + @name = name + @rating = rating + end +end + +# {urn:ref}Comment +# xmlattr_msgid - SOAP::SOAPString +class Comment < ::String + AttrMsgid = XSD::QName.new(nil, "msgid") + + def __xmlattr + @__xmlattr ||= {} + end + + def xmlattr_msgid + __xmlattr[AttrMsgid] + end + + def xmlattr_msgid=(value) + __xmlattr[AttrMsgid] = value + end + + def initialize(*arg) + super + @__xmlattr = {} + end +end + +# {urn:ref}_point +# xmlattr_unit - SOAP::SOAPString +class C__point < ::String + AttrUnit = XSD::QName.new(nil, "unit") + + def __xmlattr + @__xmlattr ||= {} + end + + def xmlattr_unit + __xmlattr[AttrUnit] + end + + def xmlattr_unit=(value) + __xmlattr[AttrUnit] = value + end + + def initialize(*arg) + super + @__xmlattr = {} + end +end + +# {urn:ref}Document +# xmlattr_ID - SOAP::SOAPString +class Document < ::String + AttrID = XSD::QName.new(nil, "ID") + + def __xmlattr + @__xmlattr ||= {} + end + + def xmlattr_ID + __xmlattr[AttrID] + end + + def xmlattr_ID=(value) + __xmlattr[AttrID] = value + end + + def initialize(*arg) + super + @__xmlattr = {} + end +end + +# {urn:ref}DerivedChoice_BaseSimpleContent +# varStringExt - SOAP::SOAPString +# varFloatExt - SOAP::SOAPFloat +# xmlattr_ID - SOAP::SOAPString +# xmlattr_attrStringExt - SOAP::SOAPString +class DerivedChoice_BaseSimpleContent < Document + AttrAttrStringExt = XSD::QName.new(nil, "attrStringExt") + AttrID = XSD::QName.new(nil, "ID") + + attr_accessor :varStringExt + attr_accessor :varFloatExt + + def __xmlattr + @__xmlattr ||= {} + end + + def xmlattr_ID + __xmlattr[AttrID] + end + + def xmlattr_ID=(value) + __xmlattr[AttrID] = value + end + + def xmlattr_attrStringExt + __xmlattr[AttrAttrStringExt] + end + + def xmlattr_attrStringExt=(value) + __xmlattr[AttrAttrStringExt] = value + end + + def initialize(varStringExt = nil, varFloatExt = nil) + @varStringExt = varStringExt + @varFloatExt = varFloatExt + @__xmlattr = {} + end +end + +# {urn:ref}Rating +class Rating < ::String + C_0 = Rating.new("0") + C_1 = Rating.new("+1") + C_1_2 = Rating.new("-1") +end + +# {urn:ref}Product-Bag +# bag - WSDL::Ref::Product +# rating - SOAP::SOAPString +# comment_1 - WSDL::Ref::ProductBag::Comment_1 +# comment_2 - WSDL::Ref::Comment +# m___point - WSDL::Ref::C__point +# xmlattr_version - SOAP::SOAPString +# xmlattr_yesno - SOAP::SOAPString +class ProductBag + AttrVersion = XSD::QName.new("urn:ref", "version") + AttrYesno = XSD::QName.new("urn:ref", "yesno") + + # inner class for member: Comment_1 + # {}Comment_1 + # xmlattr_msgid - SOAP::SOAPString + class Comment_1 < ::String + AttrMsgid = XSD::QName.new(nil, "msgid") + + def __xmlattr + @__xmlattr ||= {} + end + + def xmlattr_msgid + __xmlattr[AttrMsgid] + end + + def xmlattr_msgid=(value) + __xmlattr[AttrMsgid] = value + end + + def initialize(*arg) + super + @__xmlattr = {} + end + end + + attr_accessor :bag + attr_accessor :rating + attr_accessor :comment_1 + attr_accessor :comment_2 + + def m___point + @v___point + end + + def m___point=(value) + @v___point = value + end + + def __xmlattr + @__xmlattr ||= {} + end + + def xmlattr_version + __xmlattr[AttrVersion] + end + + def xmlattr_version=(value) + __xmlattr[AttrVersion] = value + end + + def xmlattr_yesno + __xmlattr[AttrYesno] + end + + def xmlattr_yesno=(value) + __xmlattr[AttrYesno] = value + end + + def initialize(bag = [], rating = [], comment_1 = [], comment_2 = [], v___point = nil) + @bag = bag + @rating = rating + @comment_1 = comment_1 + @comment_2 = comment_2 + @v___point = v___point + @__xmlattr = {} + end +end + +# {urn:ref}Creator +# xmlattr_Role - SOAP::SOAPString +class Creator < ::String + AttrRole = XSD::QName.new(nil, "Role") + + def __xmlattr + @__xmlattr ||= {} + end + + def xmlattr_Role + __xmlattr[AttrRole] + end + + def xmlattr_Role=(value) + __xmlattr[AttrRole] = value + end + + def initialize(*arg) + super + @__xmlattr = {} + end +end + +# {urn:ref}yesno +class Yesno < ::String + N = Yesno.new("N") + Y = Yesno.new("Y") +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/ref/product.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/ref/product.wsdl new file mode 100644 index 00000000..b5518495 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/ref/product.wsdl @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/ref/test_ref.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/ref/test_ref.rb new file mode 100644 index 00000000..60c307de --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/ref/test_ref.rb @@ -0,0 +1,268 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require 'wsdl/soap/wsdl2ruby' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL +module Ref + + +class TestRef < Test::Unit::TestCase + Namespace = 'urn:ref' + + class Server < ::SOAP::RPC::StandaloneServer + Namespace = TestRef::Namespace + + def on_init + add_document_method( + self, + Namespace + ':echo', + 'echo', + XSD::QName.new(Namespace, 'Product-Bag'), + XSD::QName.new(Namespace, 'Creator') + ) + self.literal_mapping_registry = ProductMappingRegistry::LiteralRegistry + end + + def echo(arg) + content = [ + arg.bag[0].name, + arg.bag[0].rating, + arg.bag[1].name, + arg.bag[1].rating, + arg.xmlattr_version, + arg.xmlattr_yesno, + arg.rating[0], + arg.rating[1], + arg.rating[2], + arg.comment_1[0], + arg.comment_1[0].xmlattr_msgid, + arg.comment_1[1], + arg.comment_1[1].xmlattr_msgid, + arg.comment_2[0], + arg.comment_2[0].xmlattr_msgid, + arg.comment_2[1], + arg.comment_2[1].xmlattr_msgid + ] + rv = Creator.new(content.join(" ")) + rv.xmlattr_Role = "role" + rv + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('product.rb')) + File.unlink(pathname('productMappingRegistry.rb')) + File.unlink(pathname('productDriver.rb')) + end + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', Namespace, '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("product.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'product.rb', 'productMappingRegistry.rb', 'productDriver.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def compare(expected, actual) + TestUtil.filecompare(pathname(expected), pathname(actual)) + end + + def test_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("product.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['force'] = true + TestUtil.silent do + gen.run + end + compare("expectedProduct.rb", "product.rb") + compare("expectedDriver.rb", "productDriver.rb") + end + + def test_wsdl + wsdl = File.join(DIR, 'product.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + p1 = e("bag") + p1.add(e("name", "foo")) + p1.add(e(q(Namespace, "Rating"), "0")) + p2 = e("bag") + p2.add(e("name", "bar")) + p2.add(e(q(Namespace, "Rating"), "+1")) + version = "version" + yesno = "N" + r1 = e(q(Namespace, "Rating"), "0") + r2 = e(q(Namespace, "Rating"), "+1") + r3 = e(q(Namespace, "Rating"), "-1") + c11 = e("Comment_1", "comment11") + c11.extraattr["msgid"] = "msgid11" + c12 = e("Comment_1", "comment12") + c12.extraattr["msgid"] = "msgid12" + c21 = e("comment-2", "comment21") + c21.extraattr["msgid"] = "msgid21" + c22 = e("comment-2", "comment22") + c22.extraattr["msgid"] = "msgid22" + bag = e(q(Namespace, "Product-Bag")) + bag.add(p1) + bag.add(p2) + bag.add(r1) + bag.add(r2) + bag.add(r3) + bag.add(c11) + bag.add(c12) + bag.add(c21) + bag.add(c22) + bag.extraattr[q(Namespace, "version")] = version + bag.extraattr[q(Namespace, "yesno")] = yesno + ret = @client.echo(bag) + assert_equal( + [ + p1["name"].text, p1["Rating"].text, + p2["name"].text, p2["Rating"].text, + version, yesno, + r1.text, r2.text, r3.text, + c11.text, c11.extraattr["msgid"], + c12.text, c12.extraattr["msgid"], + c21.text, c21.extraattr["msgid"], + c22.text, c22.extraattr["msgid"] + ].join(" "), + ret + ) + assert_equal("role", ret.xmlattr_Role) + end + + def test_wsdl_with_classdef + wsdl = File.join(DIR, 'product.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.literal_mapping_registry = ProductMappingRegistry::LiteralRegistry + @client.wiredump_dev = STDOUT if $DEBUG + p1 = Product.new("foo", Rating::C_0) + p2 = Product.new("bar", Rating::C_1) + version = "version" + yesno = Yesno::Y + r1 = Rating::C_0 + r2 = Rating::C_1 + r3 = Rating::C_1_2 + c11 = ::SOAP::SOAPElement.new("Comment_1", "comment11") + c11.extraattr["msgid"] = "msgid11" + c12 = ::SOAP::SOAPElement.new("Comment_1", "comment12") + c12.extraattr["msgid"] = "msgid12" + c21 = Comment.new("comment21") + c21.xmlattr_msgid = "msgid21" + c22 = Comment.new("comment22") + c22.xmlattr_msgid = "msgid22" + bag = ProductBag.new([p1, p2], [r1, r2, r3], [c11, c12], [c21, c22]) + bag.xmlattr_version = version + bag.xmlattr_yesno = yesno + ret = @client.echo(bag) + assert_equal( + [ + p1.name, p1.rating, + p2.name, p2.rating, + version, yesno, + r1, r2, r3, + c11.text, c11.extraattr["msgid"], + c12.text, c12.extraattr["msgid"], + c21, c21.xmlattr_msgid, + c22, c22.xmlattr_msgid + ].join(" "), + ret + ) + assert_equal("role", ret.xmlattr_Role) + end + + def test_naive + @client = Ref_porttype.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDOUT if $DEBUG + p1 = Product.new("foo", Rating::C_0) + p2 = Product.new("bar", Rating::C_1) + version = "version" + yesno = Yesno::Y + r1 = Rating::C_0 + r2 = Rating::C_1 + r3 = Rating::C_1_2 + c11 = ::SOAP::SOAPElement.new("Comment_1", "comment11") + c11.extraattr["msgid"] = "msgid11" + c12 = ::SOAP::SOAPElement.new("Comment_1", "comment12") + c12.extraattr["msgid"] = "msgid12" + c21 = Comment.new("comment21") + c21.xmlattr_msgid = "msgid21" + c22 = Comment.new("comment22") + c22.xmlattr_msgid = "msgid22" + pts = C__point.new("123") + bag = ProductBag.new([p1, p2], [r1, r2, r3], [c11, c12], [c21, c22], pts) + bag.xmlattr_version = version + bag.xmlattr_yesno = yesno + ret = @client.echo(bag) + assert_equal( + [ + p1.name, p1.rating, + p2.name, p2.rating, + version, yesno, + r1, r2, r3, + c11.text, c11.extraattr["msgid"], + c12.text, c12.extraattr["msgid"], + c21, c21.xmlattr_msgid, + c22, c22.xmlattr_msgid + ].join(" "), + ret + ) + assert_equal("role", ret.xmlattr_Role) + end + + def e(name, text = nil) + ::SOAP::SOAPElement.new(name, text) + end + + def q(ns, name) + XSD::QName.new(ns, name) + end +end + + +end +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/rpc.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/rpc.wsdl new file mode 100644 index 00000000..3e0c6ef4 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/rpc.wsdl @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/test-rpc-lit.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/test-rpc-lit.wsdl new file mode 100644 index 00000000..cda94e52 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/test-rpc-lit.wsdl @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/test_rpc.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/test_rpc.rb new file mode 100644 index 00000000..8b54a060 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/test_rpc.rb @@ -0,0 +1,176 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module RPC + + +class TestRPC < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + def on_init + add_rpc_method(self, 'echo', 'arg1', 'arg2') + add_rpc_method(self, 'echo_basetype', 'arg1', 'arg2') + add_rpc_method(self, 'echo_err', 'arg1', 'arg2') + self.mapping_registry = Prefix::EchoMappingRegistry::EncodedRegistry + end + + DummyPerson = Struct.new("family-name".intern, :Given_name) + def echo(arg1, arg2) + if arg1.given_name == 'typed' + self.generate_explicit_type = true + else + self.generate_explicit_type = false + end + ret = nil + case arg1.family_name + when 'normal' + arg1.family_name = arg2.family_name + arg1.given_name = arg2.given_name + arg1.age = arg2.age + ret = arg1 + when 'dummy' + ret = DummyPerson.new("family-name", "given_name") + when 'nil' + ret = Prefix::Person.new(nil, nil) + else + raise + end + ret + end + + def echo_basetype(arg1, arg2) + return nil if arg1.nil? and arg2.nil? + raise unless arg1.is_a?(Date) + arg1 + end + + ErrPerson = Struct.new(:Given_name, :no_such_element) + def echo_err(arg1, arg2) + self.generate_explicit_type = false + ErrPerson.new(58, Time.now) + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('echo.rb')) + File.unlink(pathname('echoMappingRegistry.rb')) + File.unlink(pathname('echoDriver.rb')) + end + @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 = TestUtil.start_server_thread(@server) + end + + def setup_classdef + if ::Object.constants.include?("Echo") + ::Object.instance_eval { remove_const("Echo") } + end + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("rpc.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.opt['module_path'] = 'Prefix' + gen.run + TestUtil.require(DIR, 'echo.rb', 'echoMappingRegistry.rb', 'echoDriver.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + 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 = STDERR if $DEBUG + + ret = @client.echo(Prefix::Person.new("normal", "typed", 12, Prefix::Gender::F), Prefix::Person.new("Hi", "Na", 21, Prefix::Gender::M)) + assert_equal("Hi", ret.family_name) + assert_equal("Na", ret.given_name) + assert_equal(21, ret.age) + + ret = @client.echo(Prefix::Person.new("normal", "untyped", 12, Prefix::Gender::F), Prefix::Person.new("Hi", "Na", 21, Prefix::Gender::M)) + assert_equal("Hi", ret.family_name) + assert_equal("Na", ret.given_name) + # XXX WSDLEncodedRegistry should decode untyped element using Schema + assert_equal("21", ret.age) + + ret = @client.echo(Prefix::Person.new("dummy", "typed", 12, Prefix::Gender::F), Prefix::Person.new("Hi", "Na", 21, Prefix::Gender::M)) + assert_equal("family-name", ret.family_name) + assert_equal("given_name", ret.given_name) + + ret = @client.echo_err(Prefix::Person.new("Na", "Hi", nil, Prefix::Gender::F), Prefix::Person.new("Hi", "Na", nil, Prefix::Gender::M)) + assert_equal("58", ret.given_name) + end + + def test_stub + @client = Prefix::Echo_port_type.new("http://localhost:#{Port}/") + @client.mapping_registry = Prefix::EchoMappingRegistry::EncodedRegistry + @client.wiredump_dev = STDERR if $DEBUG + + ret = @client.echo(Prefix::Person.new("normal", "typed", 12, Prefix::Gender::F), Prefix::Person.new("Hi", "Na", 21, Prefix::Gender::M)) + assert_equal(Prefix::Person, ret.class) + assert_equal("Hi", ret.family_name) + assert_equal("Na", ret.given_name) + assert_equal(21, ret.age) + + ret = @client.echo(Prefix::Person.new("normal", "untyped", 12, Prefix::Gender::F), Prefix::Person.new("Hi", "Na", 21, Prefix::Gender::M)) + assert_equal(Prefix::Person, ret.class) + assert_equal("Hi", ret.family_name) + assert_equal("Na", ret.given_name) + assert_equal(21, ret.age) + end + + def test_stub_nil + @client = Prefix::Echo_port_type.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDOUT if $DEBUG + + ret = @client.echo(Prefix::Person.new("nil", "", 12, Prefix::Gender::F), Prefix::Person.new("Hi", "Na", 21, Prefix::Gender::M)) + assert_nil(ret.family_name) + assert_nil(ret.given_name) + assert_nil(ret.age) + # + assert_nil(@client.echo_basetype(nil, nil)) + end + + def test_basetype_stub + @client = Prefix::Echo_port_type.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDERR if $DEBUG + + ret = @client.echo_basetype(Time.now, 12345) + assert_equal(Date, ret.class) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/test_rpc_lit.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/test_rpc_lit.rb new file mode 100644 index 00000000..fe6cadd1 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/rpc/test_rpc_lit.rb @@ -0,0 +1,460 @@ +require 'test/unit' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +if defined?(HTTPClient) 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 + self.literal_mapping_registry = RPCLiteralTestDefinitionsMappingRegistry::LiteralRegistry + 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_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('RPC-Literal-TestDefinitions.rb')) + File.unlink(pathname('RPC-Literal-TestDefinitionsMappingRegistry.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 = TestUtil.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['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'RPC-Literal-TestDefinitions.rb', 'RPC-Literal-TestDefinitionsMappingRegistry.rb', 'RPC-Literal-TestDefinitionsDriver.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + 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[ + + + + + a + b + c + + + +] + + ECHO_STRING_ARRAY_RESPONSE = +%q[ + + + + + a + b + c + + + +] + + def test_stub_echoStringArray + drv = SoapTestPortTypeRpcLit.new("http://localhost:#{Port}/") + drv.wiredump_dev = str = '' + drv.generate_explicit_type = false + # response contains only 1 part. + result = drv.echoStringArray(ArrayOfstring["a", "b", "c"])[0] + assert_equal(ECHO_STRING_ARRAY_REQUEST, parse_requestxml(str), + [ECHO_STRING_ARRAY_REQUEST, parse_requestxml(str)].join("\n\n")) + assert_equal(ECHO_STRING_ARRAY_RESPONSE, parse_responsexml(str), + [ECHO_STRING_ARRAY_RESPONSE, parse_responsexml(str)].join("\n\n")) + assert_equal(ArrayOfstring["a", "b", "c"], result) + end + + ECHO_STRING_ARRAY_INLINE_REQUEST = +%q[ + + + + + a + b + c + + + +] + + ECHO_STRING_ARRAY_INLINE_RESPONSE = +%q[ + + + + + a + b + c + + + +] + + def test_stub_echoStringArrayInline + drv = SoapTestPortTypeRpcLit.new("http://localhost:#{Port}/") + drv.wiredump_dev = str = '' + drv.generate_explicit_type = false + # response contains only 1 part. + result = drv.echoStringArrayInline(ArrayOfstringInline["a", "b", "c"])[0] + assert_equal(ArrayOfstring["a", "b", "c"], result) + assert_equal(ECHO_STRING_ARRAY_INLINE_REQUEST, parse_requestxml(str), + [ECHO_STRING_ARRAY_INLINE_REQUEST, parse_requestxml(str)].join("\n\n")) + assert_equal(ECHO_STRING_ARRAY_INLINE_RESPONSE, parse_responsexml(str)) + end + + ECHO_NESTED_STRUCT_REQUEST = +%q[ + + + + + str + 1 + +1 + + str + 1 + +1 + + + + +] + + ECHO_NESTED_STRUCT_RESPONSE = +%q[ + + + + + str + 1 + +1 + + str + 1 + +1 + + + + +] + + 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 = '' + @client.generate_explicit_type = false + # 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), + [ECHO_NESTED_STRUCT_REQUEST, parse_requestxml(str)].join("\n\n")) + assert_equal(ECHO_NESTED_STRUCT_RESPONSE, parse_responsexml(str)) + end + + ECHO_NESTED_STRUCT_REQUEST_NIL = +%q[ + + + + + str + +1 + + str + + +1 + + + + +] + + ECHO_NESTED_STRUCT_RESPONSE_NIL = +%q[ + + + + + str + +1 + + str + +1 + + + + +] + def test_wsdl_echoNestedStruct_nil + wsdl = pathname('test-rpc-lit.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = str = '' + @client.generate_explicit_type = false + result = @client.echoNestedStruct(SOAPStructStruct.new("str", nil, 1.0, SOAPStruct.new("str", ::SOAP::SOAPNil.new, 1.0)))[0] + assert(!result.respond_to?(:varInt)) + assert(result.respond_to?(:varString)) + assert_equal(ECHO_NESTED_STRUCT_REQUEST_NIL, parse_requestxml(str), + [ECHO_NESTED_STRUCT_REQUEST_NIL, parse_requestxml(str)].join("\n\n")) + assert_equal(ECHO_NESTED_STRUCT_RESPONSE_NIL, parse_responsexml(str)) + end + + def test_stub_echoNestedStruct + drv = SoapTestPortTypeRpcLit.new("http://localhost:#{Port}/") + drv.wiredump_dev = str = '' + drv.generate_explicit_type = false + # 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.0, result.varFloat) + assert_equal('str', result.structItem.varString) + assert_equal(1, result.structItem.varInt) + assert_equal(1.0, 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_nil + drv = SoapTestPortTypeRpcLit.new("http://localhost:#{Port}/") + drv.wiredump_dev = str = '' + drv.generate_explicit_type = false + # response contains only 1 part. + result = drv.echoNestedStruct(SOAPStructStruct.new("str", nil, 1.0, SOAPStruct.new("str", ::SOAP::SOAPNil.new, 1.0)))[0] + assert(result.respond_to?(:varInt)) + assert(result.respond_to?(:varString)) + assert_equal(ECHO_NESTED_STRUCT_REQUEST_NIL, parse_requestxml(str), + [ECHO_NESTED_STRUCT_REQUEST_NIL, parse_requestxml(str)].join("\n\n")) + assert_equal(ECHO_NESTED_STRUCT_RESPONSE_NIL, parse_responsexml(str)) + end + + ECHO_STRUCT_ARRAY_REQUEST = +%q[ + + + + + + str + 2 + +2.1 + + + str + 2 + +2.1 + + + + +] + + ECHO_STRUCT_ARRAY_RESPONSE = +%q[ + + + + + + str + 2 + +2.1 + + + str + 2 + +2.1 + + + + +] + + 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 = '' + @client.generate_explicit_type = false + # 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), + [ECHO_STRUCT_ARRAY_REQUEST, parse_requestxml(str)].join("\n\n")) + assert_equal(ECHO_STRUCT_ARRAY_RESPONSE, parse_responsexml(str)) + end + + def test_stub_echoStructArray + drv = SoapTestPortTypeRpcLit.new("http://localhost:#{Port}/") + drv.wiredump_dev = str = '' + drv.generate_explicit_type = false + # 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/vendor/gems/soap4r-1.5.8/test/wsdl/simplecontent/simplecontent.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/simplecontent/simplecontent.wsdl new file mode 100644 index 00000000..79e1f4de --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simplecontent/simplecontent.wsdl @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/simplecontent/test_simplecontent.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/simplecontent/test_simplecontent.rb new file mode 100644 index 00000000..d587286f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simplecontent/test_simplecontent.rb @@ -0,0 +1,102 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module SimpleContent + + +class TestSimpleContent < Test::Unit::TestCase + NS = 'urn:www.example.org:simpleContent' + class Server < ::SOAP::RPC::StandaloneServer + def on_init + SimpleContentService::Methods.each do |definition| + add_document_operation(self, *definition) + end + self.literal_mapping_registry = + SimpleContentMappingRegistry::LiteralRegistry + end + + def echo(address) + address + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('simpleContent.rb')) + File.unlink(pathname('simpleContentMappingRegistry.rb')) + File.unlink(pathname('simpleContentDriver.rb')) + end + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', "urn:www.example.org:simpleContent", '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("simplecontent.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.opt['module_path'] = 'WSDL::SimpleContent' + gen.run + TestUtil.require(DIR, 'simpleContent.rb', 'simpleContentMappingRegistry.rb', 'simpleContentDriver.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_stub + @client = SimpleContentService.new("http://localhost:#{Port}/") + @client.wiredump_dev = STDERR if $DEBUG + + list = PhoneList.new + list.xmlattr_default = "default" + phone1 = PhoneNumber.new("12<>345") + phone1.xmlattr_type = PhoneNumberType::Fax + phone2 = PhoneNumber.new("234<>56") + phone2.xmlattr_type = PhoneNumberType::Home + list.phone << phone1 << phone2 + address = Address.new(list, "addr") + ret = @client.echo(address) + + assert_equal(address.blah, ret.blah) + assert_equal(2, ret.list.phone.size) + assert_equal("12<>345", ret.list.phone[0]) + assert_equal(PhoneNumberType::Fax, ret.list.phone[0].xmlattr_type) + assert_equal("234<>56", ret.list.phone[1]) + assert_equal(PhoneNumberType::Home, ret.list.phone[1].xmlattr_type) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedClient.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedClient.rb new file mode 100644 index 00000000..94a77396 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedClient.rb @@ -0,0 +1,32 @@ +#!/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/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedDriver.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedDriver.rb new file mode 100644 index 00000000..6491ba83 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedDriver.rb @@ -0,0 +1,57 @@ +require 'echo_version.rb' +require 'echo_versionMappingRegistry.rb' +require 'soap/rpc/driver' + +class Echo_version_port_type < ::SOAP::RPC::Driver + DefaultEndpointUrl = "http://localhost:10080" + NsSimpletypeRpc = "urn:example.com:simpletype-rpc" + + Methods = [ + [ XSD::QName.new(NsSimpletypeRpc, "echo_version"), + "urn:example.com:simpletype-rpc", + "echo_version", + [ ["in", "version", [nil, "urn:example.com:simpletype-rpc-type", "version"]], + ["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, + :faults => {} } + ], + [ XSD::QName.new(NsSimpletypeRpc, "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", [nil, "urn:example.com:simpletype-rpc-type", "version"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ] + ] + + def initialize(endpoint_url = nil) + endpoint_url ||= DefaultEndpointUrl + super(endpoint_url, nil) + self.mapping_registry = Echo_versionMappingRegistry::EncodedRegistry + self.literal_mapping_registry = Echo_versionMappingRegistry::LiteralRegistry + 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/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedEchoVersion.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedEchoVersion.rb new file mode 100644 index 00000000..8e606d3a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedEchoVersion.rb @@ -0,0 +1,36 @@ +require 'xsd/qname' + +# {urn:example.com:simpletype-rpc-type}version_struct +# version - Version +# msg - SOAP::SOAPString +class Version_struct + 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 +class Version < ::String + C_16 = Version.new("1.6") + C_18 = Version.new("1.8") + C_19 = Version.new("1.9") +end + +# {urn:example.com:simpletype-rpc-type}stateType +class StateType < ::String + StateType = StateType.new("stateType") +end + +# {urn:example.com:simpletype-rpc-type}zipIntType +class ZipIntType < ::String + C_123 = ZipIntType.new("123") +end + +# {urn:example.com:simpletype-rpc-type}zipUnion +# any of tns:stateType tns:zipIntType +class ZipUnion < ::String +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedMappingRegistry.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedMappingRegistry.rb new file mode 100644 index 00000000..8e4abb67 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedMappingRegistry.rb @@ -0,0 +1,57 @@ +require 'echo_version.rb' +require 'soap/mapping' + +module Echo_versionMappingRegistry + EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new + LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new + NsSimpletypeRpcType = "urn:example.com:simpletype-rpc-type" + + EncodedRegistry.register( + :class => Version_struct, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "version_struct"), + :schema_element => [ + ["version", ["Version", XSD::QName.new(nil, "version")]], + ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]] + ] + ) + + EncodedRegistry.register( + :class => Version, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "version") + ) + + EncodedRegistry.register( + :class => StateType, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "stateType") + ) + + EncodedRegistry.register( + :class => ZipIntType, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "zipIntType") + ) + + LiteralRegistry.register( + :class => Version_struct, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "version_struct"), + :schema_element => [ + ["version", ["Version", XSD::QName.new(nil, "version")]], + ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]] + ] + ) + + LiteralRegistry.register( + :class => Version, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "version") + ) + + LiteralRegistry.register( + :class => StateType, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "stateType") + ) + + LiteralRegistry.register( + :class => ZipIntType, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "zipIntType") + ) + +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedServant.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedServant.rb new file mode 100644 index 00000000..0ad4892a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedServant.rb @@ -0,0 +1,31 @@ +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/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedService.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedService.rb new file mode 100644 index 00000000..ba3add58 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/expectedService.rb @@ -0,0 +1,55 @@ +#!/usr/bin/env ruby +require 'echo_versionServant.rb' +require 'echo_versionMappingRegistry.rb' +require 'soap/rpc/standaloneServer' + +class Echo_version_port_type + NsSimpletypeRpc = "urn:example.com:simpletype-rpc" + + Methods = [ + [ XSD::QName.new(NsSimpletypeRpc, "echo_version"), + "urn:example.com:simpletype-rpc", + "echo_version", + [ ["in", "version", [nil, "urn:example.com:simpletype-rpc-type", "version"]], + ["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, + :faults => {} } + ], + [ XSD::QName.new(NsSimpletypeRpc, "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", [nil, "urn:example.com:simpletype-rpc-type", "version"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ] + ] +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_versionMappingRegistry::EncodedRegistry + self.literal_mapping_registry = Echo_versionMappingRegistry::LiteralRegistry + 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/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/rpc.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/rpc.wsdl new file mode 100644 index 00000000..59523419 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/rpc.wsdl @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/test_rpc.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/test_rpc.rb new file mode 100644 index 00000000..d913642a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/rpc/test_rpc.rb @@ -0,0 +1,52 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', '..', 'testutil.rb') + + +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['mapping_registry'] = 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 + TestUtil.silent do + gen.run + end + compare("expectedEchoVersion.rb", "echo_version.rb") + compare("expectedMappingRegistry.rb", "echo_versionMappingRegistry.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_versionMappingRegistry.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) + TestUtil.filecompare(pathname(expected), pathname(actual)) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/simpletype.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/simpletype.wsdl new file mode 100644 index 00000000..c497ca17 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/simpletype.wsdl @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/test_simpletype.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/test_simpletype.rb new file mode 100644 index 00000000..578f4cbf --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/simpletype/test_simpletype.rb @@ -0,0 +1,92 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +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 = TestUtil.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 if @server + teardown_client if @client + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def teardown_client + @client.reset_stream + 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/vendor/gems/soap4r-1.5.8/test/wsdl/soap/soapbodyparts.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/soapbodyparts.wsdl new file mode 100644 index 00000000..63e950ab --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/soapbodyparts.wsdl @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soap/test_soapbodyparts.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/test_soapbodyparts.rb new file mode 100644 index 00000000..9152ced4 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/test_soapbodyparts.rb @@ -0,0 +1,79 @@ +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 if @server + teardown_client if @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/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb new file mode 100644 index 00000000..1407c71f --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb @@ -0,0 +1,21 @@ +require 'xsd/qname' + +# {urn:example.com:simpletype-rpc-type}version_struct +# version - Version +# msg - SOAP::SOAPString +class Version_struct + 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 +class Version < ::String + C_16 = Version.new("1.6") + C_18 = Version.new("1.8") + C_19 = Version.new("1.9") +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedClient.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedClient.rb new file mode 100644 index 00000000..94a77396 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedClient.rb @@ -0,0 +1,32 @@ +#!/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/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedDriver.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedDriver.rb new file mode 100644 index 00000000..6491ba83 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedDriver.rb @@ -0,0 +1,57 @@ +require 'echo_version.rb' +require 'echo_versionMappingRegistry.rb' +require 'soap/rpc/driver' + +class Echo_version_port_type < ::SOAP::RPC::Driver + DefaultEndpointUrl = "http://localhost:10080" + NsSimpletypeRpc = "urn:example.com:simpletype-rpc" + + Methods = [ + [ XSD::QName.new(NsSimpletypeRpc, "echo_version"), + "urn:example.com:simpletype-rpc", + "echo_version", + [ ["in", "version", [nil, "urn:example.com:simpletype-rpc-type", "version"]], + ["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, + :faults => {} } + ], + [ XSD::QName.new(NsSimpletypeRpc, "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", [nil, "urn:example.com:simpletype-rpc-type", "version"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ] + ] + + def initialize(endpoint_url = nil) + endpoint_url ||= DefaultEndpointUrl + super(endpoint_url, nil) + self.mapping_registry = Echo_versionMappingRegistry::EncodedRegistry + self.literal_mapping_registry = Echo_versionMappingRegistry::LiteralRegistry + 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/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb new file mode 100644 index 00000000..530800cf --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb @@ -0,0 +1,36 @@ +require 'echo_version.rb' +require 'soap/mapping' + +module Echo_versionMappingRegistry + EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new + LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new + NsSimpletypeRpcType = "urn:example.com:simpletype-rpc-type" + + EncodedRegistry.register( + :class => Version_struct, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "version_struct"), + :schema_element => [ + ["version", ["Version", XSD::QName.new(nil, "version")]], + ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]] + ] + ) + + EncodedRegistry.register( + :class => Version, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "version") + ) + + LiteralRegistry.register( + :class => Version_struct, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "version_struct"), + :schema_element => [ + ["version", ["Version", XSD::QName.new(nil, "version")]], + ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]] + ] + ) + + LiteralRegistry.register( + :class => Version, + :schema_type => XSD::QName.new(NsSimpletypeRpcType, "version") + ) +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedServant.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedServant.rb new file mode 100644 index 00000000..0ad4892a --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedServant.rb @@ -0,0 +1,31 @@ +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/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedService.cgi b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedService.cgi new file mode 100644 index 00000000..e8d761e2 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedService.cgi @@ -0,0 +1,48 @@ +#!/usr/bin/env ruby +require 'echo_versionServant.rb' +require 'echo_versionMappingRegistry.rb' +require 'soap/rpc/cgistub' + +class Echo_version_port_type + NsSimpletypeRpc = "urn:example.com:simpletype-rpc" + + Methods = [ + [ XSD::QName.new(NsSimpletypeRpc, "echo_version"), + "urn:example.com:simpletype-rpc", + "echo_version", + [ ["in", "version", [nil, "urn:example.com:simpletype-rpc-type", "version"]], + ["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, + :faults => {} } + ], + [ XSD::QName.new(NsSimpletypeRpc, "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", [nil, "urn:example.com:simpletype-rpc-type", "version"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ] + ] +end + +class Echo_version_port_typeApp < ::SOAP::RPC::CGIStub + 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_versionMappingRegistry::EncodedRegistry + self.literal_mapping_registry = Echo_versionMappingRegistry::LiteralRegistry + self.level = Logger::Severity::ERROR + end +end +Echo_version_port_typeApp.new('app', nil).start diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedService.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedService.rb new file mode 100644 index 00000000..ba3add58 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/expectedService.rb @@ -0,0 +1,55 @@ +#!/usr/bin/env ruby +require 'echo_versionServant.rb' +require 'echo_versionMappingRegistry.rb' +require 'soap/rpc/standaloneServer' + +class Echo_version_port_type + NsSimpletypeRpc = "urn:example.com:simpletype-rpc" + + Methods = [ + [ XSD::QName.new(NsSimpletypeRpc, "echo_version"), + "urn:example.com:simpletype-rpc", + "echo_version", + [ ["in", "version", [nil, "urn:example.com:simpletype-rpc-type", "version"]], + ["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, + :faults => {} } + ], + [ XSD::QName.new(NsSimpletypeRpc, "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", [nil, "urn:example.com:simpletype-rpc-type", "version"]] ], + { :request_style => :rpc, :request_use => :encoded, + :response_style => :rpc, :response_use => :encoded, + :faults => {} } + ] + ] +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_versionMappingRegistry::EncodedRegistry + self.literal_mapping_registry = Echo_versionMappingRegistry::LiteralRegistry + 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/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/rpc.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/rpc.wsdl new file mode 100644 index 00000000..91f71a88 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/rpc.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb new file mode 100644 index 00000000..4fb193d3 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb @@ -0,0 +1,37 @@ +require 'xsd/qname' + +# {urn:mysample}question +# something - SOAP::SOAPString +class Question + attr_accessor :something + + def initialize(something = nil) + @something = something + end +end + +# {urn:mysample}section +# sectionID - SOAP::SOAPInt +# name - SOAP::SOAPString +# description - SOAP::SOAPString +# index - SOAP::SOAPInt +# firstQuestion - Question +class Section + attr_accessor :sectionID + attr_accessor :name + attr_accessor :description + attr_accessor :index + attr_accessor :firstQuestion + + def initialize(sectionID = nil, name = nil, description = nil, index = nil, firstQuestion = nil) + @sectionID = sectionID + @name = name + @description = description + @index = index + @firstQuestion = firstQuestion + end +end + +# {urn:mysample}sectionArray +class SectionArray < ::Array +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/section/section.xsd b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/section/section.xsd new file mode 100644 index 00000000..aee6557b --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/section/section.xsd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/section/test_section.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/section/test_section.rb new file mode 100644 index 00000000..2c04c858 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/section/test_section.rb @@ -0,0 +1,53 @@ +require 'test/unit' +require 'soap/marshal' +require 'rbconfig' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', '..', '..', 'testutil.rb') + + +module WSDL; module SOAP + + +class TestSection < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + RUBY = Config::CONFIG['RUBY_INSTALL_NAME'] + + def setup + system("cd #{DIR} && #{RUBY} #{pathname("../../../../../bin/xsd2ruby.rb")} --xsd #{pathname("section.xsd")} --classdef --force --quiet") + end + + def teardown + File.unlink(pathname("mysample.rb")) unless $DEBUG + end + + def test_classdef + compare("expectedClassdef.rb", "mysample.rb") + end + + def test_marshal + # avoid name crash ( => an Item when a class Item is defined) + if ::Object.constants.include?("Item") + ::Object.instance_eval { remove_const("Item") } + end + TestUtil.require(DIR, 'mysample.rb') + s1 = Section.new(1, "section1", "section 1", 1001, Question.new("q1")) + s2 = Section.new(2, "section2", "section 2", 1002, Question.new("q2")) + org = SectionArray[s1, s2] + obj = ::SOAP::Marshal.unmarshal(::SOAP::Marshal.marshal(org)) + assert_equal(SectionArray, obj.class) + assert_equal(Section, obj[0].class) + assert_equal(Question, obj[0].firstQuestion.class) + end + +private + + def pathname(filename) + File.join(DIR, filename) + end + + def compare(expected, actual) + TestUtil.filecompare(pathname(expected), pathname(actual)) + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/soapenc/soapenc.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/soapenc/soapenc.wsdl new file mode 100644 index 00000000..63ffb766 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/soapenc/soapenc.wsdl @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb new file mode 100644 index 00000000..597f7aed --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb @@ -0,0 +1,83 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', '..', '..', 'testutil.rb') + + +module WSDL; module SOAP; module T_WSDL2Ruby + + +class TestSOAPENC < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + def on_init + add_rpc_method(self, 'echo_version', 'version') + end + + def echo_version(version) + Version_struct.new(version, "hello") + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_classdef + setup_server + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('echo.rb')) + end + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', "urn:example.com:soapenc", '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_classdef + if ::Object.constants.include?("Version_struct") + ::Object.instance_eval { remove_const("Version_struct") } + end + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("soapenc.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'echo.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + + def test_wsdl + wsdl = File.join(DIR, 'soapenc.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + ret = @client.echo_version(T_version::C_19) + assert_equal(T_version::C_19, ret.version) + assert_equal("hello", ret.msg) + end +end + + +end; end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/test_wsdl2ruby.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/test_wsdl2ruby.rb new file mode 100644 index 00000000..ed7239bb --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soap/wsdl2ruby/test_wsdl2ruby.rb @@ -0,0 +1,71 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', '..', 'testutil.rb') + + +module WSDL; module SOAP + + +class TestWSDL2Ruby < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + + def setup + Dir.chdir(DIR) do + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("rpc.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['client_skelton'] = nil + gen.opt['servant_skelton'] = nil + gen.opt['cgi_stub'] = nil + gen.opt['standalone_server_stub'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + TestUtil.silent do + gen.run + end + end + end + + def teardown + # leave generated file for debug. + end + + def test_rpc + compare("expectedServant.rb", "echo_versionServant.rb") + compare("expectedClassdef.rb", "echo_version.rb") + compare("expectedService.rb", "echo_version_service.rb") + compare("expectedService.cgi", "echo_version_service.cgi") + compare("expectedMappingRegistry.rb", "echo_versionMappingRegistry.rb") + compare("expectedDriver.rb", "echo_versionDriver.rb") + compare("expectedClient.rb", "echo_version_serviceClient.rb") + + File.unlink(pathname("echo_versionServant.rb")) + File.unlink(pathname("echo_version.rb")) + File.unlink(pathname("echo_version_service.rb")) + File.unlink(pathname("echo_version_service.cgi")) + File.unlink(pathname("echo_versionMappingRegistry.rb")) + File.unlink(pathname("echo_versionDriver.rb")) + File.unlink(pathname("echo_version_serviceClient.rb")) + end + +private + + def pathname(filename) + File.join(DIR, filename) + end + + def compare(expected, actual) + TestUtil.filecompare(pathname(expected), pathname(actual)) + end + + def loadfile(file) + File.open(pathname(file)) { |f| f.read } + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soaptype/soaptype.wsdl b/vendor/gems/soap4r-1.5.8/test/wsdl/soaptype/soaptype.wsdl new file mode 100644 index 00000000..f07ae118 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soaptype/soaptype.wsdl @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/soaptype/test_soaptype.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/soaptype/test_soaptype.rb new file mode 100644 index 00000000..87ec093d --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/soaptype/test_soaptype.rb @@ -0,0 +1,178 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module WSDL; module RPC + + +class TestSOAPTYPE < Test::Unit::TestCase + include ::SOAP + + class Server < ::SOAP::RPC::StandaloneServer + include ::SOAP + + def on_init + #self.generate_explicit_type = false + add_rpc_method(self, 'echo_soaptype', 'arg') + end + + def echo_soaptype(arg) + res = Wrapper.new + res.short = SOAPShort.new(arg.short) + res.long = SOAPLong.new(arg.long) + res.double = SOAPFloat.new(arg.double) + res + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_server + setup_classdef + @client = nil + end + + def teardown + teardown_server if @server + unless $DEBUG + File.unlink(pathname('echo.rb')) + File.unlink(pathname('echoMappingRegistry.rb')) + File.unlink(pathname('echoDriver.rb')) + end + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', "urn:soaptype", '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = TestUtil.start_server_thread(@server) + end + + def setup_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("soaptype.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['driver'] = nil + gen.opt['force'] = true + gen.opt['module_path'] = self.class.to_s.sub(/::[^:]+$/, '') + gen.run + TestUtil.require(DIR, 'echo.rb', 'echoMappingRegistry.rb', 'echoDriver.rb') + end + + def teardown_server + @server.shutdown + @server_thread.kill + @server_thread.join + end + + def pathname(filename) + File.join(DIR, filename) + end + +SOAPTYPE_WSDL_XML = %q[ + + + + + 123 + 456 + +789 + + + +] + +SOAPTYPE_NATIVE_XML = %q[ + + + + + 123 + 456 + +789 + + + +] + + def test_wsdl + wsdl = File.join(DIR, 'soaptype.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = str = '' + + arg = Wrapper.new + arg.short = 123 + arg.long = 456 + arg.double = 789 + res = @client.echo_soaptype(arg) + + assert_equal(123, res.short) + assert_equal(456, res.long) + assert_equal(789.0, res.double) + + assert_equal(SOAPTYPE_WSDL_XML, parse_requestxml(str)) + end + + def test_stub + @client = WSDL::RPC::Echo_port_type.new("http://localhost:#{Port}/") + @client.wiredump_dev = str = '' + + arg = WSDL::RPC::Wrapper.new + arg.short = 123 + arg.long = 456 + arg.double = 789 + res = @client.echo_soaptype(arg) + + assert_equal(123, res.short) + assert_equal(456, res.long) + assert_equal(789.0, res.double) + + assert_equal(SOAPTYPE_WSDL_XML, parse_requestxml(str)) + end + + def test_native + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/", 'urn:soaptype') + @client.endpoint_url = "http://localhost:#{Port}/" + @client.add_method('echo_soaptype', 'arg') + @client.wiredump_dev = str = '' + @client.mapping_registry = WSDL::RPC::EchoMappingRegistry::EncodedRegistry + @client.literal_mapping_registry = WSDL::RPC::EchoMappingRegistry::LiteralRegistry + + arg = ::Struct.new(:short, :long, :double).new + arg.short = SOAPShort.new(123) + arg.long = SOAPLong.new(456) + arg.double = SOAPDouble.new(789) + res = @client.echo_soaptype(arg) + + assert_equal(123, res.short) + assert_equal(456, res.long) + assert_equal(789.0, res.double) + + assert_equal(SOAPTYPE_NATIVE_XML, parse_requestxml(str)) + end + + def parse_requestxml(str) + str.split(/\r?\n\r?\n/)[3] + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/test_emptycomplextype.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/test_emptycomplextype.rb new file mode 100644 index 00000000..71d1b864 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/test_emptycomplextype.rb @@ -0,0 +1,21 @@ +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/vendor/gems/soap4r-1.5.8/test/wsdl/test_fault.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/test_fault.rb new file mode 100644 index 00000000..ba584300 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/test_fault.rb @@ -0,0 +1,50 @@ +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__ + + + + + Server + faultstring + faultactor + + type + + + + 5 + + +__EOX__ + end + + def test_by_wsdl + rpc_decode_typemap = WSDL::Definitions.soap_rpc_complextypes + opt = {} + opt[:default_encodingstyle] = ::SOAP::EncodingNamespace + 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("faultactor", fault.faultactor) + assert_equal(5, fault.detail.cause) + end +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/wsdl/test_multiplefault.rb b/vendor/gems/soap4r-1.5.8/test/wsdl/test_multiplefault.rb new file mode 100644 index 00000000..94381974 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/wsdl/test_multiplefault.rb @@ -0,0 +1,41 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/classDefCreator' +require 'wsdl/soap/classNameCreator' + + +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 }) + name_creator = WSDL::SOAP::ClassNameCreator.new + classdefstr = WSDL::SOAP::ClassDefCreator.new(@wsdl, name_creator).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/vendor/gems/soap4r-1.5.8/test/xsd/codegen/test_classdef.rb b/vendor/gems/soap4r-1.5.8/test/xsd/codegen/test_classdef.rb new file mode 100644 index 00000000..f9ad5821 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/codegen/test_classdef.rb @@ -0,0 +1,244 @@ +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_innermodule + c = ClassDef.new("Foo") + c.def_const("BAR", 1) + c.def_method('baz') { "Qux.new.quxx" } + c2 = ClassDef.new("Qux") + c2.def_method('quxx') { "Quxx::QUXXX" } + m3 = ModuleDef.new("Quxx") + m3.def_const("QUXXX", 2) + c.innermodule << c2 << m3 + assert_equal(format(<<-EOD), c.dump) + class Foo + BAR = 1 + + class Qux + def quxx + Quxx::QUXXX + end + end + + module Quxx + QUXXX = 2 + end + + def baz + Qux.new.quxx + 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/vendor/gems/soap4r-1.5.8/test/xsd/noencoding.xml b/vendor/gems/soap4r-1.5.8/test/xsd/noencoding.xml new file mode 100644 index 00000000..614ffa34 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/noencoding.xml @@ -0,0 +1,4 @@ + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/xsd/test_noencoding.rb b/vendor/gems/soap4r-1.5.8/test/xsd/test_noencoding.rb new file mode 100644 index 00000000..48119ec1 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/test_noencoding.rb @@ -0,0 +1,32 @@ +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/vendor/gems/soap4r-1.5.8/test/xsd/test_ns.rb b/vendor/gems/soap4r-1.5.8/test/xsd/test_ns.rb new file mode 100644 index 00000000..37d43002 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/test_ns.rb @@ -0,0 +1,41 @@ +require 'test/unit' +require 'soap/marshal' + + +module XSD + + +class TestNS < Test::Unit::TestCase + def test_xmllang + @file = File.join(File.dirname(File.expand_path(__FILE__)), 'xmllang.xml') + obj = SOAP::Marshal.load(File.open(@file) { |f| f.read }) + assert_equal("12345", obj.partyDataLine.gln) + lang = obj.partyDataLine.__xmlattr[ + XSD::QName.new(XSD::NS::Namespace, "lang")] + assert_equal("EN", lang) + end + + def test_no_default_namespace + env = SOAP::Processor.unmarshal(NO_DEFAULT_NAMESPACE) + array = env.body.root_node["array"] + item = array["item"] + assert_equal("urn:ns", array.elename.namespace) + assert_equal(nil, item.elename.namespace) + end + +NO_DEFAULT_NAMESPACE = <<__XML__ + + + + + + + + + + +__XML__ +end + + +end diff --git a/vendor/gems/soap4r-1.5.8/test/xsd/test_xmlschemaparser.rb b/vendor/gems/soap4r-1.5.8/test/xsd/test_xmlschemaparser.rb new file mode 100644 index 00000000..10dff43e --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/test_xmlschemaparser.rb @@ -0,0 +1,22 @@ +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/vendor/gems/soap4r-1.5.8/test/xsd/test_xsd.rb b/vendor/gems/soap4r-1.5.8/test/xsd/test_xsd.rb new file mode 100644 index 00000000..d4624262 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/test_xsd.rb @@ -0,0 +1,1638 @@ +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) + back = XSD::XSDString.strict_ces_validation + XSD::XSDString.strict_ces_validation = true + begin + 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::XSDString.strict_ces_validation = back + end + end + + def test_XSDString_NONE + XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_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) + back = XSD::XSDString.strict_ces_validation + XSD::XSDString.strict_ces_validation = true + begin + assert_raises(XSD::ValueSpaceError) do + XSD::XSDString.new("\0") + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDString.new("\xC0\xC0").to_s + end + ensure + XSD::XSDString.strict_ces_validation = back + end + ensure + XSD::Charset.module_eval { @internal_encoding = @encoding_backup } + end + end + + def test_XSDNormalizedString + XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_encoding = "NONE" } + begin + o = XSD::XSDNormalizedString.new + assert_equal(XSD::Namespace, o.type.namespace) + assert_equal(XSD::NormalizedStringLiteral, o.type.name) + assert_equal(nil, o.data) + assert_equal(true, o.is_nil) + + str = "abc" + assert_equal(str, XSD::XSDNormalizedString.new(str).data) + assert_equal(str, XSD::XSDNormalizedString.new(str).to_s) + back = XSD::XSDString.strict_ces_validation + XSD::XSDString.strict_ces_validation = true + begin + assert_raises(XSD::ValueSpaceError) do + XSD::XSDNormalizedString.new("\0") + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDNormalizedString.new("\xC0\xC0").to_s + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDNormalizedString.new("a\tb").to_s + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDNormalizedString.new("a\r").to_s + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDNormalizedString.new("\nb").to_s + end + ensure + XSD::XSDString.strict_ces_validation = back + end + ensure + XSD::Charset.module_eval { @internal_encoding = @encoding_backup } + end + end + + def test_XSDToken + XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_encoding = "NONE" } + begin + o = XSD::XSDToken.new + assert_equal(XSD::Namespace, o.type.namespace) + assert_equal(XSD::TokenLiteral, o.type.name) + assert_equal(nil, o.data) + assert_equal(true, o.is_nil) + + str = "abc" + assert_equal(str, XSD::XSDToken.new(str).data) + assert_equal(str, XSD::XSDToken.new(str).to_s) + back = XSD::XSDString.strict_ces_validation + XSD::XSDString.strict_ces_validation = true + begin + assert_raises(XSD::ValueSpaceError) do + XSD::XSDToken.new("\0") + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDToken.new("\xC0\xC0").to_s + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDToken.new("a\tb").to_s + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDToken.new("a\r").to_s + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDToken.new("\nb").to_s + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDToken.new(" a").to_s + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDToken.new("b ").to_s + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDToken.new("a b").to_s + end + assert_equal("a b", XSD::XSDToken.new("a b").data) + ensure + XSD::XSDString.strict_ces_validation = back + end + ensure + XSD::Charset.module_eval { @internal_encoding = @encoding_backup } + end + end + + def test_XSDLanguage + o = XSD::XSDLanguage.new + assert_equal(XSD::Namespace, o.type.namespace) + assert_equal(XSD::LanguageLiteral, o.type.name) + assert_equal(nil, o.data) + assert_equal(true, o.is_nil) + + str = "ja" + assert_equal(str, XSD::XSDLanguage.new(str).data) + assert_equal(str, XSD::XSDLanguage.new(str).to_s) + str = "ja-jp" + assert_equal(str, XSD::XSDLanguage.new(str).data) + assert_equal(str, XSD::XSDLanguage.new(str).to_s) + assert_raises(XSD::ValueSpaceError) do + XSD::XSDLanguage.new("ja-jp-") + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDLanguage.new("-ja-") + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDLanguage.new("ja-") + end + assert_raises(XSD::ValueSpaceError) do + XSD::XSDLanguage.new("a1-01") + end + assert_equal("aA-01", XSD::XSDLanguage.new("aA-01").to_s) + 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", + "PT3456H7890M1234.5678S", + "P1234Y5678M9012D", + "-P1234Y5678M9012DT3456H7890M1234.5678S", + "P5678M9012DT3456H7890M1234.5678S", + "-P1234Y9012DT3456H7890M1234.5678S", + "+P1234Y5678MT3456H7890M1234.5678S", + "P1234Y5678M9012DT7890M1234.5678S", + "-P1234Y5678M9012DT3456H1234.5678S", + "+P1234Y5678M9012DT3456H7890M", + "P123400000000000Y", + "-P567800000000000M", + "+P901200000000000D", + "PT345600000000000H", + "-PT789000000000000M", + "+PT123400000000000.000000000005678S", + "P1234YT1234.5678S", + "-P5678MT7890M", + "+P9012DT3456H", + "PT5S", + ] + 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/vendor/gems/soap4r-1.5.8/test/xsd/xmllang.xml b/vendor/gems/soap4r-1.5.8/test/xsd/xmllang.xml new file mode 100644 index 00000000..5daa2b93 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/xmllang.xml @@ -0,0 +1,43 @@ + + + + + 12345 + 1 + 0 + + + + + + 12345 + 234 + foobar LLC + baz + 9876 + Moscow + RU + + + 12; 34 56 78 + foo@example.com + 123 456 + + + bar@example.com + + + www.example.com + + + 12 34; 56 78 + + + 789 012 + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/xsd/xmlschema.xml b/vendor/gems/soap4r-1.5.8/test/xsd/xmlschema.xml new file mode 100644 index 00000000..018bd0cc --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/xmlschema.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/expected_mysample.rb b/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/expected_mysample.rb new file mode 100644 index 00000000..70452ac5 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/expected_mysample.rb @@ -0,0 +1,65 @@ +require 'xsd/qname' + +module XSD; module XSD2Ruby + + +# {urn:mysample}question +# something - SOAP::SOAPString +class Question + attr_accessor :something + + def initialize(something = nil) + @something = something + end +end + +# {urn:mysample}section +# sectionID - SOAP::SOAPInt +# name - SOAP::SOAPString +# description - SOAP::SOAPString +# index - SOAP::SOAPInt +# firstQuestion - XSD::XSD2Ruby::Question +class Section + attr_accessor :sectionID + attr_accessor :name + attr_accessor :description + attr_accessor :index + attr_accessor :firstQuestion + + def initialize(sectionID = nil, name = nil, description = nil, index = nil, firstQuestion = nil) + @sectionID = sectionID + @name = name + @description = description + @index = index + @firstQuestion = firstQuestion + end +end + +# {urn:mysample}sectionArray +class SectionArray < ::Array +end + +# {urn:mysample}sectionElement +# sectionID - SOAP::SOAPInt +# name - SOAP::SOAPString +# description - SOAP::SOAPString +# index - SOAP::SOAPInt +# firstQuestion - XSD::XSD2Ruby::Question +class SectionElement + attr_accessor :sectionID + attr_accessor :name + attr_accessor :description + attr_accessor :index + attr_accessor :firstQuestion + + def initialize(sectionID = nil, name = nil, description = nil, index = nil, firstQuestion = nil) + @sectionID = sectionID + @name = name + @description = description + @index = index + @firstQuestion = firstQuestion + end +end + + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/expected_mysample_mapper.rb b/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/expected_mysample_mapper.rb new file mode 100644 index 00000000..2b640c51 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/expected_mysample_mapper.rb @@ -0,0 +1,11 @@ +require 'mysample_mapping_registry.rb' + +module XSD; module XSD2Ruby + +class MysampleMapper < XSD::Mapping::Mapper + def initialize + super(MysampleMappingRegistry::Registry) + end +end + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb b/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb new file mode 100644 index 00000000..1c7a4ed9 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb @@ -0,0 +1,51 @@ +require 'xsd/mapping' +require 'mysample.rb' + +module XSD; module XSD2Ruby + +module MysampleMappingRegistry + NsMysample = "urn:mysample" + Registry = ::SOAP::Mapping::LiteralRegistry.new + + Registry.register( + :class => XSD::XSD2Ruby::Question, + :schema_type => XSD::QName.new(NsMysample, "question"), + :schema_element => [ + ["something", ["SOAP::SOAPString", XSD::QName.new(nil, "something")]] + ] + ) + + Registry.register( + :class => XSD::XSD2Ruby::Section, + :schema_type => XSD::QName.new(NsMysample, "section"), + :schema_element => [ + ["sectionID", ["SOAP::SOAPInt", XSD::QName.new(nil, "sectionID")]], + ["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], + ["description", ["SOAP::SOAPString", XSD::QName.new(nil, "description")]], + ["index", ["SOAP::SOAPInt", XSD::QName.new(nil, "index")]], + ["firstQuestion", ["XSD::XSD2Ruby::Question", XSD::QName.new(nil, "firstQuestion")]] + ] + ) + + Registry.register( + :class => XSD::XSD2Ruby::SectionArray, + :schema_type => XSD::QName.new(NsMysample, "sectionArray"), + :schema_element => [ + ["element", ["XSD::XSD2Ruby::Section[]", XSD::QName.new(nil, "element")], [1, nil]] + ] + ) + + Registry.register( + :class => XSD::XSD2Ruby::SectionElement, + :schema_name => XSD::QName.new(NsMysample, "sectionElement"), + :schema_element => [ + ["sectionID", ["SOAP::SOAPInt", XSD::QName.new(nil, "sectionID")]], + ["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], + ["description", ["SOAP::SOAPString", XSD::QName.new(nil, "description")]], + ["index", ["SOAP::SOAPInt", XSD::QName.new(nil, "index")]], + ["firstQuestion", ["XSD::XSD2Ruby::Question", XSD::QName.new(nil, "firstQuestion")]] + ] + ) +end + +end; end diff --git a/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/section.xsd b/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/section.xsd new file mode 100644 index 00000000..161f2d20 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/section.xsd @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/test_xsd2ruby.rb b/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/test_xsd2ruby.rb new file mode 100644 index 00000000..d1d10361 --- /dev/null +++ b/vendor/gems/soap4r-1.5.8/test/xsd/xsd2ruby/test_xsd2ruby.rb @@ -0,0 +1,90 @@ +require 'test/unit' +require 'wsdl/xmlSchema/xsd2ruby' +require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb') + + +module XSD; module XSD2Ruby + + +class TestXSD2Ruby < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + + def setup + Dir.chdir(DIR) do + gen = WSDL::XMLSchema::XSD2Ruby.new + gen.location = pathname("section.xsd") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['module_path'] = "XSD::XSD2Ruby" + gen.opt['classdef'] = nil + gen.opt['mapping_registry'] = nil + gen.opt['mapper'] = nil + gen.opt['force'] = true + gen.run + TestUtil.require(DIR, 'mysample.rb', 'mysample_mapping_registry.rb', 'mysample_mapper.rb') + end + end + + def teardown + unless $DEBUG + File.unlink(pathname("mysample.rb")) + File.unlink(pathname("mysample_mapping_registry.rb")) + File.unlink(pathname("mysample_mapper.rb")) + end + # leave generated file for debug. + end + + def test_generate + compare("expected_mysample.rb", "mysample.rb") + compare("expected_mysample_mapping_registry.rb", "mysample_mapping_registry.rb") + compare("expected_mysample_mapper.rb", "mysample_mapper.rb") + end + + def test_mapper + mapper = XSD::XSD2Ruby::MysampleMapper.new + # complexType + arg = XSD::XSD2Ruby::Section.new(10001, 'name', 'description', 1, Question.new("hello world")) + obj = mapper.xml2obj(mapper.obj2xml(arg)) + assert_section_equal(arg, obj) + # element + arg = XSD::XSD2Ruby::SectionElement.new(10001, 'name', 'description', 1, Question.new("hello world")) + obj = mapper.xml2obj(mapper.obj2xml(arg)) + assert_section_equal(arg, obj) + # array + ele = XSD::XSD2Ruby::Section.new(10001, 'name', 'description', 1, Question.new("hello world")) + arg = XSD::XSD2Ruby::SectionArray[ele, ele, ele] + obj = mapper.xml2obj(mapper.obj2xml(arg)) + assert_equal(arg.class, obj.class) + assert_equal(arg.size, obj.size) + 0.upto(arg.size - 1) do |idx| + assert_section_equal(arg[idx], obj[idx]) + end + end + +private + + def assert_section_equal(arg, obj) + assert_equal(arg.class, obj.class) + assert_equal(arg.sectionID, obj.sectionID) + assert_equal(arg.name, obj.name) + assert_equal(arg.description, obj.description) + assert_equal(arg.index, obj.index) + assert_equal(arg.firstQuestion.class, obj.firstQuestion.class) + assert_equal(arg.firstQuestion.something, obj.firstQuestion.something) + end + + def pathname(filename) + File.join(DIR, filename) + end + + def compare(expected, actual) + TestUtil.filecompare(pathname(expected), pathname(actual)) + end + + def loadfile(file) + File.open(pathname(file)) { |f| f.read } + end +end + + +end; end