aspose file tools
The moose likes Web Services and the fly likes passing collection object as an argument to Web service Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "passing collection object as an argument to Web service" Watch "passing collection object as an argument to Web service" New topic
Author

passing collection object as an argument to Web service

manisha makwana
Ranch Hand

Joined: Sep 14, 2007
Posts: 37
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
Ivan Krizsan
Bartender

Joined: Oct 04, 2006
Posts: 2193
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

Joined: Sep 14, 2007
Posts: 37
Thanks for the reply
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: passing collection object as an argument to Web service
 
Similar Threads
Objectssorting
arrylist doubt
Need to Help on passing org.w3c.dom.Node and org.w3c.dom.Document across wsdl
passing array parameter in URL
Web service Response to DOM