Re: Casting Object to NSArray
Re: Casting Object to NSArray
- Subject: Re: Casting Object to NSArray
- From: Art Isbell <email@hidden>
- Date: Fri, 27 Jun 2003 17:18:27 -1000
On Friday, June 27, 2003, at 04:35 PM, Goodbye Bill wrote:
Thanks for all of the replies, however I left out one small detail
that will
probably change all of your answers: this is via a web service.
The code on the SERVER (the WebService) looks like this...
private NSArray myObjects;
public NSArray GetObjects()
{
return myObjects;
}
The code on the CLIENT (the consumer app) looks like this...
public NSArray myReceivedObjects()
{
Object tmpArray = serviceClient().invoke(serviceName(),
"GetObjects", null);
return (NSArray)tmpArray;
}
Here's a little more info on this:
1. The "serviceClient" is a "WOWebServiceClient" object;
2. According to the API Reference, the "invoke" method on this object
returns an "Object" regardless of what method it invokes on the server.
The client example above will compile but generates a
"ClassCastException"
exception at runtime.
Any ideas? I'm going on two full days working with this. The bottom
line
is that I need to get an array of objects from a web service.
The documentation for invoke() states, "This method may return either
an object, or a language array of objects." I read "language array of
objects" to mean an Object[] (i.e., a primitive Java array) rather than
an NSArray. Apparently you didn't do what I suggested: print
tmpArray.getClass().getClassName() to see what class of object is
returned.
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.