title: How to pass objects in UriTemplates in WCF
body: <p>The below code was used to expose RESTful application using WCF. Here I pass the input through <code>UriTemplate</code> objects, which are used in the <code>AddDetailsRequest</code> class.</p>
  
  <pre><code>[ServiceContract]
  public interface IMyRestService
  {
      [OperationContract(Name = "AddEmployee")]
      [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Xml, UriTemplate = "AddEmpDetails/{objReq}")]
      AddDetailsResponse AddEmpDetails(AddDetailsRequest objReq);
  }
  </code></pre>
  
  <p>Class <code>AddDetailsRequest</code></p>
  
  <pre><code>[DataContract(Name = "AddDetailsRequest")]
  public class AddDetailsRequest
  {
      [DataMember(IsRequired = true, Name = "Name")]
      public string Name { get; set; }
      [DataMember(IsRequired = true, Name = "City")]
      public string City { get; set; }
  }
  </code></pre>
  
  <p>What the problem I was faced here means, I am not able to pass the objects through <code>UriTemplate</code>. I want to pass the object, which has 2 parameters (Name and City), in a <code>UriTemplate</code>. How can I achieve this? </p>