On Tuesday 20 April 2010 12:22:18 am balson1980 wrote:
>  I was struggling to return a hashmap from a cxf based web service and I
> came across your tutorial. I tried the same way, but still could not suceed
> in that.I have presented my issue below. If found time, pls have a look at
> this and suggest me :)

You could also look at the java_first_jaxws sample in the CXF distribution.   
It returns a Map for something.



> I could deploy this service onto container and see its publishing but when
> I invoke the method through a client, an erros comes in the container
> saying, java.util.HashMap cannot be casted to java.util.List. I am
> struggling here for the past few days and could not come to a solution.
> For your reference I have also given my ResultMap class
> 
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "resultMap", propOrder = {
>     "entry"
> })
> public class ResultMap {
>       @XmlJavaTypeAdapter(ResultMapAdapter.class);

I think this annotation is in the wrong place.    I THINK this would need to 
go on the 
public HashMap<String,String> launchVMs(...)
method as it's the Adapter for that HashMap.

Dan


>     protected List<ResultMap.Entry> entries;
> 
> 
>     public ResultMap(){} // empty constructor
> 
>     public List<ResultMap.Entry> getEntry() {
>         if (entries == null) {
>             entries = new ArrayList<ResultMap.Entry>();
>         }
>         return this.entries;
>     }
> 
>     @XmlAccessorType(XmlAccessType.FIELD)
>     @XmlType(name = "", propOrder = {
>         "key",
>         "value"
>     })
>     public static class Entry {
> 
>         @XmlElement(required = true)
>         protected String key;
>         @XmlElement(required = true)
>         protected String value;
> 
>         /**
>          * Gets the value of the key property.
>          *
>          * @return
>          *     possible object is
>          *     {...@link String }
>          *
>          */
>         public String getKey() {
>             return key;
>         }
>              public void setKey(String value) {
>             this.key = value;
>         }
>         public String getValue() {
>             return value;
>         }
> 
>         public void setValue(String value) {
>             this.value = value;
>         }
> 
>     }
> 
> 
> }
> 
> 
> Can you figure out from these input where I am doing wrong ? Thanks a lot,
> 
> 
> With regards
> Balachandar

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog

Reply via email to