Created
March 13, 2009 18:15
-
-
Save jashmenn/78685 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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