Reputation: 1657
On the server-side I create an object called Fragment. Lets just say it is a data container for some Strings.
A simple WebMethod which takes a String and returns another is fairly straightforward and easy to implement. But if I try to send an object from server to client it gets complicated. I publish the WebService and use wsimport to create my client stub classes.
I want to return a set of Fragments to the client. wsimport creates a HashSet class that is the return-type of the method which calls the respective-server method.
I can't cast this HashSet to a standard java util HashSet how do I process such complex objects?
Edit: This is the signature of the method published by the webservice:
@WebMethod
public HashSet<Fragment> topicIntersect(File tm1, String loc1, File tm2,
String loc2)
This is what wsimport generated:
/**
*
* @param arg3
* @param arg2
* @param arg1
* @param arg0
* @return
* returns webservice.HashSet
*/
@WebMethod
@WebResult(partName = "return")
public HashSet topicIntersect(
@WebParam(name = "arg0", partName = "arg0")
String arg0,
@WebParam(name = "arg1", partName = "arg1")
String arg1,
@WebParam(name = "arg2", partName = "arg2")
String arg2,
@WebParam(name = "arg3", partName = "arg3")
String arg3);
webservice.HashSet is an also generated empty class with no methods...
Upvotes: 0
Views: 1275
Reputation: 9154
I'm not sure if JAX-WS supports HashSet directly. However, List will certainly work. In addition, if you use a code first approach, you don't need to generate client stubs. You should be able to use the same interface that your service implements.
Upvotes: 1