[jboss-user] [JBossWS] - Re: Soap service returning complex objects(Such as hashmaps)

alessio.soldano@jboss.com do-not-reply at jboss.com
Thu Nov 29 06:07:01 EST 2007


This is basically a JAXB bug https://jaxb.dev.java.net/issues/show_bug.cgi?id=268.

The workaround you can use it to wrap your map into another class. This class has to be annotated with @XmlAccessorType(XmlAccessType.FIELD) since the bug prevents you from adding @XmlElement to your map field.


  | @XmlAccessorType(XmlAccessType.FIELD)
  | public class MyMap {
  | 	
  | 	protected HashMap<String,String> realMap;
  | 	
  | 	public HashMap<String,String> getRealMap() {
  | 		if (realMap==null) {
  | 			realMap = new HashMap<String,String>();
  | 		}
  | 		return realMap;
  | 	}
  | }
  | 
  | ...
  | 
  | @WebMethod
  | public MyMap getHashMap( String key, String value)    {
  |         ...
  | }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108835#4108835

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108835



More information about the jboss-user mailing list