Changeset 832
- Timestamp:
- 08/03/03 19:11:47 (5 years ago)
- Files:
-
- trunk/ToDo (modified) (4 diffs)
- trunk/bin/wsdl2ruby.rb (modified) (8 diffs)
- trunk/install.rb (modified) (1 diff)
- trunk/lib/soap/XMLSchemaDatatypes.rb (modified) (47 diffs)
- trunk/lib/soap/baseData.rb (modified) (32 diffs)
- trunk/lib/soap/cgistub.rb (modified) (7 diffs)
- trunk/lib/soap/charset.rb (modified) (8 diffs)
- trunk/lib/soap/driver.rb (modified) (3 diffs)
- trunk/lib/soap/element.rb (modified) (7 diffs)
- trunk/lib/soap/encodingStyleHandler.rb (modified) (3 diffs)
- trunk/lib/soap/encodingStyleHandlerASPDotNet.rb (modified) (4 diffs)
- trunk/lib/soap/encodingStyleHandlerDynamic.rb (modified) (11 diffs)
- trunk/lib/soap/encodingStyleHandlerLiteral.rb (modified) (4 diffs)
- trunk/lib/soap/generator.rb (modified) (5 diffs)
- trunk/lib/soap/headerHandler.rb (modified) (2 diffs)
- trunk/lib/soap/mapping/factory.rb (modified) (20 diffs)
- trunk/lib/soap/mapping/mapping.rb (modified) (9 diffs)
- trunk/lib/soap/mapping/registry.rb (modified) (23 diffs)
- trunk/lib/soap/mapping/rubytypeFactory.rb (modified) (24 diffs)
- trunk/lib/soap/marshal.rb (modified) (1 diff)
- trunk/lib/soap/namespace.rb (modified) (3 diffs)
- trunk/lib/soap/netHttpClient.rb (modified) (4 diffs)
- trunk/lib/soap/nqxmlparser.rb (modified) (1 diff)
- trunk/lib/soap/parser.rb (modified) (9 diffs)
- trunk/lib/soap/processor.rb (modified) (3 diffs)
- trunk/lib/soap/rexmlparser.rb (modified) (3 diffs)
- trunk/lib/soap/rpc/driver.rb (modified) (6 diffs)
- trunk/lib/soap/rpc/element.rb (modified) (9 diffs)
- trunk/lib/soap/rpc/proxy.rb (modified) (7 diffs)
- trunk/lib/soap/rpc/router.rb (modified) (5 diffs)
- trunk/lib/soap/rpc/rpc.rb (modified) (1 diff)
- trunk/lib/soap/rpc/server.rb (modified) (2 diffs)
- trunk/lib/soap/rpc/soaplet.rb (added)
- trunk/lib/soap/rpc/standaloneServer.rb (modified) (3 diffs)
- trunk/lib/soap/saxdriver.rb (modified) (4 diffs)
- trunk/lib/soap/soap.rb (modified) (2 diffs)
- trunk/lib/soap/soaplet.rb (deleted)
- trunk/lib/soap/streamHandler.rb (modified) (7 diffs)
- trunk/lib/soap/wsdlDriver.rb (modified) (9 diffs)
- trunk/lib/soap/xmlparser.rb (modified) (1 diff)
- trunk/lib/soap/xmlscanner.rb (modified) (4 diffs)
- trunk/lib/wsdl/binding.rb (modified) (4 diffs)
- trunk/lib/wsdl/data.rb (modified) (1 diff)
- trunk/lib/wsdl/definitions.rb (modified) (11 diffs)
- trunk/lib/wsdl/import.rb (modified) (3 diffs)
- trunk/lib/wsdl/info.rb (modified) (1 diff)
- trunk/lib/wsdl/message.rb (modified) (2 diffs)
- trunk/lib/wsdl/namedElements.rb (modified) (1 diff)
- trunk/lib/wsdl/nqxmlparser.rb (modified) (1 diff)
- trunk/lib/wsdl/operation.rb (modified) (6 diffs)
- trunk/lib/wsdl/operationBinding.rb (modified) (4 diffs)
- trunk/lib/wsdl/param.rb (modified) (3 diffs)
- trunk/lib/wsdl/parser.rb (modified) (10 diffs)
- trunk/lib/wsdl/part.rb (modified) (3 diffs)
- trunk/lib/wsdl/port.rb (modified) (3 diffs)
- trunk/lib/wsdl/portType.rb (modified) (4 diffs)
- trunk/lib/wsdl/rexmlparser.rb (modified) (3 diffs)
- trunk/lib/wsdl/service.rb (modified) (4 diffs)
- trunk/lib/wsdl/soap/address.rb (modified) (1 diff)
- trunk/lib/wsdl/soap/binding.rb (modified) (2 diffs)
- trunk/lib/wsdl/soap/body.rb (modified) (2 diffs)
- trunk/lib/wsdl/soap/cgiStubCreator.rb (modified) (1 diff)
- trunk/lib/wsdl/soap/classDefCreator.rb (modified) (6 diffs)
- trunk/lib/wsdl/soap/clientSkeltonCreator.rb (modified) (2 diffs)
- trunk/lib/wsdl/soap/complexType.rb (modified) (3 diffs)
- trunk/lib/wsdl/soap/data.rb (modified) (1 diff)
- trunk/lib/wsdl/soap/definitions.rb (modified) (3 diffs)
- trunk/lib/wsdl/soap/driverCreator.rb (modified) (4 diffs)
- trunk/lib/wsdl/soap/mappingRegistryCreator.rb (modified) (5 diffs)
- trunk/lib/wsdl/soap/methodDefCreator.rb (modified) (3 diffs)
- trunk/lib/wsdl/soap/methodDefCreatorSupport.rb (modified) (4 diffs)
- trunk/lib/wsdl/soap/operation.rb (modified) (1 diff)
- trunk/lib/wsdl/soap/servantSkeltonCreator.rb (modified) (2 diffs)
- trunk/lib/wsdl/soap/standaloneServerStubCreator.rb (modified) (1 diff)
- trunk/lib/wsdl/soap/webrickStubCreator.rb (modified) (4 diffs)
- trunk/lib/wsdl/types.rb (modified) (2 diffs)
- trunk/lib/wsdl/wsdl.rb (modified) (1 diff)
- trunk/lib/wsdl/xmlSchema/attribute.rb (modified) (2 diffs)
- trunk/lib/wsdl/xmlSchema/complexContent.rb (modified) (5 diffs)
- trunk/lib/wsdl/xmlSchema/complexType.rb (modified) (4 diffs)
- trunk/lib/wsdl/xmlSchema/content.rb (modified) (2 diffs)
- trunk/lib/wsdl/xmlSchema/element.rb (modified) (4 diffs)
- trunk/lib/wsdl/xmlSchema/import.rb (modified) (1 diff)
- trunk/lib/wsdl/xmlSchema/schema.rb (modified) (3 diffs)
- trunk/lib/wsdl/xmlparser.rb (modified) (1 diff)
- trunk/lib/wsdl/xmlscanner.rb (modified) (4 diffs)
- trunk/sample/Amazon/AmazonSearch.rb (added)
- trunk/sample/Amazon/wsdlDriver.rb (modified) (4 diffs)
- trunk/sample/Calc/calc.rb (modified) (1 diff)
- trunk/sample/Calc/calc2.rb (modified) (2 diffs)
- trunk/sample/Calc/client.rb (modified) (1 diff)
- trunk/sample/Calc/client2.rb (modified) (1 diff)
- trunk/sample/Calc/httpd.rb (added)
- trunk/sample/Calc/server.cgi (modified) (1 diff)
- trunk/sample/Calc/server.rb (modified) (1 diff)
- trunk/sample/Calc/server2.cgi (modified) (1 diff)
- trunk/sample/Calc/server2.rb (modified) (1 diff)
- trunk/sample/Exchange/client.rb (modified) (1 diff)
- trunk/sample/Exchange/exchange.rb (modified) (2 diffs)
- trunk/sample/Exchange/httpd.rb (added)
- trunk/sample/Exchange/iExchange.rb (deleted)
- trunk/sample/Exchange/server.cgi (modified) (1 diff)
- trunk/sample/Exchange/server.rb (modified) (1 diff)
- trunk/sample/GoogleSearch/wsdlDriver.rb (modified) (2 diffs)
- trunk/sample/ICD/IICD.rb (modified) (1 diff)
- trunk/sample/ICD/icd.rb (modified) (3 diffs)
- trunk/sample/NetDicV06 (added)
- trunk/sample/NetDicV06/INetDicV06.rb (added)
- trunk/sample/NetDicV06/netDicV06.rb (added)
- trunk/sample/RAA/RAA.rb (deleted)
- trunk/sample/RAA/SOAP__Lite.pl (modified) (1 diff)
- trunk/sample/RAA/iRAA.rb (modified) (12 diffs)
- trunk/sample/RAA/pocketSOAP.js (modified) (1 diff)
- trunk/sample/RAA/raa-div.rb (modified) (1 diff)
- trunk/sample/RAA/soap4r.rb (modified) (2 diffs)
- trunk/sample/RAA/wsdl/soap4r.rb (modified) (2 diffs)
- trunk/sample/RAA/xmlrpc4r.rb (modified) (1 diff)
- trunk/sample/RNN/client.rb (modified) (2 diffs)
- trunk/sample/RNN/post.rb (modified) (2 diffs)
- trunk/sample/RWiki/rwikiClient.rb (modified) (2 diffs)
- trunk/sample/RWiki/rwikiServer.cgi (modified) (2 diffs)
- trunk/sample/SampleStruct/client.rb (modified) (2 diffs)
- trunk/sample/SampleStruct/httpd.rb (added)
- trunk/sample/SampleStruct/sampleStruct.rb (modified) (1 diff)
- trunk/sample/SampleStruct/server.cgi (modified) (1 diff)
- trunk/sample/SampleStruct/server.rb (modified) (1 diff)
- trunk/sample/apacheClient.rb (modified) (6 diffs)
- trunk/sample/babelfish.rb (modified) (1 diff)
- trunk/sample/digraph.rb (modified) (1 diff)
- trunk/sample/marshallingWithWSDL/marshal.rb (modified) (2 diffs)
- trunk/sample/webrick (deleted)
- trunk/sample/whois.rb (modified) (1 diff)
- trunk/test/baseType_ut.rb (deleted)
- trunk/test/interopR2/clientBase.rb (modified) (9 diffs)
- trunk/test/interopR2/interopResultBase.rb (modified) (1 diff)
- trunk/test/interopR2/server.cgi (modified) (2 diffs)
- trunk/test/interopR2/server.rb (modified) (4 diffs)
- trunk/test/struct.rb (deleted)
- trunk/test/test_basetype.rb (added)
- trunk/test/test_struct.rb (added)
- trunk/test/test_xsd.rb (added)
- trunk/test/xsd_ut.rb (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ToDo
r764 r832 1 1 = ToDo 2 2 3 wsdl4r generates old stub 4 5 add new webrickServer with soaplet. 3 6 4 7 mappingRegistryCreator: do not dump a type which is in default mappingRegistry. … … 16 19 �q���v�f��肷�����́A�V���ɐ錾�������ƁA���v�f��Ƃ��������������B���v�f���Ƃ����́Aref������p���܂� 17 20 18 simplify original driver19 21 20 * encoding/decoding based on type information in WSDL. 21 * Support untyped response. 22 * Follow SOAP/1.2. 22 23 * Support SwA. 23 24 * Parse XML Namespace with xmlscan, not by itself. 24 25 * RAA exception 25 * RAA uri-fy26 26 * Support all derived built-in types in XML Schema Part2 Sec. 3.2. 27 27 * Design and implement SOAPHeader handler API. … … 30 30 * Messaging sample. 31 31 * Rewrite the interop test client with runit? 32 * Follow SOAP/1.2.33 32 34 33 … … 43 42 * Add XSD tests to the interop test client. 44 43 * WSDL4R. 44 * encoding based on type information in WSDL. 45 * Support untyped response using WSDL. 46 * RAA uri-fy 47 * decoding based on type information in WSDL. trunk/bin/wsdl2ruby.rb
r761 r832 10 10 require 'wsdl/soap/standaloneServerStubCreator' 11 11 require 'wsdl/soap/cgiStubCreator' 12 require 'wsdl/soap/webrickStubCreator'13 12 14 13 require 'devel/logger' … … 20 19 ['--wsdl','-w', GetoptLong::REQUIRED_ARGUMENT], 21 20 ['--type','-t', GetoptLong::REQUIRED_ARGUMENT], 22 ['--classDef','-e', GetoptLong::NO_ARGUMENT], 23 ['--clientSkelton','-c', GetoptLong::OPTIONAL_ARGUMENT], 24 ['--servantSkelton','-s', GetoptLong::OPTIONAL_ARGUMENT], 25 ['--cgiStub','-g', GetoptLong::OPTIONAL_ARGUMENT], 26 ['--webrickStub','-b', GetoptLong::OPTIONAL_ARGUMENT], 27 ['--standaloneServerStub','-a', GetoptLong::OPTIONAL_ARGUMENT], 21 ['--classdef','-e', GetoptLong::NO_ARGUMENT], 22 ['--client_skelton','-c', GetoptLong::OPTIONAL_ARGUMENT], 23 ['--servant_skelton','-s', GetoptLong::OPTIONAL_ARGUMENT], 24 ['--cgi_stub','-g', GetoptLong::OPTIONAL_ARGUMENT], 25 ['--standalone_server_stub','-a', GetoptLong::OPTIONAL_ARGUMENT], 28 26 ['--driver','-d', GetoptLong::OPTIONAL_ARGUMENT], 29 27 ['--force','-f', GetoptLong::NO_ARGUMENT], 30 ]28 ] 31 29 32 30 def initialize 33 super( 'app')31 super('app') 34 32 STDERR.sync = true 35 @wsdl Location = nil33 @wsdl_location = nil 36 34 @opt = {} 37 35 @wsdl = nil … … 40 38 41 39 def run 42 @wsdl Location, @opt = parseOpt( GetoptLong.new( *OptSet))43 usage Exit unless @wsdlLocation44 @wsdl = import(@wsdl Location)40 @wsdl_location, @opt = parse_opt(GetoptLong.new(*OptSet)) 41 usage_exit unless @wsdl_location 42 @wsdl = import(@wsdl_location) 45 43 @name = @wsdl.name.name || 'default' 46 create File44 create_file 47 45 0 48 46 end 49 47 50 def createFile 51 createClassDef if @opt.has_key?( 'classDef' ) 52 createServantSkelton( @opt[ 'servantSkelton' ] ) if @opt.has_key?( 'servantSkelton' ) 53 createCgiStub( @opt[ 'cgiStub' ] ) if @opt.has_key?( 'cgiStub' ) 54 createWebrickStub( @opt[ 'webrickStub' ] ) if @opt.has_key?( 'webrickStub' ) 55 createStandaloneServerStub( @opt[ 'standaloneServerStub' ] ) if @opt.has_key?( 'standaloneServerStub' ) 56 createDriver( @opt[ 'driver' ] ) if @opt.has_key?( 'driver' ) 57 createClientSkelton( @opt[ 'clientSkelton' ] ) if @opt.has_key?( 'clientSkelton' ) 58 end 59 60 def usageExit 48 def create_file 49 create_classdef if @opt.key?('classdef') 50 create_servant_skelton(@opt['servant_skelton']) if @opt.key?('servant_skelton') 51 create_cgi_stub(@opt['cgi_stub']) if @opt.key?('cgi_stub') 52 create_standalone_server_stub(@opt['standalone_server_stub']) if @opt.key?('standalone_server_stub') 53 create_driver(@opt['driver']) if @opt.key?('driver') 54 create_client_skelton(@opt['client_skelton']) if @opt.key?('client_skelton') 55 end 56 57 def usage_exit 61 58 puts <<__EOU__ 62 Usage: #{ $0 } --wsdl wsdl Location [options]63 wsdl Location: filename or URL59 Usage: #{ $0 } --wsdl wsdl_location [options] 60 wsdl_location: filename or URL 64 61 65 62 Example: 66 63 For server side: 67 #{ $0 } --wsdl my App.wsdl --type server64 #{ $0 } --wsdl myapp.wsdl --type server 68 65 For client side: 69 #{ $0 } --wsdl my App.wsdl --type client66 #{ $0 } --wsdl myapp.wsdl --type client 70 67 71 68 Options: 72 --wsdl wsdl Location69 --wsdl wsdl_location 73 70 --type server|client 74 71 --type server implies; 75 --class Def76 --servant Skelton77 --standalone ServerStub72 --classdef 73 --servant_skelton 74 --standalone_server_stub 78 75 --type client implies; 79 --class Def80 --client Skelton76 --classdef 77 --client_skelton 81 78 --driver 82 --classDef 83 --clientSkelton [serviceName] 84 --servantSkelton [portTypeName] 85 --cgiStub [serviceName] 86 --webrickStub [serviceName] 87 --standaloneServerStub [serviceName] 88 --driver [portTypeName] 79 --classdef 80 --client_skelton [servicename] 81 --servant_skelton [porttypename] 82 --cgi_stub [servicename] 83 --standalone_server_stub [servicename] 84 --driver [porttypename] 89 85 --force 90 86 … … 98 94 end 99 95 100 def parse Opt( getOpt)96 def parse_opt(getoptlong) 101 97 opt = {} 102 98 wsdl = nil 103 99 begin 104 get Opt.each do | name, arg|100 getoptlong.each do |name, arg| 105 101 case name 106 102 when "--wsdl" … … 109 105 case arg 110 106 when "server" 111 opt[ 'classDef'] = nil112 opt[ 'servantSkelton'] = nil113 opt[ 'standaloneServerStub'] = nil107 opt['classdef'] = nil 108 opt['servant_skelton'] = nil 109 opt['standalone_server_stub'] = nil 114 110 when "client" 115 opt[ 'classDef'] = nil116 opt[ 'driver'] = nil117 opt[ 'clientSkelton'] = nil111 opt['classdef'] = nil 112 opt['driver'] = nil 113 opt['client_skelton'] = nil 118 114 else 119 raise ArgumentError.new( "Unknown type #{ arg }")115 raise ArgumentError.new("Unknown type #{ arg }") 120 116 end 121 when "--class Def", "--clientSkelton", "--servantSkelton", "--cgiStub",122 "--webrickStub", "--standaloneServerStub", "--driver"123 opt[ name.sub( /^--/, '' )] = arg.empty? ? nil : arg117 when "--classdef", "--client_skelton", "--servant_skelton", 118 "--cgi_stub", "--standalone_server_stub", "--driver" 119 opt[name.sub(/^--/, '')] = arg.empty? ? nil : arg 124 120 when "--force" 125 opt[ 'force'] = true121 opt['force'] = true 126 122 else 127 raise ArgumentError.new( "Unknown type #{ arg }")123 raise ArgumentError.new("Unknown type #{ arg }") 128 124 end 129 125 end 130 126 rescue 131 usage Exit127 usage_exit 132 128 end 133 129 return wsdl, opt 134 130 end 135 131 136 def create ClassDef137 log( SEV_INFO) { "Creating class definition." }138 @class DefFilename = @name + '.rb'139 check File( @classDefFilename) or return140 File.open( @classDefFilename, "w" ) do | f|141 f << WSDL::SOAP::ClassDefCreator.new( @wsdl).dump142 end 143 end 144 145 def create ClientSkelton( serviceName)146 log( SEV_INFO) { "Creating client skelton." }147 service Name ||= @wsdl.services[ 0].name.name148 @client SkeltonFilename = serviceName + 'Client.rb'149 check File( @clientSkeltonFilename) or return150 File.open( @clientSkeltonFilename, "w" ) do | f|132 def create_classdef 133 log(SEV_INFO) { "Creating class definition." } 134 @classdef_filename = @name + '.rb' 135 check_file(@classdef_filename) or return 136 File.open(@classdef_filename, "w") do |f| 137 f << WSDL::SOAP::ClassDefCreator.new(@wsdl).dump 138 end 139 end 140 141 def create_client_skelton(servicename) 142 log(SEV_INFO) { "Creating client skelton." } 143 servicename ||= @wsdl.services[0].name.name 144 @client_skelton_filename = servicename + 'Client.rb' 145 check_file(@client_skelton_filename) or return 146 File.open(@client_skelton_filename, "w") do |f| 151 147 f << shbang << "\n" 152 f << "require '#{ @driver Filename }'\n\n" if @driverFilename153 f << WSDL::SOAP::ClientSkeltonCreator.new( @wsdl).dump(154 create Name( serviceName))155 end 156 end 157 158 def create ServantSkelton( portTypeName)159 log( SEV_INFO) { "Creating servant skelton." }160 @servant SkeltonFilename = ( portTypeName || @name + 'Servant') + '.rb'161 check File( @servantSkeltonFilename) or return162 File.open( @servantSkeltonFilename, "w" ) do | f|163 f << "require '#{ @class DefFilename }'\n\n" if @classDefFilename164 f << WSDL::SOAP::ServantSkeltonCreator.new( @wsdl).dump(165 create Name( portTypeName))166 end 167 end 168 169 def create CgiStub( serviceName)170 log( SEV_INFO) { "Creating CGI stub." }171 service Name ||= @wsdl.services[ 0].name.name172 @cgi StubFilename = serviceName + '.cgi'173 check File( @cgiStubFilename) or return174 File.open( @cgiStubFilename, "w" ) do | f|148 f << "require '#{ @driver_filename }'\n\n" if @driver_filename 149 f << WSDL::SOAP::ClientSkeltonCreator.new(@wsdl).dump( 150 create_name(servicename)) 151 end 152 end 153 154 def create_servant_skelton(porttypename) 155 log(SEV_INFO) { "Creating servant skelton." } 156 @servant_skelton_filename = (porttypename || @name + 'Servant') + '.rb' 157 check_file(@servant_skelton_filename) or return 158 File.open(@servant_skelton_filename, "w") do |f| 159 f << "require '#{ @classdef_filename }'\n\n" if @classdef_filename 160 f << WSDL::SOAP::ServantSkeltonCreator.new(@wsdl).dump( 161 create_name(porttypename)) 162 end 163 end 164 165 def create_cgi_stub(servicename) 166 log(SEV_INFO) { "Creating CGI stub." } 167 servicename ||= @wsdl.services[0].name.name 168 @cgi_stubFilename = servicename + '.cgi' 169 check_file(@cgi_stubFilename) or return 170 File.open(@cgi_stubFilename, "w") do |f| 175 171 f << shbang << "\n" 176 f << "require '#{ @servantSkeltonFilename }'\n\n" if @servantSkeltonFilename 177 f << WSDL::SOAP::CGIStubCreator.new( @wsdl ).dump( 178 createName( serviceName )) 179 end 180 end 181 182 def createWebrickStub( serviceName ) 183 log( SEV_INFO ) { "Creating WEBrick SOAPlet stub." } 184 serviceName ||= @wsdl.services[ 0 ].name.name 185 @webrickStubFilename = 'httpd.rb' 186 checkFile( @webrickStubFilename ) or return 187 File.open( @webrickStubFilename, "w" ) do | f | 172 if @servant_skelton_filename 173 f << "require '#{ @servant_skelton_filename }'\n\n" 174 end 175 f << WSDL::SOAP::CGIStubCreator.new(@wsdl).dump(create_name(servicename)) 176 end 177 end 178 179 def create_standalone_server_stub(servicename) 180 log(SEV_INFO) { "Creating standalone stub." } 181 servicename ||= @wsdl.services[0].name.name 182 @standalone_server_stub_filename = servicename + '.rb' 183 check_file(@standalone_server_stub_filename) or return 184 File.open(@standalone_server_stub_filename, "w") do |f| 188 185 f << shbang << "\n" 189 f << "require '#{ @servantSkeltonFilename }'\n\n" if @servantSkeltonFilename 190 f << WSDL::SOAP::WEBrickStubCreator.new( @wsdl ).dump( 191 createName( serviceName )) 192 end 193 end 194 195 def createStandaloneServerStub( serviceName ) 196 log( SEV_INFO ) { "Creating standalone stub." } 197 serviceName ||= @wsdl.services[ 0 ].name.name 198 @standaloneServerStubFilename = serviceName + '.rb' 199 checkFile( @standaloneServerStubFilename ) or return 200 File.open( @standaloneServerStubFilename, "w" ) do | f | 201 f << shbang << "\n" 202 f << "require '#{ @servantSkeltonFilename }'\n\n" if @servantSkeltonFilename 203 f << WSDL::SOAP::StandaloneServerStubCreator.new( @wsdl ).dump( 204 createName( serviceName )) 205 end 206 end 207 208 def createDriver( portTypeName ) 209 log( SEV_INFO ) { "Creating driver." } 210 @driverFilename = ( portTypeName || @name ) + 'Driver.rb' 211 checkFile( @driverFilename ) or return 212 File.open( @driverFilename, "w" ) do | f | 213 f << "require '#{ @classDefFilename }'\n\n" if @classDefFilename 214 f << WSDL::SOAP::DriverCreator.new( @wsdl ).dump( 215 createName( portTypeName )) 216 end 217 end 218 219 def checkFile( filename ) 220 if FileTest.exist?( filename ) 221 if @opt.has_key?( 'force' ) 222 log( SEV_WARN ) { 186 f << "require '#{ @servant_skelton_filename }'\n\n" if @servant_skelton_filename 187 f << WSDL::SOAP::StandaloneServerStubCreator.new(@wsdl).dump( 188 create_name(servicename)) 189 end 190 end 191 192 def create_driver(porttypename) 193 log(SEV_INFO) { "Creating driver." } 194 @driver_filename = (porttypename || @name) + 'Driver.rb' 195 check_file(@driver_filename) or return 196 File.open(@driver_filename, "w") do |f| 197 f << "require '#{ @classdef_filename }'\n\n" if @classdef_filename 198 f << WSDL::SOAP::DriverCreator.new(@wsdl).dump( 199 create_name(porttypename)) 200 end 201 end 202 203 def check_file(filename) 204 if FileTest.exist?(filename) 205 if @opt.key?('force') 206 log(SEV_WARN) { 223 207 "File '#{ filename }' exists but overrides it." 224 208 } 225 209 true 226 210 else 227 log( SEV_WARN) {211 log(SEV_WARN) { 228 212 "File '#{ filename }' exists. #{ $0 } did not override it." 229 213 } … … 231 215 end 232 216 else 233 log( SEV_INFO) { "Creates file '#{ filename }'." }217 log(SEV_INFO) { "Creates file '#{ filename }'." } 234 218 true 235 219 end … … 240 224 end 241 225 242 def create Name( name)243 name ? XSD::QName.new( @wsdl.targetNamespace, name) : nil226 def create_name(name) 227 name ? XSD::QName.new(@wsdl.targetnamespace, name) : nil 244 228 end 245 229 … … 250 234 else 251 235 require 'http-access2' 252 c = HTTPAccess2::Client.new(ENV[ 'http_proxy' ] || ENV[ 'HTTP_PROXY'])253 content = c.get Content(location)254 end 255 WSDL::WSDLParser.create Parser.parse(content)236 c = HTTPAccess2::Client.new(ENV['http_proxy'] || ENV['HTTP_PROXY']) 237 content = c.get_content(location) 238 end 239 WSDL::WSDLParser.create_parser.parse(content) 256 240 end 257 241 end trunk/install.rb
r819 r832 8 8 RV = CONFIG["MAJOR"] + "." + CONFIG["MINOR"] 9 9 DSTPATH = CONFIG["sitedir"] + "/" + RV 10 SRCPATH = File.dirname( $0)10 SRCPATH = File.dirname($0) 11 11 12 def join( *arg)13 File.join( *arg)12 def join(*arg) 13 File.join(*arg) 14 14 end 15 15 16 require join( SRCPATH, '_installedFiles' ) 17 $installed = InstalledFiles.new( SRCPATH ) 18 19 def install( from, to ) 20 toPath = File.catname( from, to ) 21 unless FileTest.exist?( toPath ) and File.compare( from, toPath ) 22 File.install( from, toPath, 0644, true ) 23 $installed << InstalledFile.new( toPath ) 16 def install(from, to) 17 toPath = File.catname(from, to) 18 unless FileTest.exist?(toPath) and File.compare(from, toPath) 19 File.install(from, toPath, 0644, true) 24 20 end 25 21 end 26 22 27 def installDir( from, to)28 unless FileTest.directory?( from)29 raise RuntimeError.new( "'#{ from }' not found.")23 def installDir(from, to) 24 unless FileTest.directory?(from) 25 raise RuntimeError.new("'#{ from }' not found.") 30 26 end 31 File.mkpath( to, true)32 Dir[ join( from, '*.rb' ) ].each do | name|33 install( name, to)27 File.mkpath(to, true) 28 Dir[join(from, '*.rb')].each do |name| 29 install(name, to) 34 30 end 35 31 end 36 32 37 33 begin 38 installDir( join( SRCPATH, 'lib', 'soap' ), join( DSTPATH, 'soap' )) 39 installDir( join( SRCPATH, 'lib', 'soap', 'rpc' ), 40 join( DSTPATH, 'soap', 'rpc' )) 41 installDir( join( SRCPATH, 'lib', 'soap', 'mapping' ), 42 join( DSTPATH, 'soap', 'mapping' )) 43 installDir( join( SRCPATH, 'lib', 'wsdl' ), join( DSTPATH, 'wsdl' )) 44 installDir( join( SRCPATH, 'lib', 'wsdl', 'xmlSchema' ), 45 join( DSTPATH, 'wsdl', 'xmlSchema' )) 46 installDir( join( SRCPATH, 'lib', 'wsdl', 'soap' ), 47 join( DSTPATH, 'wsdl', 'soap' )) 48 installDir( join( SRCPATH, "redist" ), DSTPATH ) 49 installDir( join( SRCPATH, 'redist', 'soap' ), join( DSTPATH, 'soap' )) 50 51 $installed.dump( SRCPATH ) 34 installDir(join(SRCPATH, 'lib', 'soap'), 35 join(DSTPATH, 'soap')) 36 installDir(join(SRCPATH, 'lib', 'soap', 'rpc'), 37 join(DSTPATH, 'soap', 'rpc')) 38 installDir(join(SRCPATH, 'lib', 'soap', 'mapping'), 39 join(DSTPATH, 'soap', 'mapping')) 40 installDir(join(SRCPATH, 'lib', 'wsdl'), 41 join(DSTPATH, 'wsdl')) 42 installDir(join(SRCPATH, 'lib', 'wsdl', 'xmlSchema'), 43 join(DSTPATH, 'wsdl', 'xmlSchema')) 44 installDir(join(SRCPATH, 'lib', 'wsdl', 'soap'), 45 join(DSTPATH, 'wsdl', 'soap')) 52 46 53 47 puts "install succeed!" trunk/lib/soap/XMLSchemaDatatypes.rb
r831 r832 62 62 ShortLiteral = 'short' 63 63 64 AttrTypeName = QName.new( InstanceNamespace, AttrType)65 AttrNilName = QName.new( InstanceNamespace, NilLiteral)66 67 AnyTypeName = QName.new( Namespace, AnyTypeLiteral)68 AnySimpleTypeName = QName.new( Namespace, AnySimpleTypeLiteral)64 AttrTypeName = QName.new(InstanceNamespace, AttrType) 65 AttrNilName = QName.new(InstanceNamespace, NilLiteral) 66 67 AnyTypeName = QName.new(Namespace, AnyTypeLiteral) 68 AnySimpleTypeName = QName.new(Namespace, AnySimpleTypeLiteral) 69 69 70 70 class Error < StandardError; end … … 78 78 @@types = [] 79 79 80 public81 80 attr_accessor :type 82 81 83 def self.inherited( klass)82 def self.inherited(klass) 84 83 @@types << klass 85 84 end … … 100 99 class XSDAnySimpleType < NSDBase 101 100 include XSD 102 Type = QName.new( Namespace, AnySimpleTypeLiteral ) 103 104 public 101 Type = QName.new(Namespace, AnySimpleTypeLiteral) 105 102 106 103 # @data represents canonical space (ex. Integer: 123). 107 104 attr_reader :data 108 # @is Nil represents this data is nil or not.109 attr_accessor :is Nil110 111 def initialize( initObj = nil)105 # @is_nil represents this data is nil or not. 106 attr_accessor :is_nil 107 108 def initialize(value = nil) 112 109 super() 113 110 @type = Type 114 111 @data = nil 115 @is Nil = true116 set( initObj ) if initObj112 @is_nil = true 113 set(value) if value 117 114 end 118 115 119 116 # set accepts a string which follows lexical space (ex. String: "+123"), or 120 117 # an object which follows canonical space (ex. Integer: 123). 121 def set( newData)122 if newData.nil?123 @is Nil = true118 def set(value) 119 if value.nil? 120 @is_nil = true 124 121 @data = nil 125 122 else 126 @is Nil = false127 _set( newData)123 @is_nil = false 124 _set(value) 128 125 end 129 126 end … … 131 128 # to_s creates a string which follows lexical space (ex. String: "123"). 132 129 def to_s() 133 if @is Nil130 if @is_nil 134 131 "" 135 132 else … … 138 135 end 139 136 140 protected 141 def trim( data)142 data.sub( /\A\s*(\S*)\s*\z/, '\1' )143 end 144 145 private 146 def _set( newObj)147 @data = newObj137 def trim(data) 138 data.sub(/\A\s*(\S*)\s*\z/, '\1') 139 end 140 141 private 142 143 def _set(value) 144 @data = value 148 145 end 149 146 … … 154 151 155 152 class XSDNil < XSDAnySimpleType 156 Type = QName.new( Namespace, NilLiteral)153 Type = QName.new(Namespace, NilLiteral) 157 154 Value = 'true' 158 155 159 public 160 def initialize( initNil = nil)161 super()162 @type = Type163 set( initNil )164 end 165 166 private 167 def _set( newNil)168 @data = newNil156 def initialize(value = nil) 157 super() 158 @type = Type 159 set(value) 160 end 161 162 private 163 164 def _set(value) 165 @data = value 169 166 end 170 167 end … … 175 172 # 176 173 class XSDString < XSDAnySimpleType 177 Type = QName.new( Namespace, StringLiteral ) 178 179 public 180 def initialize( initString = nil ) 174 Type = QName.new(Namespace, StringLiteral) 175 176 def initialize(value = nil) 181 177 super() 182 178 @type = Type 183 179 @encoding = nil 184 set( initString ) if initString 185 end 186 187 private 188 def _set( newString ) 189 unless SOAP::Charset.isCES( newString, SOAP::Charset.getEncoding ) 190 raise ValueSpaceError.new( "#{ type }: cannot accept '#{ newString }'." ) 191 end 192 @data = newString 180 set(value) if value 181 end 182 183 private 184 185 def _set(value) 186 unless SOAP::Charset.is_ces(value, SOAP::Charset.encoding) 187 raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.") 188 end 189 @data = value 193 190 end 194 191 end 195 192 196 193 class XSDBoolean < XSDAnySimpleType 197 Type = QName.new( Namespace, BooleanLiteral)198 199 public 200 def initialize( initBoolean = nil)201 super()202 @type = Type203 set( initBoolean )204 end 205 206 private 207 def _set( newBoolean)208 if newBoolean.is_a?( String)209 str = trim( newBoolean)194 Type = QName.new(Namespace, BooleanLiteral) 195 196 def initialize(value = nil) 197 super() 198 @type = Type 199 set(value) 200 end 201 202 private 203 204 def _set(value) 205 if value.is_a?(String) 206 str = trim(value) 210 207 if str == 'true' || str == '1' 211 208 @data = true … … 213 210 @data = false 214 211 else 215 raise ValueSpaceError.new( "#{ type }: cannot accept '#{ str }'.")212 raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.") 216 213 end 217 214 else 218 @data = newBoolean? true : false215 @data = value ? true : false 219 216 end 220 217 end … … 222 219 223 220 class XSDDecimal < XSDAnySimpleType 224 Type = QName.new( Namespace, DecimalLiteral ) 225 226 public 227 def initialize( initDecimal = nil ) 221 Type = QName.new(Namespace, DecimalLiteral) 222 223 def initialize(value = nil) 228 224 super() 229 225 @type = Type … … 231 227 @number = '' 232 228 @point = 0 233 set( initDecimal ) if initDecimal229 set(value) if value 234 230 end 235 231 236 232 def nonzero? 237 ( @number != '0' ) 238 end 239 240 private 241 def _set( d ) 242 if d.is_a?( String ) 243 # Integer( "00012" ) => 10 in Ruby. 244 d.sub!( /^([+\-]?)0*(?=\d)/, "\\1" ) 245 end 246 set_str( d ) 247 end 248 249 def set_str( str ) 250 /^([+\-]?)(\d*)(?:\.(\d*)?)?$/ =~ trim( str.to_s ) 233 (@number != '0') 234 end 235 236 private 237 238 def _set(d) 239 if d.is_a?(String) 240 # Integer("00012") => 10 in Ruby. 241 d.sub!(/^([+\-]?)0*(?=\d)/, "\\1") 242 end 243 set_str(d) 244 end 245 246 def set_str(str) 247 /^([+\-]?)(\d*)(?:\.(\d*)?)?$/ =~ trim(str.to_s) 251 248 unless Regexp.last_match 252 raise ValueSpaceError.new( "#{ type }: cannot accept '#{ str }'.")249 raise ValueSpaceError.new("#{ type }: cannot accept '#{ str }'.") 253 250 end 254 251 255 252 @sign = $1 || '+' 256 int egerPart = $2257 frac tionPart = $3258 259 int egerPart = '0' if integerPart.empty?260 frac tionPart = fractionPart ? fractionPart.sub( /0+$/, '') : ''261 @point = - frac tionPart.size262 @number = int egerPart + fractionPart253 int_part = $2 254 frac_part = $3 255 256