Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in returning an array in a container

 
ranjiith s
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
ranjiith s
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got this working with the '-w' option turned on when generating java from wsdl.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic