# File lib/wsdl/xmlSchema/importer.rb, line 29 29: def import(location, originalroot = nil) 30: if DO_NOT_IMPORT.include?(location.to_s) 31: return nil 32: end 33: unless location.is_a?(URI) 34: location = URI.parse(location) 35: end 36: source, normalizedlocation = fetch(location) 37: content = parse(source, normalizedlocation, originalroot) 38: content.location = normalizedlocation 39: content 40: end
# File lib/wsdl/xmlSchema/importer.rb, line 52 52: def fetch(location) 53: warn("importing: #{location}") if $DEBUG 54: content = nil 55: normalizedlocation = location 56: if location.scheme == 'file' or 57: (location.relative? and FileTest.exist?(location.path)) 58: content = File.open(location.path).read 59: normalizedlocation = URI.parse('file://' + File.expand_path(location.path)) 60: elsif location.scheme and location.scheme.size == 1 and 61: FileTest.exist?(location.to_s) 62: # ToDo: remove this ugly workaround for a path with drive letter 63: # (D://foo/bar) 64: content = File.open(location.to_s).read 65: else 66: client = web_client.new(nil, "WSDL4R") 67: client.proxy = ::SOAP::Env::HTTP_PROXY 68: client.no_proxy = ::SOAP::Env::NO_PROXY 69: if opt = ::SOAP::Property.loadproperty(::SOAP::PropertyName) 70: http_opt = opt["client.protocol.http"] 71: ::SOAP::HTTPConfigLoader.set_options(client, http_opt) if http_opt 72: end 73: content = client.get_content(location) 74: end 75: return content, normalizedlocation 76: end
# File lib/wsdl/xmlSchema/importer.rb, line 44 44: def parse(content, location, originalroot) 45: opt = { 46: :location => location, 47: :originalroot => originalroot 48: } 49: WSDL::XMLSchema::Parser.new(opt).parse(content) 50: end
# File lib/wsdl/xmlSchema/importer.rb, line 78 78: def web_client 79: return @web_client if @web_client 80: begin 81: require 'httpclient' 82: @web_client = HTTPClient 83: rescue LoadError 84: begin 85: require 'http-access2' 86: if HTTPAccess2::VERSION < "2.0" 87: raise LoadError.new("http-access/2.0 or later is required.") 88: end 89: @web_client = HTTPAccess2::Client 90: rescue LoadError 91: warn("Loading http-access2 failed. Net/http is used.") if $DEBUG 92: require 'soap/netHttpClient' 93: @web_client = ::SOAP::NetHttpClient 94: end 95: end 96: @web_client 97: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.