This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

passing collection object as an argument to Web service  RSS feed

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have to pass object of collection to web service method.I know that using collection is not a good solution but i have to pass this.
And my collection is of userdefined type like

public void processData(collection user){
//exposed as a web service method
}

Collection data = new HashMap();
data.put("data1", emp);

where emp is an Object of class Employee.

Can anyone explain me how to do this?I am using Axis web service
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Here are some suggestions, which I cannot guarantee will work since I haven't tried:
1. Create a custom class EmployeeEntry which contains the key and the associated instance of Employee.
Have your web service method accept an array of EmployeeEntry instances:

2. Create a custom class that wraps the collection.

Then in your web service method, you take an instance of the wrapper class as parameter:


Personally, I would try to go for alternative one.
Best wishes!
 
manisha makwana
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!