users@glassfish.java.net

Re: [WebService] How to fill a HashMap ?

From: Antonio Goncalves <antonio.mailing_at_gmail.com>
Date: Wed, 25 Oct 2006 10:47:44 +0200

Thanks. I didn't think of looking at the JaxWs forum at sun.

http://forums.java.net/jive/thread.jspa?threadID=19248&tstart=0

Antonio


2006/10/23, Vijay Ramachandran <Vijay.Ramachandran_at_sun.com>:
>
> Posting this to JAXWS forum
>
> Vijay
>
> Antonio Goncalves wrote:
> > 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
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>