Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Return type of web service..

 
aseem agarwal
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic