What are the valid Java @WebMethod return types?
I am writing a WebService using Java. Now I have a @WebMethod that is supposed to return some data, and I am not sure what format to use. I have seen that in other languages, there are certain restrictions on @WebMethod return types - is this the same for Java?
When I tried to return a DOM Document containing XML, I got an error saying "Unable to create JAXBContext", so I changed it to just returning a String array. However, getting cont开发者_Go百科ent from that array is rather tedious. Does anyone have a better solution?
Thanks,
VeganSmarties
When I was implementing JAX-WS web services, all my return types were annotated with JAXB annotations (@XmlElement, ...), and they also were Serializable. EDIT: which means just any type will not work, and you will have to create wrappers around structures you want to return.
精彩评论