Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Return 2D array from web service

508871Dec 30 2010
Hi All,

I am new to web services development and start developing web service using net bean 6.9. I want to create the web service which needs to return the 2-d array. So i created it like this

public Object[][] getData(@WebParam(name = "startDate")
String startDate, @WebParam(name = "endDate")
String endDate) {

HashMap hm= new HashMap();
hm.put("key1", "val1");
hm.put("key2", "val2");

Object[][] twoDarray = new String[hm.size()][2];

Object[] keys = hm.keySet().toArray();
Object[] values = hm.values().toArray();


for (int row = 0; row < twoDarray.length; row++) {
twoDarray[row][0] = keys[row];
twoDarray[row][1] = values[row];
}

return twoDarray;
}

But when i test the web service using SOAPui then it did not returning anything. Can anyone guide me where is the problem??

Thanks
Shuja
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 27 2011
Added on Dec 30 2010
0 comments
95 views