Hi, Holden,
I'm sorry but I misunderstood the problem.
> From: Holden Glova [mailto:dsafari@xtra.co.nz]
> Sent: Friday, March 22, 2002 6:37 PM
> > 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?
Yes. But if the object was created by SOAP4R,
your Proxy#initialize was not called. SOAP4R set
@name using instance_eval.
Is the Proxy object really sent back from the server side?
Your server side method is something like
def search_for_entry_index
proxy = RAA::Proxy.new( [ :name ] )
proxy.name = [ "name1", "name2" ... ]
return proxy
end
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.
Seeing the result of inspect, it should work but it's only a workaround.
> > 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?
Ignore this if above (*) is wrong.
I thought you should define
def search_for_entry_index
hash = Hash.new
hash[ 'name' ] = [ "name1", "name2" ... ]
return proxy
end
instead of returning Proxy object.
> > 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 :)
I'll do it after I will understand what you want to do
correctly.
> /me goes and tries changing the name to see if it makes a diference
Thanks in advance. I remembered that I introduced the
bug which is a name crash of the method "name" in an old
release of SOAP4R... There may be the same beast in the
code.
Regards,
// NaHi