aspose file tools*
The moose likes Web Services and the fly likes How to get <param-name> instead of <item> in response when I am returning 2D array from WebService? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to get <param-name> instead of <item> in response when I am returning 2D array from WebService?" Watch "How to get <param-name> instead of <item> in response when I am returning 2D array from WebService?" New topic
Author

How to get <param-name> instead of <item> in response when I am returning 2D array from WebService?

Wap Rau
Greenhorn

Joined: Dec 01, 2011
Posts: 11
I am very new to Web Services. I am creating Apache CXF (apache-cxf-2.5.0) SOAP based Web Services. It creates WSDL from Java class (Java first approach).

When Web Service is called I am returning 2D array as a response. This is my Java class:


This is the response to the request I get when Web Service is called:


The Response that I get from the webservice has a tag <item> under <return> tag. However, I want <parameter-name> instead of <item> like this:


How to do it? Thanks.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
You should really try to avoid that kind of multidimensional arrays. It makes your code much more difficult to understand and maintain.
Instead, implement a Java-bean class that represents one row of data from, in this case, the database.
Then, for each row in the database query result, create an instance and populate its data.
Finally, insert each instance of the Java-bean in an array and return that array.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Wap Rau
Greenhorn

Joined: Dec 01, 2011
Posts: 11
Ivan Krizsan wrote:Hi!
You should really try to avoid that kind of multidimensional arrays. It makes your code much more difficult to understand and maintain.
Instead, implement a Java-bean class that represents one row of data from, in this case, the database.
Then, for each row in the database query result, create an instance and populate its data.
Finally, insert each instance of the Java-bean in an array and return that array.
Best wishes!
Thanks Ivan Krizsan, for your reply. I will try your solution.
Wap Rau
Greenhorn

Joined: Dec 01, 2011
Posts: 11
Ivan Krizsan wrote:Hi!
You should really try to avoid that kind of multidimensional arrays. It makes your code much more difficult to understand and maintain.
Instead, implement a Java-bean class that represents one row of data from, in this case, the database.
Then, for each row in the database query result, create an instance and populate its data.
Finally, insert each instance of the Java-bean in an array and return that array.
Best wishes!


Thanks Ivan Krizsan, It worked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get <param-name> instead of <item> in response when I am returning 2D array from WebService?