Class: WSDL::Parser::Document Private

Inherits:
Object
  • Object
show all
Defined in:
lib/wsdl/parser/document.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 single parsed WSDL document.

Parses a WSDL XML document and provides access to its various sections including messages, bindings, port types, and services. Also extracts XML Schema definitions embedded within the WSDL.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document, schemas) ⇒ Document

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 Document by parsing a Nokogiri XML document.

Parameters:

  • document (Nokogiri::XML::Document)

    the parsed WSDL XML document

  • schemas (Schema::Collection)

    the schema collection for resolving types



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/wsdl/parser/document.rb', line 18

def initialize(document, schemas)
  @document = document
  @schemas = schemas

  reject_unsupported_version!

  @messages = {}
  @bindings = {}
  @port_types = {}
  @services = {}

  collect_sections(
    'message' => { collection: @messages, container: MessageInfo, qualified: true },
    'binding' => { collection: @bindings, container: Binding, qualified: true },
    'portType' => { collection: @port_types, container: PortType, qualified: true },
    'service' => { collection: @services, container: Service }
  )
end

Instance Attribute Details

#bindingsHash{QName => Binding} (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 the bindings defined in this document.

Returns:

  • (Hash{QName => Binding})

    the bindings defined in this document



44
45
46
# File 'lib/wsdl/parser/document.rb', line 44

def bindings
  @bindings
end

#messagesHash{QName => MessageInfo} (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 the messages defined in this document.

Returns:



38
39
40
# File 'lib/wsdl/parser/document.rb', line 38

def messages
  @messages
end

#port_typesHash{QName => PortType} (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 the port types defined in this document.

Returns:

  • (Hash{QName => PortType})

    the port types defined in this document



41
42
43
# File 'lib/wsdl/parser/document.rb', line 41

def port_types
  @port_types
end

#servicesHash{String => Service} (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 the services defined in this document.

Returns:

  • (Hash{String => Service})

    the services defined in this document



47
48
49
# File 'lib/wsdl/parser/document.rb', line 47

def services
  @services
end

Instance Method Details

#importsArray<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 locations of imported WSDL documents.

Returns:

  • (Array<String>)

    the import locations



77
78
79
80
81
82
83
84
85
86
# File 'lib/wsdl/parser/document.rb', line 77

def imports
  imports = []

  @document.root.xpath('wsdl:import', 'wsdl' => NS::WSDL).each do |node|
    location = node['location']
    imports << location if location
  end

  imports
end

#schemas(source_location = nil) ⇒ Array<Schema::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.

Returns the XML Schemas defined within this WSDL document.

Schemas are typically found within the wsdl:types element.

Parameters:

  • source_location (String, nil) (defaults to: nil)

    the location this document was loaded from, used for resolving relative imports/includes within the schemas

Returns:



70
71
72
# File 'lib/wsdl/parser/document.rb', line 70

def schemas(source_location = nil)
  schema_nodes.map { |node| Schema::Definition.new(node, @schemas, source_location) }
end

#service_nameString

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 WSDL definitions element.

Returns:

  • (String)

    the service name from the root element's name attribute



52
53
54
# File 'lib/wsdl/parser/document.rb', line 52

def service_name
  @document.root['name']
end

#target_namespaceString

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 target namespace of this WSDL document.

Returns:

  • (String)

    the target namespace URI



59
60
61
# File 'lib/wsdl/parser/document.rb', line 59

def target_namespace
  @target_namespace ||= QName.document_namespace(@document.root)
end