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.



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

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



21
22
23
# File 'lib/lolsoap/wsdl.rb', line 21

def endpoint
  @endpoint
end

#namespacesObject (readonly)

Hash of namespaces to generated prefixes



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

def namespaces
  @namespaces
end

#prefixesObject (readonly)

Hash of generated prefixes to namespaces



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

def prefixes
  @prefixes
end

#soap_versionObject (readonly)

The version of SOAP detected.



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

def soap_version
  @soap_version
end

Class Method Details

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

Create a new instance by parsing a raw string of XML



16
17
18
# File 'lib/lolsoap/wsdl.rb', line 16

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



63
64
65
# File 'lib/lolsoap/wsdl.rb', line 63

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

#abstract_typesObject

Hash of abstract types declared by the service



49
50
51
# File 'lib/lolsoap/wsdl.rb', line 49

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

#inspectObject



82
83
84
85
86
87
# File 'lib/lolsoap/wsdl.rb', line 82

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

#operation(name) ⇒ Object

Get a single operation



73
74
75
# File 'lib/lolsoap/wsdl.rb', line 73

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

#operationsObject

Hash of operations that are supported by the SOAP service



68
69
70
# File 'lib/lolsoap/wsdl.rb', line 68

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

#prefix(namespace) ⇒ Object

Get the prefix for a namespace



78
79
80
# File 'lib/lolsoap/wsdl.rb', line 78

def prefix(namespace)
  prefixes.fetch namespace
end

#type(namespace, name) ⇒ Object

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



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

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



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

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