When developing CXF based web services, did you ever get « org.apache.cxf.interceptor.Fault: Marshalling Error: java.util.Map is not known to this context » error message? This is caused by JAXB, the default databinding used by CXF, unable to marshal/unmarshal Java Maps. The common solution is to provide CXF a customized XmlAdatper. See the Example codes below:
Step#1: Annotate the Map type in the web service interface.
Step#2: Implement the customized XmlAdapter. Basically the adapter (i.e. the ClientOrderMapAdapter ) is flattening the map into a list of newly defined elements (i.e. ClientOrderElement ) which hold both the key (i.e. the string ) and the value (i.e. the List<Order>) of the original map as their fields.