title: Android post request (JSON parameter) to the WCF restful WS
body: <p>I am working on Android application and I have problem with my "POST" request (as usual) to my WCF Restful WS.</p>
  
  <p>Restful method:</p>
  
  <pre><code> [OperationContract]
   [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, UriTemplate = "createUser")]
   string createUser(string user);
  </code></pre>
  
  <p>I order to find a error I put under the comment body of method implementation, and now it looks like:</p>
  
  <pre><code>public string createUser(string user)
          {
          return user;
          }
  </code></pre>
  
  <p>I have been calling this method a hundreds time from JS(jQuery, Ajax), with the JSON.stringify(datos), without the any problem.
  Now I need to do same thing from android application.
  This is probably snippet of my code which cause the problem:</p>
  
  <pre><code>JSONObject user =  new JSONObject();
  user.put("id", "15");
  user.put("name", "John");
  user.put("city", "France");
  user.put("email", "myemail");
  user.put("password", "mypass");
  
  HttpClient client = new DefaultHttpClient();
  URI website = new URI("http://10.0.2.2/AutoOglasi/Service1.svc/createUser");
  HttpPost request = new HttpPost();
  request.setEntity(new StringEntity(user.toString()));
  request.addHeader("content-type", "application/json");      
  request.setURI(website);
  HttpResponse response = client.execute(request);
  </code></pre>
  
  <p>I am getting the response from server (there is no error on my client side):</p>
  
  <pre><code>The exception message is 'There was an error deserializing the object of type
  System.String. End element 'root' from namespace '' expected. Found element 'id' from
  namespace ''.'.See server logs for more details. The exception stack trace is: &lt;/p&gt; &lt;p&gt;at
  System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message,
   Object[] parameters) at
  System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Me    ssage message, Object[] parameters) at
     System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message      message, Object[] parameters) at
  System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc&amp;amp;      rpc) at
   System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp;amp; rpc) at
   System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp;amp; rpc) at
  System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp;amp; rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)&lt;/p&gt; &lt;/div&gt; &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Any advice or help, please?</p>