title: Sending SOAP message with C# Help Needed
body: <p>I would like to send a SOAP Message to a Web Service and read the response. My code is as follows: I will appreciate your help.    </p>
  
  <p>I hope my question is not repeated, I have looked around for a solution however I have not been successful.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Web.Services;
  using System.Xml;
  using System.Net;
  using System.IO;
  
  namespace TolunaPush
  {
      public partial class _Default : System.Web.UI.Page
      {
          private string sourceID = "50001255";
          private string email = "adsvine@gmail.com";
          private string firstName = "Muz";
          private string lastName = "Khan";
          private string countryID = "2000077";
          private string countryLanguage = "2000240";
          private string postalCode = "N19 3NU";
          private string dob = "1977-03-08";
          private string gender = "2000247";
  
          protected void Page_Load(object sender, EventArgs e)
          {
              sendSoapMessage();
          }
  
          protected void sendSoapMessage()
          {
              XmlDocument doc = new XmlDocument();
              doc.InnerXml = @"&lt;soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""&gt;
                    &lt;soap:Body&gt;
                      &lt;SubmitPanelist xmlns=""http://www.greenfield.com/RegistrationGateway/Messages""&gt;
                        &lt;Registration xmlns=""http://www.greenfield.com/RegistrationGateway/Types""&gt;
                          &lt;Source&gt;
                            &lt;SourceID&gt;" + sourceID + @"&lt;/SourceID&gt;
                          &lt;/Source&gt;
                          &lt;Email&gt;" + email + @"&lt;/Email&gt;
                          &lt;FirstName&gt;" + firstName + @"&lt;/FirstName&gt;
                          &lt;LastName&gt;" + lastName + @"&lt;/LastName&gt;
                          &lt;CountryUK&gt;
                            &lt;CountryID&gt;" + countryID + @"&lt;/CountryID&gt;
                            &lt;Language&gt;" + countryLanguage + @"&lt;/Language&gt;
                            &lt;Address&gt;
                              &lt;Postalcode&gt;" + postalCode + @"&lt;/Postalcode&gt;
                            &lt;/Address&gt;
                          &lt;/CountryUK&gt;
                          &lt;DOB&gt;" + dob + @"&lt;/DOB&gt;
                          &lt;Gender&gt;" + gender + @"&lt;/Gender&gt;
                        &lt;/Registration&gt;
                      &lt;/SubmitPanelist&gt;
                    &lt;/soap:Body&gt;
                  &lt;/soap:Envelope&gt;";
  
              HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://coreg.surveycenter.com/RegistrationGateway/PanelistService.asmx");
              //if (proxy != null) req.Proxy = new WebProxy(proxy, true);
              // req.Headers.Add("GetClientInfo", "http://tempuri.org/GetClientInfo");
  
              req.ContentType = "text/xml;charset=\"utf-8\"";
              req.Accept = "text/xml";
              req.Method = "POST";
  
              Stream stm = req.GetRequestStream();
              doc.Save(stm);
              stm.Close();
              WebResponse resp = req.GetResponse();
  
              stm = resp.GetResponseStream();
              StreamReader r = new StreamReader(stm);
              Response.Write(r.ReadToEnd());
              //Response.Write(stm.ToString());
              //Response.Write(r.ToString());
              Response.End();
          }
      }
  }
  </code></pre>
  
  <p>Update
  As suggested by Darin. I did as instructed however the following line of code </p>
  
  <pre><code>using (var client = new RegistrationBindingsClient("RegistrationBindings"))
  </code></pre>
  
  <p>gives the error</p>
  
  <pre><code>The type or namespace name 'RegistrationBindingsClient' could not be found (are you missing a using directive or an assembly reference?)
  </code></pre>
  
  <p>Any help will be greatly appreciated</p>