Module: WSDL::Parser Private

Defined in:
lib/wsdl/parser.rb,
lib/wsdl/parser/port.rb,
lib/wsdl/parser/binding.rb,
lib/wsdl/parser/service.rb,
lib/wsdl/parser/document.rb,
lib/wsdl/parser/port_type.rb,
lib/wsdl/parser/input_output.rb,
lib/wsdl/parser/message_info.rb,
lib/wsdl/parser/import_result.rb,
lib/wsdl/parser/operation_map.rb,
lib/wsdl/parser/operation_info.rb,
lib/wsdl/parser/header_reference.rb,
lib/wsdl/parser/binding_operation.rb,
lib/wsdl/parser/message_reference.rb,
lib/wsdl/parser/document_collection.rb,
lib/wsdl/parser/port_type_operation.rb

Overview

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

WSDL and XSD document parsing.

This module contains classes for parsing WSDL documents and their referenced XML schemas into structured objects. I/O (fetching, sandboxing, import orchestration) lives in Resolver.

The two entry points are:

Defined Under Namespace

Classes: Binding, BindingOperation, Document, DocumentCollection, HeaderReference, ImportResult, Input, MessageInfo, MessageParts, MessageReference, OperationInfo, OperationMap, Output, Port, PortType, PortTypeOperation, Service

Class Method Summary collapse

Class Method Details

.import(wsdl, http, sandbox_paths: nil, limits: nil, strictness: nil) ⇒ ImportResult

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.

Resolves and imports a WSDL document and all its dependencies.

Validates the source, resolves imports, and returns the parsed documents and schemas without building a Definition. Use this when you need access to the intermediate parse structures.

Parameters:

  • wsdl (String)

    a URL or local file path to the WSDL document

  • http (Object)

    an HTTP client instance for fetching remote documents

  • sandbox_paths (Array<String>, nil) (defaults to: nil)

    directories where file access is allowed

  • limits (Limits, nil) (defaults to: nil)

    resource limits for DoS protection

  • strictness (Strictness, nil) (defaults to: nil)

    strictness settings for schema validation

Returns:

  • (ImportResult)

    the imported documents, schemas, and metadata



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/wsdl/parser.rb', line 45

def self.import(wsdl, http, sandbox_paths: nil, limits: nil, strictness: nil)
  parse_options = ParseOptions.default(sandbox_paths:, limits:, strictness:)

  documents = DocumentCollection.new
  schemas = Schema::Collection.new

  source = Resolver::Source.validate_wsdl!(wsdl)
  resolved_sandbox_paths = source.resolve_sandbox_paths(parse_options.sandbox_paths)
  loader = Resolver::Loader.new(http, sandbox_paths: resolved_sandbox_paths, limits: parse_options.limits)
  importer = Resolver::Importer.new(loader, documents, schemas, parse_options)
  importer.import(source.value)

  ImportResult.new(
    documents:, schemas:,
    provenance: importer.provenance.freeze,
    schema_import_errors: importer.schema_import_errors.freeze
  )
end

.parse(wsdl, http, sandbox_paths: nil, limits: nil, strictness: nil) ⇒ Definition

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.

Parses a WSDL document and returns a frozen Definition.

Validates the source, resolves all imports and schemas, and builds the Definition IR. This is the primary entry point for the parse pipeline. When this method returns (even on exception), Nokogiri DOM references are released from the schema collection and the QName resolve cache is cleared so the DOM trees and namespace hashes can be garbage-collected.

Parameters:

  • wsdl (String)

    a URL or local file path to the WSDL document

  • http (Object)

    an HTTP client instance for fetching remote documents

  • sandbox_paths (Array<String>, nil) (defaults to: nil)

    directories where file access is allowed

  • limits (Limits, nil) (defaults to: nil)

    resource limits for DoS protection

  • strictness (Strictness, nil) (defaults to: nil)

    strictness settings for schema validation

Returns:



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/wsdl/parser.rb', line 79

def self.parse(wsdl, http, sandbox_paths: nil, limits: nil, strictness: nil)
  result = import(wsdl, http, sandbox_paths:, limits:, strictness:)

  Definition::Builder.new(
    documents: result.documents, schemas: result.schemas,
    limits: limits || Limits.new,
    schema_import_errors: result.schema_import_errors,
    provenance: result.provenance
  ).build
ensure
  result&.schemas&.release_dom_references!
  QName.clear_resolve_cache
end