I am probably missing something obvious, and I would appreciate it if someone can point me to the right direction.
I have followed the simple Netbeans/JAX-WS calculator tutorial from http://www.netbeans.org/kb/60/websvc/jax-ws.html and it works fine, but now I'd like to return a complex data type, like a HashMap instead of an integer, so I tried this:
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import java.lang.reflect.*;
import java.util.HashMap;
@WebService()
public class g4WS {
@WebMethod(operationName = "add")
public int add(@WebParam(name = "i") int i, @WebParam(name = "j") int j) {
return i+j;
}
@WebMethod(operationName = "getHashMap")
public HashMap<String,String> getHashMap() {
HashMap<String,String> foobar = new HashMap<String,String>();
foobar.put("e1", "foo");
foobar.put("e2", "bar");
return foobar;
}
}
The "add" method works fine, but the "getHashMap does not. I've deployed the project with Netbeans 6.0 in Tomcat 6.0 as well as GlassFish V2, with the same result.
When I call the method either with the GlassFish Web Service Tester or with soapUI, I get an empty result set. I guess that the fact that there are no complexType definitions for the HashMap in the generated WSDL has something to do with it as well.
Please excuse my ignorance, I'm pretty new to Web Services, and after almost a day of googling I'm stuck here. I can't {code}{code}find what I'm doing wrong, or that I'm trying something impossible.