Class: LolSoap::WSDL

Inherits:
Object
  • Object
show all
Defined in:
lib/lolsoap/wsdl.rb,
lib/lolsoap/wsdl/type.rb,
lib/lolsoap/wsdl/element.rb,
lib/lolsoap/wsdl/null_type.rb,
lib/lolsoap/wsdl/operation.rb,
lib/lolsoap/wsdl/null_element.rb,
lib/lolsoap/wsdl/operation_io.rb,
lib/lolsoap/wsdl/operation_io_part.rb,
lib/lolsoap/wsdl/named_type_reference.rb,
lib/lolsoap/wsdl/immediate_type_reference.rb

Defined Under Namespace

Classes: Element, ImmediateTypeReference, NamedTypeReference, NullElement, NullType, Operation, OperationIO, OperationIOPart, Type

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parser, options = {}) ⇒ WSDL

Returns a new instance of WSDL.



34
35
36
37
38
39
40
41
42
43
# File 'lib/lolsoap/wsdl.rb', line 34

def initialize(parser, options={})
  @prefixes = generate_prefixes(parser)
  @namespaces = prefixes.invert
  @abstract_types = load_types(parser.abstract_types)
  @types = load_types(parser.types)
  @operations = load_operations(parser)
  @endpoint = parser.endpoint
  @soap_version = parser.soap_version
  @allow_abstract_types = options[:allow_abstract_types]
end

Instance Attribute Details

#endpointObject (readonly)

The SOAP endpoint URL



23
24
25
# File 'lib/lolsoap/wsdl.rb', line 23

def endpoint
  @endpoint
end

#namespacesObject (readonly)

Hash of namespaces to generated prefixes



29
30
31
# File 'lib/lolsoap/wsdl.rb', line 29

def namespaces
  @namespaces
end

#prefixesObject (readonly)

Hash of generated prefixes to namespaces



26
27
28
# File 'lib/lolsoap/wsdl.rb', line 26

def prefixes
  @prefixes
end

#soap_versionObject (readonly)

The version of SOAP detected.



32
33
34
# File 'lib/lolsoap/wsdl.rb', line 32

def soap_version
  @soap_version
end

Class Method Details

.parse(raw, options = {}) ⇒ Object

Create a new instance by parsing a raw string of XML



18
19
20
# File 'lib/lolsoap/wsdl.rb', line 18

def self.parse(raw, options={})
  new(WSDLParser.parse(raw), options)
end

Instance Method Details

#abstract_type(namespace, name) ⇒ Object

Get a single abstract type, or a NullType if the type doesn’t exist



65
66
67
# File 'lib/lolsoap/wsdl.rb', line 65

def abstract_type(namespace, name)
  @abstract_types.fetch([namespace, name]) { NullType.new }
end

#abstract_typesObject

Hash of abstract types declared by the service



51
52
53
# File 'lib/lolsoap/wsdl.rb', line 51

def abstract_types
  Hash[@abstract_types.values.map { |t| [t.name, t] }]
end

#inspectObject



84
85
86
87
88
89
# File 'lib/lolsoap/wsdl.rb', line 84

def inspect
  "<#{self.class} " \
  "namespaces=#{namespaces.inspect} " \
  "operations=#{operations.inspect} " \
  "types=#{types.inspect}>"
end

#operation(name) ⇒ Object

Get a single operation



75
76
77
# File 'lib/lolsoap/wsdl.rb', line 75

def operation(name)
  @operations.fetch(name)
end

#operationsObject

Hash of operations that are supported by the SOAP service



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

def operations
  Hash[@operations.values.map { |o| [o.name, o] }]
end

#prefix(namespace) ⇒ Object

Get the prefix for a namespace



80
81
82
# File 'lib/lolsoap/wsdl.rb', line 80

def prefix(namespace)
  prefixes.fetch namespace
end

#type(namespace, name) ⇒ Object

Get a single type, or a NullType if the type doesn’t exist



56
57
58
59
60
61
62
# File 'lib/lolsoap/wsdl.rb', line 56

def type(namespace, name)
  if @allow_abstract_types
    @types.fetch([namespace, name]) { abstract_type(namespace, name) }
  else
    @types.fetch([namespace, name]) { NullType.new }
  end
end

#typesObject

Hash of types declared by the service



46
47
48
# File 'lib/lolsoap/wsdl.rb', line 46

def types
  Hash[@types.values.map { |t| [t.name, t] }]
end