title: How to pass php array like structure to soap client?
body: <p>I'm trying to use magento shopping platform API from .NET and it is not so sweet, as I imagined.
  Thing is main method has args parameter which in .net generated client is an object and in soap envelope producted by php sample looks like this:</p>
  
  <pre><code> &lt;args SOAP-ENC:arrayType="xsd:ur-type[4]" xsi:type="SOAP-ENC:Array"&gt;
      &lt;item xsi:type="xsd:string"&gt;simple&lt;/item&gt;
      &lt;item xsi:type="xsd:int"&gt;4&lt;/item&gt;
      &lt;item xsi:type="xsd:string"&gt;sku_of_product&lt;/item&gt;
      &lt;item xsi:type="ns2:Map"&gt;
        &lt;item&gt;
          &lt;key xsi:type="xsd:string"&gt;name&lt;/key&gt;
          &lt;value xsi:type="xsd:string"&gt;name of product&lt;/value&gt;
        &lt;/item&gt;
        &lt;item&gt;
          &lt;key xsi:type="xsd:string"&gt;short_description&lt;/key&gt;
          &lt;value xsi:type="xsd:string"&gt;short description&lt;/value&gt;
        &lt;/item&gt;
        &lt;item&gt;
          &lt;key xsi:type="xsd:string"&gt;description&lt;/key&gt;
          &lt;value xsi:type="xsd:string"&gt;description&lt;/value&gt;
        &lt;/item&gt;
        &lt;item&gt;
          &lt;key xsi:type="xsd:string"&gt;status&lt;/key&gt;
          &lt;value xsi:type="xsd:int"&gt;1&lt;/value&gt;
        &lt;/item&gt;
        &lt;item&gt;
          &lt;key xsi:type="xsd:string"&gt;weight&lt;/key&gt;
          &lt;value xsi:type="xsd:int"&gt;0&lt;/value&gt;
        &lt;/item&gt;
        &lt;item&gt;
          &lt;key xsi:type="xsd:string"&gt;tax_class_id&lt;/key&gt;
          &lt;value xsi:type="xsd:int"&gt;1&lt;/value&gt;
        &lt;/item&gt;
        &lt;item&gt;
          &lt;key xsi:type="xsd:string"&gt;categories&lt;/key&gt;
          &lt;value SOAP-ENC:arrayType="xsd:int[1]" xsi:type="SOAP-ENC:Array"&gt;
            &lt;item xsi:type="xsd:int"&gt;3&lt;/item&gt;
          &lt;/value&gt;
        &lt;/item&gt;
        &lt;item&gt;
          &lt;key xsi:type="xsd:string"&gt;price&lt;/key&gt;
          &lt;value xsi:type="xsd:float"&gt;12.05&lt;/value&gt;
        &lt;/item&gt;
      &lt;/item&gt;
    &lt;/args&gt;
  </code></pre>
  
  <p>Problem is, that root element is array, which has some string type elements, then some key value pairs, some of those key value pairs values are arrays.
  How to describe object in c# to produce such hierarchy?</p>
  
  <p><strong>Update:</strong> Service reference does not describe any sructures, just interface.</p>
  
  <pre><code>[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  [System.ServiceModel.ServiceContractAttribute(Namespace="urn:Magento", ConfigurationName="EpcServiceReference.Mage_Api_Model_Server_HandlerPortType")]
  public interface Mage_Api_Model_Server_HandlerPortType {
  
      [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
      [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
      [return: System.ServiceModel.MessageParameterAttribute(Name="callReturn")]
      object call(string sessionId, string resourcePath, object args);
  
      [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
      [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
      [return: System.ServiceModel.MessageParameterAttribute(Name="multiCallReturn")]
      object[] multiCall(string sessionId, object[] calls, object options);
  
      [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
      [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
      [return: System.ServiceModel.MessageParameterAttribute(Name="endSessionReturn")]
      bool endSession(string sessionId);
  
      [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
      [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
      [return: System.ServiceModel.MessageParameterAttribute(Name="loginReturn")]
      string login(string username, string apiKey);
  
      [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
      [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
      [return: System.ServiceModel.MessageParameterAttribute(Name="startSessionReturn")]
      string startSession();
  
      [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
      [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
      [return: System.ServiceModel.MessageParameterAttribute(Name="resourcesReturn")]
      object[] resources(string sessionId);
  
      [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
      [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
      [return: System.ServiceModel.MessageParameterAttribute(Name="globalFaultsReturn")]
      object[] globalFaults(string sessionId);
  
      [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
      [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
      [return: System.ServiceModel.MessageParameterAttribute(Name="resourceFaultsReturn")]
      object[] resourceFaults(string resourceName, string sessionId);
  }
  
  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  public interface Mage_Api_Model_Server_HandlerPortTypeChannel : MagentoTest.EpcServiceReference.Mage_Api_Model_Server_HandlerPortType, System.ServiceModel.IClientChannel {
  }
  
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
  public partial class Mage_Api_Model_Server_HandlerPortTypeClient : System.ServiceModel.ClientBase&lt;MagentoTest.EpcServiceReference.Mage_Api_Model_Server_HandlerPortType&gt;, MagentoTest.EpcServiceReference.Mage_Api_Model_Server_HandlerPortType {
  
      public Mage_Api_Model_Server_HandlerPortTypeClient() {
      }
  
      public Mage_Api_Model_Server_HandlerPortTypeClient(string endpointConfigurationName) : 
              base(endpointConfigurationName) {
      }
  
      public Mage_Api_Model_Server_HandlerPortTypeClient(string endpointConfigurationName, string remoteAddress) : 
              base(endpointConfigurationName, remoteAddress) {
      }
  
      public Mage_Api_Model_Server_HandlerPortTypeClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
              base(endpointConfigurationName, remoteAddress) {
      }
  
      public Mage_Api_Model_Server_HandlerPortTypeClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
              base(binding, remoteAddress) {
      }
  
      public object call(string sessionId, string resourcePath, object args) {
          return base.Channel.call(sessionId, resourcePath, args);
      }
  
      public object[] multiCall(string sessionId, object[] calls, object options) {
          return base.Channel.multiCall(sessionId, calls, options);
      }
  
      public bool endSession(string sessionId) {
          return base.Channel.endSession(sessionId);
      }
  
      public string login(string username, string apiKey) {
          return base.Channel.login(username, apiKey);
      }
  
      public string startSession() {
          return base.Channel.startSession();
      }
  
      public object[] resources(string sessionId) {
          return base.Channel.resources(sessionId);
      }
  
      public object[] globalFaults(string sessionId) {
          return base.Channel.globalFaults(sessionId);
      }
  
      public object[] resourceFaults(string resourceName, string sessionId) {
          return base.Channel.resourceFaults(resourceName, sessionId);
      }
  }
  </code></pre>
  
  <p>and I'm trying to call this method:</p>
  
  <pre><code>    object call(string sessionId, string resourcePath, object args);
  </code></pre>
  
  <p>also I found similar question <a href="https://stackoverflow.com/questions/4902244/consume-a-php-soap-service-with-c-sharp-client-using-map-type">here</a>, sadly it does not have an answer also. </p>