Class: Savon::WSDLStream

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

Overview

Savon::WSDLStream

Stream listener for parsing the WSDL document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWSDLStream

Initializer, sets an empty Hash of operations.



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

def initialize
  @operations = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object

Catches calls to unimplemented hook methods.



101
102
# File 'lib/savon/wsdl.rb', line 101

def method_missing(method, *args)
end

Instance Attribute Details

#namespace_uriObject (readonly)

Returns the namespace URI from the WSDL document.



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

def namespace_uri
  @namespace_uri
end

#operationsObject (readonly)

Returns the SOAP operations found in the WSDL document.



67
68
69
# File 'lib/savon/wsdl.rb', line 67

def operations
  @operations
end

Instance Method Details

#operation_from(name, attrs) ⇒ Object

Stores available operations from a given tag name and attrs.



90
91
92
93
94
95
96
97
98
# File 'lib/savon/wsdl.rb', line 90

def operation_from(name, attrs)
  if name == "wsdl:operation"
    @action = attrs["name"]
  elsif /.+:operation/ === name
    @action = attrs["soapAction"] if attrs["soapAction"] && !attrs["soapAction"].empty?
    input = @action.split("/").last
    @operations[input.snakecase.to_sym] = { :action => @action, :input => input }
  end
end

#section_from(name) ⇒ Object

Sets the current section of the WSDL document from a given tag name.



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

def section_from(name)
  section = case name
    when "wsdl:definitions" then :definitions
    when "wsdl:types"       then :types
    when "wsdl:message"     then :message
    when "wsdl:portType"    then :port_type
    when "wsdl:binding"     then :binding
    when "wsdl:service"     then :service
  end
  @section = section if section
end

#tag_start(name, attrs) ⇒ Object

Hook method called when the stream parser encounters a tag.



70
71
72
73
74
# File 'lib/savon/wsdl.rb', line 70

def tag_start(name, attrs)
  section_from name
  @namespace_uri ||= attrs["targetNamespace"] if @section == :definitions
  operation_from name, attrs if @section == :binding && /.+:operation/ === name
end