title: Send Android class to WCF webservice
body: <p>I am trying to use REST, to send to an exposed webservice. But what I get is 400 (Bad Request.)</p>
  
  <p>How do you property send a model across from REST, that will correctly map up to the model on the other side. What I don't want to do, is have all 100 parameters exposed individually in the connection point.</p>
  
  <pre><code>    [OperationContract]
      [WebInvoke(
          Method = "POST",
          UriTemplate = "SaveData",
          BodyStyle = WebMessageBodyStyle.WrappedRequest,
          ResponseFormat = WebMessageFormat.Json,
          RequestFormat = WebMessageFormat.Json)]
      void SaveData(datum data);
  </code></pre>
  
  <p>But what I am unable to do is pass a valid datum object.</p>
  
  <pre><code>     // Build JSON string
       JSONStringer vehicle;
      try {
          vehicle = new JSONStringer()
               .object()
                   .key("datum")
                       .object()
                           .key("ID").value(5)
                           .key("Name").value("test")
                           .key("No").value(54)
                           .key("Description").value("Test")
                       .endObject()
                   .endObject(); 
  
        HttpPost request = new HttpPost(address + "/SaveData");
       Log.d("WebInvoke", "Connection : " + address + "/SaveData");
       request.setHeader("Accept", "application/json");
       request.setHeader("Content-type", "application/json");
           StringEntity entity = new StringEntity(vehicle.toString());
           Log.d("StringEntity", vehicle.toString());
           request.setEntity(entity);
  
           // Send request to WCF service
           DefaultHttpClient httpClient = new DefaultHttpClient();
           HttpResponse response = httpClient.execute(request);
  
           Log.d("WebInvoke", "Saving : " +    response.getStatusLine().getStatusCode());
               // Saving : 400
  </code></pre>
  
  <p>Datum Class:</p>
  
  <pre><code>[DataContract]
  public partial class datum
  {
      [DataMember(Name = "ID")]
      public int ID { get; set; }
         [DataMember(Name = "Name")]
      public string Name { get; set; }
       [DataMember(Name = "No")]
      public Nullable&lt;int&gt; No { get; set; }
  
          [DataMember(Name = "Description")]
      public string Description { get; set; }
  }
  </code></pre>