Class: WSDL::Parser::Result Private
- Inherits:
-
Object
- Object
- WSDL::Parser::Result
- Defined in:
- lib/wsdl/parser/result.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.
Represents a parsed WSDL document definition.
This class is responsible for importing and parsing WSDL documents, including all referenced schemas and imports. It provides access to services, ports, and operations defined in the WSDL.
This is the main result object produced by the parsing process and is used internally by Client to access WSDL information.
Instance Attribute Summary collapse
-
#documents ⇒ DocumentCollection
readonly
private
The collection of parsed WSDL documents.
-
#limits ⇒ Limits
readonly
private
The resource limits used for parsing.
-
#schema_import_errors ⇒ Array<SchemaImportError>
readonly
private
Recoverable schema import errors captured during import.
-
#schemas ⇒ Schema::Collection
readonly
private
The collection of XML schemas referenced by the WSDL.
-
#strict_schema ⇒ Boolean
readonly
private
Returns whether strict schema mode is enabled.
Class Method Summary collapse
-
.parse(wsdl, http, parse_options = nil) ⇒ Result
private
Imports and parses a WSDL document, returning a fully-populated Result.
Instance Method Summary collapse
-
#initialize(documents:, schemas:, limits:, strict_schema:, schema_import_errors:) ⇒ Result
constructor
private
Creates a new Result with pre-computed data.
-
#operation(service_name, port_name, operation_name) ⇒ OperationInfo
private
Returns an OperationInfo for a given service, port, and operation name.
-
#operations(service_name, port_name) ⇒ Array<String>
private
Returns an array of operation names for a given service and port.
-
#schema_complete_for_operation?(operation_info) ⇒ Boolean
private
Returns whether schema metadata is complete for the given operation.
-
#service_name ⇒ String
private
Returns the name of the primary service.
-
#services ⇒ Hash
private
Returns a Hash of services and ports defined by the WSDL.
Constructor Details
#initialize(documents:, schemas:, limits:, strict_schema:, schema_import_errors:) ⇒ Result
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 Result with pre-computed data.
This constructor performs no I/O. Use parse to import and parse a WSDL document from a URL or file path.
74 75 76 77 78 79 80 |
# File 'lib/wsdl/parser/result.rb', line 74 def initialize(documents:, schemas:, limits:, strict_schema:, schema_import_errors:) @documents = documents @schemas = schemas @limits = limits @strict_schema = strict_schema @schema_import_errors = schema_import_errors end |
Instance Attribute Details
#documents ⇒ DocumentCollection (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.
The collection of parsed WSDL documents.
85 86 87 |
# File 'lib/wsdl/parser/result.rb', line 85 def documents @documents end |
#limits ⇒ Limits (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.
The resource limits used for parsing.
95 96 97 |
# File 'lib/wsdl/parser/result.rb', line 95 def limits @limits end |
#schema_import_errors ⇒ Array<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.
105 106 107 |
# File 'lib/wsdl/parser/result.rb', line 105 def schema_import_errors @schema_import_errors end |
#schemas ⇒ Schema::Collection (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.
The collection of XML schemas referenced by the WSDL.
90 91 92 |
# File 'lib/wsdl/parser/result.rb', line 90 def schemas @schemas end |
#strict_schema ⇒ Boolean (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.
Returns whether strict schema mode is enabled.
100 101 102 |
# File 'lib/wsdl/parser/result.rb', line 100 def strict_schema @strict_schema end |
Class Method Details
.parse(wsdl, http, parse_options = nil) ⇒ Result
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.
Imports and parses a WSDL document, returning a fully-populated Result.
This factory method performs source validation, sandbox resolution, and the full import/parse cycle. Use #initialize directly only when you already have pre-computed results (e.g. in tests).
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/wsdl/parser/result.rb', line 42 def self.parse(wsdl, http, = nil, **) ||= ParseOptions.default(**) documents = DocumentCollection.new schemas = Schema::Collection.new source = Source.validate_wsdl!(wsdl) resolved_sandbox_paths = source.resolve_sandbox_paths(.sandbox_paths) resolver = Resolver.new(http, sandbox_paths: resolved_sandbox_paths, limits: .limits) importer = Importer.new(resolver, documents, schemas, ) importer.import(source.value) new( documents:, schemas:, limits: .limits, strict_schema: .strict_schema, schema_import_errors: importer.schema_import_errors.freeze ) end |
Instance Method Details
#operation(service_name, port_name, operation_name) ⇒ OperationInfo
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.
Returns an OperationInfo for a given service, port, and operation name.
157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/wsdl/parser/result.rb', line 157 def operation(service_name, port_name, operation_name) verify_operation_exists!(service_name, port_name, operation_name) port = @documents.service_port(service_name, port_name) endpoint = port.location binding = port.fetch_binding(@documents) binding_operation = binding.operations.fetch(operation_name) port_type = binding.fetch_port_type(@documents) port_type_operation = port_type.operations.fetch(operation_name) OperationInfo.new(operation_name, endpoint, binding_operation, port_type_operation, self) end |
#operations(service_name, port_name) ⇒ Array<String>
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.
Returns an array of operation names for a given service and port.
141 142 143 144 145 146 147 148 |
# File 'lib/wsdl/parser/result.rb', line 141 def operations(service_name, port_name) verify_service_and_port_exist!(service_name, port_name) port = @documents.service_port(service_name, port_name) binding = port.fetch_binding(@documents) binding.operations.keys end |
#schema_complete_for_operation?(operation_info) ⇒ Boolean
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.
Returns whether schema metadata is complete for the given operation.
In best-effort import mode, failures may be tolerated globally. This method allows operation-level gating for strict request validation.
179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/wsdl/parser/result.rb', line 179 def schema_complete_for_operation?(operation_info) return true if @schema_import_errors.empty? return true if input_empty?(operation_info) return false if @schema_import_errors.any? { |error| error.base_location.nil? } operation_namespaces = input_namespaces_for(operation_info) return true if operation_namespaces.empty? affected_namespaces = namespaces_affected_by_import_errors !operation_namespaces.intersect?(affected_namespaces) end |
#service_name ⇒ String
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.
Returns the name of the primary service.
This is the name attribute of the root WSDL definitions element.
112 113 114 |
# File 'lib/wsdl/parser/result.rb', line 112 def service_name @documents.service_name end |
#services ⇒ Hash
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.
Returns a Hash of services and ports defined by the WSDL.
131 132 133 |
# File 'lib/wsdl/parser/result.rb', line 131 def services @documents.services.values.inject({}) { |memo, service| memo.merge service.to_hash } end |