Class: WSDL::Parser::Importer Private

Inherits:
Object
  • Object
show all
Includes:
Log
Defined in:
lib/wsdl/parser/importer.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Imports WSDL documents and their referenced schemas.

Handles recursive imports, including WSDL imports and XSD imports/includes. Supports relative paths resolved against the parent document's location.

Constant Summary collapse

RECOVERABLE_SCHEMA_IMPORT_ERRORS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Exceptions that are treated as recoverable schema import failures.

These are wrapped into SchemaImportError and either raised or collected depending on strict schema mode.

Returns:

  • (Array<Class>)
[
  SystemCallError,
  IOError,
  EOFError,
  SocketError,
  URI::InvalidURIError,
  Timeout::Error
].tap { |errors|
  errors << OpenSSL::SSL::SSLError if defined?(OpenSSL::SSL::SSLError)
  errors << Net::OpenTimeout if defined?(Net::OpenTimeout)
  errors << Net::ReadTimeout if defined?(Net::ReadTimeout)
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Log

#logger

Constructor Details

#initialize(resolver, documents, schemas, parse_options) ⇒ Importer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new Importer instance.

Parameters:



45
46
47
48
49
50
51
52
53
# File 'lib/wsdl/parser/importer.rb', line 45

def initialize(resolver, documents, schemas, parse_options)
  @resolver = resolver
  @documents = documents
  @schemas = schemas
  @limits = parse_options.limits
  @strict_schema = parse_options.strict_schema
  @schema_count = 0
  @schema_import_errors = []
end

Instance Attribute Details

#schema_import_errorsArray<SchemaImportError> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Recoverable schema import errors captured during import.

Returns:



58
59
60
# File 'lib/wsdl/parser/importer.rb', line 58

def schema_import_errors
  @schema_import_errors
end

Instance Method Details

#import(location) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Imports a WSDL document and all its dependencies.

Parameters:

  • location (String)

    the location of the WSDL (URL or file path)



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/wsdl/parser/importer.rb', line 64

def import(location)
  @import_locations = []

  logger.info("Resolving WSDL document #{location.inspect}.")
  import_document(location, base: nil) do |document, resolved_location|
    @documents << document
    schemas = document.schemas(resolved_location)
    track_schema_count(schemas.size)
    @schemas.push(schemas)
  end

  # Resolve XML schema imports and includes
  import_schemas

  @documents.seal!
end