[jboss-user] [JBoss Web Services] - Re: Soap service returning complex objects(Such as hashmaps) inc

siva gunda do-not-reply at jboss.com
Thu Feb 3 13:11:46 EST 2011


siva gunda [http://community.jboss.org/people/gundasiva] created the discussion

"Re: Soap service returning complex objects(Such as hashmaps) inc"

To view the discussion, visit: http://community.jboss.org/message/585299#585299

--------------------------------------------------------------
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>
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/585299#585299]

Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110203/7a403dca/attachment-0001.html 


More information about the jboss-user mailing list