Skip to content

Instantly share code, notes, and snippets.

@jashmenn
Created March 13, 2009 18:15
Show Gist options
  • Save jashmenn/78685 to your computer and use it in GitHub Desktop.
Save jashmenn/78685 to your computer and use it in GitHub Desktop.
# an example of using ruby soap that will actually work.
#
# Modified from: http://rpheath.com/posts/298-consuming-soap-services-in-ruby
require 'soap/wsdlDriver'
require 'pp'
class SoapWrapper
attr_accessor :endpoint, :service
def initialize(endpoint=nil, service=nil)
@endpoint = endpoint
@service = service
end
def say_hello
soap = wsdl.create_rpc_driver
soap.wiredump_dev = STDERR
response = soap.Say_Hello(:TestLevel => "Test", :CompCode => "192.168.0.1", :Name => "Bob", :Mood => "happy")
soap.reset_stream
response.say_HelloResult
end
private
def wsdl
SOAP::WSDLDriverFactory.new("http://#{@endpoint}/service/#{@service}.asmx?WSDL")
end
end
soap = SoapWrapper.new("abc.service.com", "the_service")
pp soap.say_hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment