title: Understanding sequences and returning arrays in WSDL
body: <p>So my web service is supposed to take one column of data (IDs) and return 2-column table of corresponding data to requested ID's. I understood that I should use a sequence for that purpose so I've made this schema:</p>
  
  <pre><code>&lt;wsdl:types&gt;
  &lt;xsd:schema targetNamespace="urn:myurn" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;xsd:element name="GetWSIDListByDPIDList"&gt;
      &lt;xsd:complexType&gt;
          &lt;xsd:sequence maxOccurs="unbounded" minOccurs="1"&gt;
              &lt;xsd:element name="DPID" type="xsd:string"/&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  &lt;xsd:element name="GetWSIDListByDPIDListResponse"&gt;
      &lt;xsd:complexType&gt;
          &lt;xsd:sequence maxOccurs="unbounded" minOccurs="0"&gt;
              &lt;xsd:element name="DP" type="xsd:string"/&gt;
              &lt;xsd:element name="WSID" type="xsd:string"/&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;&lt;/xsd:schema&gt;
  </code></pre>
  
  <p></p>
  
  <p>Request is a sequence of strings and response is a sequence of pair of strings. Seems right.</p>
  
  <p>But when I started to code an implementation (by the way it's top down approach) I realized that I need some kind of third element - row element, containing 2 elements of strings (DP and WSID) which is child of GetWSIDListByDPIDListRespose. </p>
  
  <p>I'm writing implementation using Axiom so It looks something like that:</p>
  
  <pre><code>        OMFactory fac = OMAbstractFactory.getOMFactory();
          OMNamespace omNs = fac.createOMNamespace("urn:myurn", "urn");
          OMElement response = fac.createOMElement("GetWSIDListByDPIDListResponse",omNs);
          OMElement WSIDListItem = fac.createOMElement("WSIDListItem",omNs);
          OMElement WSID = fac.createOMElement("WSID",omNs);
          WSID.addChild(fac.createOMText("0123123"));
          OMElement DP = fac.createOMElement("DP",omNs);
          DP.addChild(fac.createOMText("0321321"));
          WSIDListItem.addChild(DP);
          WSIDListItem.addChild(WSID);
          response.addChild(WSIDListItem);
          return response;
  </code></pre>
  
  <p>And in the end I get response like that:</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;urn:GetWSIDListByDPIDListResponse xmlns:urn="urn:fnc.service.livelink.opentext.com"&gt;
           &lt;urn:WSIDListItem&gt;
              &lt;urn:DP&gt;0321321&lt;/urn:DP&gt;
              &lt;urn:WSID&gt;0123123&lt;/urn:WSID&gt;
           &lt;/urn:WSIDListItem&gt;
        &lt;/urn:GetWSIDListByDPIDListResponse&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>So adding more WSIDListItems to response I get some something like a table. BUT is does not look like what is described in WSDL. I don't even understand how would response would like using my wsdl description.</p>
  
  <p>So the question is what is the correct way to return 2 column data? Is my approach any correct? What should I fix, implementation or WSDL to match my implementation?</p>
  
  <p>Thanks in advance.</p>