title: Passing 2D jagged array to webservice
body: <p>I have webservice wrote in C# whichc allows me to communicate between two systems. I'd like to one of methods accept <code>ClassName[][]</code> as one (and only) parameter.
  This method is defined as follows:</p>
  
  <pre><code>namespace WebService
  {
      public enum DocumentType { documentType1, documentType2, documentType3 };
  
      public class MyClass
      {
          private int? id;
          private DocumentType documentType;
  
          public int? Id
          {
              get { return id; }
              set { id = value; }
          }
  
          public DocumentType DocumentType
          {
              get { return documentType; }
              set { documentType = value; }
          }
  
          public MyClass()
          {
              this.id = null;
          }
          public MyClass(int id, DocumentType documentType)
          {
              this.Id = id;
              this.DocumentType = documentType;
          }
      }
  
      [ServiceContract]
      public interface IPisma
      {
          [OperationContract]
          Tuple&lt;MyClass, bool&gt;[][] WebserviceMethod(MyClass[][] myClassArray);
      }
  }
  </code></pre>
  
  <p>Call is made with this code wrote in Delphi:</p>
  
  <pre><code>procedure Call();
  var
    webServiceParameter: ArrayOfArrayOfMyClass;
  begin
    //init parameter and fill with test data
    SetLength(webServiceParameter, 2, 2);
    webServiceParameter[0][0] := MyClass.Create();
    webServiceParameter[0][0].Id := 1621806;
    webServiceParameter[0][0].DocumentType := DocumentType.documentType1;
    webServiceParameter[0][1] := MyClass.Create();
    webServiceParameter[0][1].Id := 564194;
    webServiceParameter[0][1].DocumentType := DocumentType.documentType2;
    webServiceParameter[1][0] := MyClass.Create();
    webServiceParameter[1][0].Id := 1623444;
    webServiceParameter[1][0].DocumentType := DocumentType.documentType1;
    webServiceParameter[1][1] := MyClass.Create();
    webServiceParameter[1][1].Id := 1624682;
    webServiceParameter[1][1].DocumentType := DocumentType.documentType1;
  
    //create webservice object and call method
    GetIPisma(False, '', HTTPRIO).WebserviceMethod(webServiceParameter);
  end;
  </code></pre>
  
  <p>Tried to check what is actually sent to webservice and in <code>HTTPRIO.BeforeExecution</code> event and SOAPRequest has following data in it:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;SOAP-ENV:Body xmlns:NS1="http://schemas.datacontract.org/2004/07/WebService"&gt;
          &lt;WebserviceMethod xmlns="http://tempuri.org/"&gt;
              &lt;myClassArray&gt;
                  &lt;ArrayOfMyClass&gt;
                      &lt;MyClass xsi:type="NS1:MyClass"&gt;
                          &lt;Id xmlns="http://schemas.datacontract.org/2004/07/WebService"&gt;1621806&lt;/Id&gt;
                          &lt;DocumentType xmlns="http://schemas.datacontract.org/2004/07/WebService"&gt;documentType1&lt;/DocumentType&gt;
                      &lt;/MyClass&gt;
                      &lt;MyClass xsi:type="NS1:MyClass"&gt;
                          &lt;Id xmlns="http://schemas.datacontract.org/2004/07/WebService"&gt;564194&lt;/Id&gt;
                          &lt;DocumentType xmlns="http://schemas.datacontract.org/2004/07/WebService"&gt;documentType2&lt;/DocumentType&gt;
                      &lt;/MyClass&gt;
                  &lt;/ArrayOfMyClass&gt;
                  &lt;ArrayOfMyClass&gt;
                      &lt;MyClass xsi:type="NS1:MyClass"&gt;
                          &lt;Id xmlns="http://schemas.datacontract.org/2004/07/WebService"&gt;1623444&lt;/Id&gt;
                          &lt;DocumentType xmlns="http://schemas.datacontract.org/2004/07/WebService"&gt;documentType1&lt;/DocumentType&gt;
                      &lt;/MyClass&gt;
                      &lt;MyClass xsi:type="NS1:MyClass"&gt;
                          &lt;Id xmlns="http://schemas.datacontract.org/2004/07/WebService"&gt;1624682&lt;/Id&gt;
                          &lt;DocumentType xmlns="http://schemas.datacontract.org/2004/07/WebService"&gt;documentType1&lt;/DocumentType&gt;
                      &lt;/MyClass&gt;
                  &lt;/ArrayOfMyClass&gt;
              &lt;/myClassArray&gt;
          &lt;/WebserviceMethod&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>Within implementation of <code>WebserviceMethod</code> parameters <code>myClassArray</code> length is 0. Tried few things like wrapping one of dimensions into another class but with no success. Intersting fact is that when I try to pass 1D array of MyClass (MyClass[] myClassArray) everything works fine and xml looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;WebserviceMethod xmlns="http://tempuri.org/"&gt;
              &lt;myClassArray&gt;
                  &lt;MyClass xmlns="http://schemas.datacontract.org/2004/07/WebService" xsi:type="MyClass"&gt;
                      &lt;Id&gt;1621806&lt;/Id&gt;
                      &lt;DocumentType&gt;documentType1&lt;/DocumentType&gt;
                  &lt;/MyClass&gt;
                  &lt;MyClass xmlns="http://schemas.datacontract.org/2004/07/WebService" xsi:type="MyClass"&gt;
                      &lt;Id&gt;162186&lt;/Id&gt;
                      &lt;DocumentType&gt;documentType1&lt;/DocumentType&gt;
                  &lt;/MyClass&gt;
              &lt;/myClassArray&gt;
          &lt;/WebserviceMethod&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>Result of <code>WebserviceMethod</code> is acquired without problems.</p>
  
  <p>Is it even possible to pass multidimensional jagged array to webservice?</p>