How can soap client call methods in a free way?

Hi everyone,
I'm new to soap,
I wonder how to call methods as free as if all the objects are local? To
explain my question, I attached my code, please help me to look into it.
Thanks a lot.
And what's more, I searched the web and there's too little infomation
about ruby soap, have you guys switched to REST or sth else?

==========Server code is as below

require 'soap/rpc/standaloneServer'

module MySOAP

  class Test1
    def initialize
      @a = 1
      @b = 2

    def test1

  class Test2
    def test2


class TimeServer < SOAP::RPC::StandaloneServer
def on_init
  test1 =
  test2 =
  add_method(test1, "test1")
  add_method(test2, "test2")

NS = 'http://localhost/soap'
port = 12321
svr ='timer',NS,'',port)
trap('INT') { svr.shutdown }
puts "My SOAP is starting... port:#{port} (Ctrl+c to quit)"
puts "My SOAP is stop."

===========And Client code is like this:
require 'pp'
require 'soap/rpc/driver'
proxy ="http://localhost:12321",

pp proxy
a = proxy.test2
a.test1 ====> I can only call proxy.test1 but can't call a.test1? a
is a Test1 object.


Posted via