File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Return type of web service.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Return type of web service.." Watch "Return type of web service.." New topic

Return type of web service..

aseem agarwal

Joined: Oct 17, 2009
Posts: 9
Can i return an array of strings from a web service,,,,

example public String[] hello(){
String[] s=new String(3);

return s;
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
The best way to know is to implement an example web service and try it!
If you wonder whether you can return something as a result of a web service method or whether you can use some parameter type, then ask yourself how you would represent that data using XML.
An array of strings can be represented as an element with maxOccurs larger than 1. The result would also have to be wrapped, since the WS-I Basic Profile only allows the SOAP body to contain one single element.
Best wishes!
I agree. Here's the link:
subject: Return type of web service..
jQuery in Action, 3rd edition