Class: Savon::WSDL::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/savon/wsdl/document.rb

Overview

Savon::WSDL::Document

Represents the WSDL of your service, including information like the namespace URI, the SOAP endpoint and available SOAP actions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request = nil, document = nil) ⇒ Document

Accepts an HTTPI::Request and a document.


16
17
18
19
# File 'lib/savon/wsdl/document.rb', line 16

def initialize(request = nil, document = nil)
  self.request = request
  self.document = document
end

Instance Attribute Details

#documentObject Also known as: to_xml

Returns the raw WSDL document.


74
75
76
77
78
79
# File 'lib/savon/wsdl/document.rb', line 74

def document
  @wsdl_document ||= begin
    raise ArgumentError, "No WSDL document given" if @document.blank?
    remote? ? http_request : read_file
  end
end

#endpointObject

Returns the SOAP endpoint.


37
38
39
# File 'lib/savon/wsdl/document.rb', line 37

def endpoint
  @endpoint ||= parser.endpoint
end

#namespaceObject

Returns the namespace URI of the WSDL.


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

def namespace
  @namespace ||= parser.namespace
end

#requestObject

Accessor for the HTTPI::Request to use.


22
23
24
# File 'lib/savon/wsdl/document.rb', line 22

def request
  @request
end

Instance Method Details

#element_form_defaultObject

Returns the elementFormDefault value.


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

def element_form_default
  @element_form_default ||= parser.element_form_default
end

#operationsObject

Returns a Hash of SOAP operations.


60
61
62
# File 'lib/savon/wsdl/document.rb', line 60

def operations
  @operations ||= parser.operations
end

#present?Boolean

Returns:

  • (Boolean)

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

def present?
  !!@document
end

#soap_action(key) ⇒ Object

Returns the SOAP action for a given key.


50
51
52
# File 'lib/savon/wsdl/document.rb', line 50

def soap_action(key)
  operations[key][:action] if present? && operations[key]
end

#soap_actionsObject

Returns an Array of available SOAP actions.


45
46
47
# File 'lib/savon/wsdl/document.rb', line 45

def soap_actions
  @soap_actions ||= parser.operations.keys
end

#soap_input(key) ⇒ Object

Returns the SOAP input for a given key.


55
56
57
# File 'lib/savon/wsdl/document.rb', line 55

def soap_input(key)
  operations[key][:input].to_sym if present? && operations[key]
end