[ale] Help with SOAP::Lite Object syntax
Brian Pitts
brian at polibyte.com
Thu Mar 20 17:02:12 EDT 2008
Resend since my MTA seems to have given up while the list was down.
Sorry I can't help you with SOAP::Lite. You did inspire me to try the
same thing in Ruby as a learning exercise, and I thought I'd send along
the result.
-Brian
server side
------------
require 'soap/rpc/standaloneServer'
class TestClass
attr_reader :test
def initialize
@test = 'test'
end
end
class TestServer < SOAP::RPC::StandaloneServer
def on_init
test = TestClass.new
add_method(test, 'test')
end
end
daemon = TestServer.new('test', 'urn:Test', '127.0.0.1', 8080)
trap('INT') { daemon.shutdown }
daemon.start
client side
------------
require 'soap/rpc/driver'
begin
test_object = SOAP::RPC::Driver.new('http://127.0.0.1:8080', 'urn:Test')
test_object.add_method('test')
puts test_object.test
rescue => err
puts err
end
More information about the Ale
mailing list