title: Configure WCF service to accept unqualified parameter
body: <p>My WCF service does not recognize request parameter values that are sent in unqualified form and substitutes default values instead.</p>
  
  <p>For example, this request will yield a result of "You entered: 21".</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sam="http://www.example.org/SampleService/"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;sam:GetData&gt;
           &lt;sam:value&gt;21&lt;/sam:value&gt;
        &lt;/sam:GetData&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>But the response to this request is "You entered: 0".</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sam="http://www.example.org/SampleService/"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;sam:GetData&gt;
           &lt;value&gt;21&lt;/value&gt;
        &lt;/sam:GetData&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p><strong>How can I modify my service so that both types of requests will use the value I send in?</strong> </p>
  
  <p><em>IService1.cs</em>:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.Text;
  
  namespace WcfServiceLibrary2
  {
      // NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in App.config.
      [ServiceContract(Namespace = "http://www.example.org/SampleService/", Name = "sampleservice")]
      public interface IService1
      {
          [OperationContract]
          string GetData(int value);
  
          [OperationContract]
          CompositeType GetDataUsingDataContract(CompositeType composite);
  
          // TODO: Add your service operations here
      }
  
      // Use a data contract as illustrated in the sample below to add composite types to service operations
      [DataContract]
      public class CompositeType
      {
          bool boolValue = true;
          string stringValue = "Hello ";
  
          [DataMember]
          public bool BoolValue
          {
              get { return boolValue; }
              set { boolValue = value; }
          }
  
          [DataMember]
          public string StringValue
          {
              get { return stringValue; }
              set { stringValue = value; }
          }
      }
  }
  </code></pre>
  
  <p><em>Service1.cs</em>:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.Text;
  
  namespace WcfServiceLibrary2
  {
     public class Service1 : IService1
      {
          public string GetData(int value)
          {
              return string.Format("You entered: {0}", value);
          }
  
          public CompositeType GetDataUsingDataContract(CompositeType composite)
          {
              if (composite.BoolValue)
              {
                  composite.StringValue += "Suffix";
              }
              return composite;
          }
      }
  }
  </code></pre>