-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
- --
Signed,
Holden Glova
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8mvtN+mF116Lw2cQRAurUAJ9D7Fzu8wID/O52SeMQNFJULwpxvgCffePi
PeewK5H1pRlljEQUwoC6y14=
=PKuI
-----END PGP SIGNATURE-----