Index: [Article Count Order] [Thread]

Date:  Fri, 22 Mar 2002 21:42:45 +1200
From:  Holden Glova <dsafari@xtra.co.nz>
Subject:  [webricken:74] Re: soaplet confusion saga
To:  webricken@notwork.org
Message-Id:  <20020322093727.CTTC20246.mta3-rme.xtra.co.nz@there>
In-Reply-To:  <20020322093159.WWRU14382.mta4-rme.xtra.co.nz@there>
References:  <000701c1d182$079e8ef0$85222fc0@sarion.co.jp> <20020322093159.WWRU14382.mta4-rme.xtra.co.nz@there>
X-Mail-Count: 00074

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 22 Mar 2002 21:37, Holden Glova wrote:
> On Fri, 22 Mar 2002 21:14, NAKAMURA, Hiroshi wrote:
> > Hi, Holden,
> >
> > > From: Holden Glova [mailto:dsafari@xtra.co.nz]
> > > Sent: Friday, March 22, 2002 4:02 PM
> > >
> > > class Proxy
> > >
> > >   def initialize(attributes)
> > >     attributes.each do |attribute|
> > >       name = attribute.id2name
> > >
> > >       instance_eval(<<-EOS)
> > >         class << self
> > >           attr_accessor :#{name}
> > >         end
> > >       EOS
> > >     end
> > >   end
> > >
> > > end
> >
> > Hmm.  Instance of Proxy is created by SOAP4R unmarshaller,
> > isn't it?  The SOAP4R unmarshaller allocates new object
> > without calling user's initialize and set its instance
> > variables.  Your Proxy#initialize is not called.  So the
> > method 'name' is not on your method list.
>
> Not sure I fully understand - my proxy initialize method must be getting
> called because the correct data is stored in the name attribute. Also, when
> I do a #type#to_s on the object coming back it is of type RAA::Proxy which
> is my class, no?
>
> > Workaround: you can retrieve instance variables like;
> > name = obj.instance_eval { @name }
> >
> > Other solutions:
> >
> > 1. SOAP4R creates proxy object when it encount unknown
> >   klass.  Remove Proxy class definition then your code will
> >   work.
>
> I'll try this right away.
>
> > 2. Can you send back Hash instead of Proxy class from
> >   server?
>
> I'm currently sending back an Array, would that do a similar thing to the
> Hash suggestion?
>
> > 3. Can you send back explicitly typed object?
>
> Hmm..Not sure how I would do that? Is there examples of how to do that
> somewhere? This is more then likely due to my lack of understanding about
> SOAP, but hey - that is why I'm playing with it :)
>
> /me goes and tries changing the name to see if it makes a diference

Changing the name had no effect, same problem. Here is the output produced:

synack@eugene:~/ruby/raa-succ$ ./raa-wrapper-client.rb -q ri
RAA::DataTransfer
#<RAA::DataTransfer:0x402cfb70 @name="Active attribute">
./raa-wrapper-client.rb:85:in `query_raa': undefined method `name' for 
#<RAA::DataTransfer:0x402cfb70> (NameError)
        from ./raa-wrapper-client.rb:48:in `initialize'
        from ./raa-wrapper-client.rb:48:in `call'
        from ./raa-wrapper-client.rb:77:in `start'
        from ./raa-wrapper-client.rb:99

- -- 
Signed,
Holden Glova
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8mvyV+mF116Lw2cQRAio7AJ4jhNc6HuOeJriAMp0UHEIsROXqhgCaA4sU
y4d9VT4X1SNj9JDz5eNCr08=
=1S0p
-----END PGP SIGNATURE-----