permaculture playing cards*
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
JavaRanch » Java Forums » Java » Web Services
Bookmark "Return type of web service.." Watch "Return type of web service.." New topic
Author

Return type of web service..

aseem agarwal
Greenhorn

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

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

return s;
}
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
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!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Return type of web service..
 
Similar Threads
Better way to return XML document
Java class to WSDL
Invoke .Net web service from JSP
Consuming SOAP Web Service
Asynchronous server-side web service