# # Copyright (C) 2007 Mobio Networks, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # ### # This class uses class-based-instance variables to store a driver # for each type of WSDL based webservice that needs to be accessed. # :author Nate Agrin ### require 'soap/wsdlDriver' module Rmobio module WebServices class WsdlDriver # class-level-instance variables # see http://wiseheartdesign.com/2006/9/22/class-level-instance-variables/ @wsdl = nil @driver = nil # class level methods class << self attr_accessor :wsdl, :driver # sets the wsdl variable and attempts to create a SOAP::WSDLDriver object def wsdl=(wsdl) @wsdl = wsdl @driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver end end # instance method for returning the underlying rpc_driver def driver self.class.driver end # instance method for returning the underlying wsdl address def wsdl self.class.wsdl end # this may not be very useful because responses require interpertation def method_missing(method_id, *args) driver.send method_id, args if driver.respond_to?(method_id) end end end end