title: Consuming WCF REST Service with multiple parameters WITHOUT DataContract
body: <p>I need to call my WCF REST Service with multiple parameters with the POST method, but I can't create DataContract containing my parameters because I need simple types : my webservice will be consumed by an objective C application.</p>
  
  <p>I found this syntax on the MSDN site :</p>
  
  <pre><code>[OperationContract]
  [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "savejson?id={id}&amp;fichier={fichier}")]
  bool SaveJSONData(string id, string fichier);
  </code></pre>
  
  <p>To explain quickly the context, I have to call this method to save a JSON file with the Id passed on a database.</p>
  
  <p>My fisrt question is : is it really possible to pass several parameters to a POST method as shown before ?</p>
  
  <p>Secondly : how can I do to consume my service (in C# for the moment, just to test it) with several parameters ?</p>
  
  <p>I've already tested with DataContract, and I was doing like that :</p>
  
  <pre><code>string url = "http://localhost:62240/iECVService.svc/savejson";
          WebClient webClient = new WebClient();
          webClient.Headers["Content-type"] = "application/json; charset=utf-8";
          RequestData reqData = new RequestData { IdFichier = "15", Fichier = System.IO.File.ReadAllText(@"C:\Dev\iECV\iECVMvcApplication\Content\fichier.json") };
          MemoryStream requestMs = new MemoryStream();
          DataContractJsonSerializer requestSerializer = new DataContractJsonSerializer(typeof(RequestData));
          requestSerializer.WriteObject(requestMs, reqData);
          byte[] responseData = webClient.UploadData(url, "POST", requestMs.ToArray());
          MemoryStream responseMs = new MemoryStream(responseData);
          DataContractJsonSerializer responseSerializer = new DataContractJsonSerializer(typeof(ResponseData));
          ResponseData resData = responseSerializer.ReadObject(responseMs) as ResponseData;
  </code></pre>
  
  <p>RequestData and ResponseData were declared this way :</p>
  
  <pre><code>[DataContract(Namespace = "")]
  public class RequestData
  {
      [DataMember]
      public string IdFichier { get; set; }
  
      [DataMember]
      public string Fichier { get; set; }
  }
  
  [DataContract]
  public class ResponseData
  {
      [DataMember]
      public bool Succes { get; set; }
  }
  </code></pre>
  
  <p>But as I said, I can't do it like this anymore...</p>
  
  <p>I hope I'm enough clear, if not, don't hesitate to ask me details !</p>
  
  <p>Thanks a lot for your help.</p>