A wrapper class with a hashmap type should be created and used in the webservice
package com.abc.dto;
import java.util.HashMap;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class HashMapWrapper {
private HashMap<String, String> realMap = new HashMap<String, String>();
public HashMapWrapper(){
}
public void setRealMap(HashMap<String, String> realMap) {
this.realMap = realMap;
}
public HashMap<String, String> getRealMap() {
return realMap;
}
}
creation of webservice
@WebMethod(operationName="returnHashMap")
@WebResult(name="hashMapWrapper")
public HashMapWrapper returnHashMap(@WebParam(name="abc") String abc) throws MywebServiceException {
}
generated wsdl
<xs:complexType name="returnHashMap">
<xs:sequence>
<xs:element minOccurs="0" name="hashMapWrapper" type="tns:hashMapWrapper"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="hashMapWrapper">
<xs:sequence>
<xs:element name="realMap">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="entry">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="key" type="xs:string"/>
<xs:element minOccurs="0" name="value" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>