You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Ranjiith Selvarajan <ra...@yahoo.com> on 2005/07/12 11:00:40 UTC
Problem in returning an array in a container
hey,
As my subject line says I'm facing a problem when I
try to send an array in a container with Axis 1.2.1.
Here are the steps I followed.
The service at the server side returns the following
UserCollection.
(getUsers method in the service class returns
UserCollection.)
UserCollection
{
User[] users;
}
I have defined an arrayMapping for 'User[]',
beanMapping for 'User' and beanMapping for
'UserCollection'.
I generate WSDL using (Java2WSDL) and client side java
files using (WSDL2Java).
As I run the client side code it failed with
ArrayStoreException with a message cannot convert to
bean etc.
(some serialization issue)
After going thru some forum discussions I added the
following (indexed) to the 'UserCollection' object.
UserCollection
{
User[] users;
setUsers(int i, User user)
{
users[i] = user;
}
getUsers(int i)
{
return users[i];
}
}
And things started working fine as expected. I was
able to use the webservice (got the list of users).
But the *ServiceSoapBindingImpl that got generated at
the client side had return as 'User[]' and not
'UserCollection' as defined at the server side.
I would like to know why is this and what needs to be
corrected for the above to return 'UserCollection' ?
(getUsers returned User[] instead of UserCollection.)
Being a newbie I tried the options (-u LITERAL and -y
WRAPPED) to figure out what difference it makes and if
it can help in the current scenario but it did not.
Looking forward for a response.
cheerz
ranjiith s
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com