Hi,
I have a web service and I want to pass objects as a parameter to a
webmethod. I've created my own (foo.bar.DeliveryPlace) with getters and
setters and it works fine. But I also have a HashMap. I just don't know how
to fill a java.util.HashMap. Here is the code of my webservice :
@WebService
public class Delivery {
@WebMethod(operationName = "Deliver" )
@Oneway
public void deliverItems(@WebParam(name="fomPlace") DeliveryPlace from,
@WebParam(name="toPlace") DeliveryPlace to,
@WebParam(name="quantityOfItems") HashMap<Integer, String>
quantityItems) {
// business code
}
After deploying the web service and importing the artifacts, a
foo.bar.DeliveryPlace object is created, fine. But for the java.util.HashMap,
the wsimport creates two objects foo.bar.HashMap (instead of
java.util.HashMap) that inherits from foo.bar.AbstractMap
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "abstractMap")
public abstract class AbstractMap {
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "hashMap")
public class HashMap
extends AbstractMap {
}
How do I fill a foo.bar.HashMap ? There is no put method of course, but I
can't take a java.util.HashMap and convert it into a foo.bar.HashMap. How
does it work ?
Thanks,
Antonio