Saturday, February 19, 2011

How do I declare the return type of a SOAP method to be a map (in its WSDL)?

I am adding a method to a SOAP service. I would like this method to be able to return a map. More specifically it is map of lists (vectors/arrays). How would I capture this in its WSDL?

From stackoverflow
  • Here's and XSD type for a regular map from string to string:

    <xsd:complexType name="MapDataType">
      <xsd:sequence>
        <xsd:element name="Pair" maxOccurs="unbounded" minOccurs="0">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Key" type="xsd:string" maxOccurs="1" minOccurs="1"/>
              <xsd:element name="Value" type="xsd:string" maxOccurs="1" minOccurs="1"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
    

    Is this what you want? You'll need to use this as the type for your return value.

    I'm not sure what you mean by 'map of lists'

    Matthew Schinckel : I'd suggest that this is a fair method, considering there is no Map type in XML.

0 comments:

Post a Comment