Class: SOAP::WSDL

Inherits:
Object
  • Object
show all
Defined in:
lib/wsdl-reader/wsdl.rb,
lib/wsdl-reader/service.rb

Defined Under Namespace

Classes: Service, Services

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, binding) ⇒ WSDL

:nodoc:



8
9
10
11
# File 'lib/wsdl-reader/wsdl.rb', line 8

def initialize(uri, binding) #:nodoc:
  @parse = SOAP::WSDL::Parser.new(uri)
  @binding = binding
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *args) ⇒ Object

Call a method for the current WSDL and get the corresponding SOAP::Request

Example:

wsdl = SOAP::LC.new.wsdl("http://...")
request = wsdl.myMethod(:param1 => "hello")
  # => #<SOAP::Request:0xNNNNNN>


19
20
21
# File 'lib/wsdl-reader/wsdl.rb', line 19

def method_missing(id, *args) 
  request(@binding).call(id.id2name, args[0])
end

Instance Attribute Details

#parseObject (readonly)

Returns the value of attribute parse.



6
7
8
# File 'lib/wsdl-reader/wsdl.rb', line 6

def parse
  @parse
end

Instance Method Details

#call(name, args = {}) ⇒ Object

Call a method for the current WSDL and get the corresponding SOAP::Request

Example:

wsdl = SOAP::LC.new.wsdl("http://...")
request = wsdl.call("myMethod", { :param1 => "hello" })
  # => #<SOAP::Request:0xNNNNNN>


34
35
36
# File 'lib/wsdl-reader/wsdl.rb', line 34

def call(name, args = {})
  request(@binding).call(name, args)
end

#operationsObject

Return available SOAP operations



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

def operations
  request(@binding).operations
end

#request(binding = nil) ⇒ Object

Get a SOAP::Request object for the current WSDL

Example:

wsdl = SOAP::LC.new.wsdl("http://...")
request = wsdl.request
  # => #<SOAP::Request:0xNNNNNN>


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

def request(binding = nil)
  SOAP::Request.new(@parse, binding)
end