Changeset 761
- Timestamp:
- 01/18/03 02:17:17 (6 years ago)
- Files:
-
- trunk/bin/wsdl2ruby.rb (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bin/wsdl2ruby.rb
r697 r761 32 32 def initialize 33 33 super( 'app' ) 34 @wsdlFile = nil 34 STDERR.sync = true 35 @wsdlLocation = nil 35 36 @opt = {} 36 37 @wsdl = nil … … 39 40 40 41 def run 41 @wsdl File, @opt = parseOpt( GetoptLong.new( *OptSet ))42 usageExit unless @wsdl File43 @wsdl = WSDL::WSDLParser.createParser.parse( File.open( @wsdlFile ))42 @wsdlLocation, @opt = parseOpt( GetoptLong.new( *OptSet )) 43 usageExit unless @wsdlLocation 44 @wsdl = import(@wsdlLocation) 44 45 @name = @wsdl.name.name || 'default' 45 46 createFile … … 59 60 def usageExit 60 61 puts <<__EOU__ 61 Usage: #{ $0 } --wsdl wsdlFilename [options] 62 Usage: #{ $0 } --wsdl wsdlLocation [options] 63 wsdlLocation: filename or URL 62 64 63 65 Example: … … 68 70 69 71 Options: 70 --wsdl wsdl Filename72 --wsdl wsdlLocation 71 73 --type server|client 72 74 --type server implies; … … 98 100 def parseOpt( getOpt ) 99 101 opt = {} 100 wsdl File= nil102 wsdl = nil 101 103 begin 102 104 getOpt.each do | name, arg | 103 105 case name 104 106 when "--wsdl" 105 wsdl File= arg107 wsdl = arg 106 108 when "--type" 107 109 case arg … … 129 131 usageExit 130 132 end 131 return wsdl File, opt133 return wsdl, opt 132 134 end 133 135 … … 241 243 name ? XSD::QName.new( @wsdl.targetNamespace, name ) : nil 242 244 end 245 246 def import(location) 247 content = nil 248 if FileTest.exist?(location) 249 content = File.open(location).read 250 else 251 require 'http-access2' 252 c = HTTPAccess2::Client.new(ENV[ 'http_proxy' ] || ENV[ 'HTTP_PROXY' ]) 253 content = c.getContent(location) 254 end 255 WSDL::WSDLParser.createParser.parse(content) 256 end 243 257 end 244 258