title: How to define NET 4 REST WCF service to accept url-encoded string parameters
body: <p>I have a WCF REST service in NET4 defined as below:</p>
  
  <pre><code>[WebInvoke(UriTemplate = "/", Method = "POST")]
  public Stream ProcessPost(string p1, string p2, string p3, string p4)
  {
      return Execute(p1, p2, p3, p4);
  }
  </code></pre>
  
  <p>I need to call it from clients with POST, that post data as form-urlencoded  </p>
  
  <pre><code>    HttpWebRequest req = WebRequest.Create(url) as HttpWebRequest;
      req.Method = "POST";
      req.ContentType = "application/x-www-form-urlencoded";
  
      string paramz = string.Format("p1={0}&amp;p2={1}&amp;p3={2}&amp;p4={3}", 
          HttpUtility.UrlEncode("str1"),
          HttpUtility.UrlEncode("str2"),
          HttpUtility.UrlEncode("str3"),
          HttpUtility.UrlEncode("str4")
          );
  
      // Encode the parameters as form data:
      byte[] formData =
          UTF8Encoding.UTF8.GetBytes(paramz);
      req.ContentLength = postData.Length;
  
      // Send the request:
      using (Stream post = req.GetRequestStream())
      {
          post.Write(formData, 0, formData.Length);
      }
  </code></pre>
  
  <p>How should I define UriTemplate, or what other attributes should I add to allow the service to accept the parameters as posted by the client code shown above?</p>
  
  <p>Thanks   </p>