title: Consuming a web service using POST instead of the going the usual WSDL route
body: <p>This is how I have currently managed to consume a particular Microsoft web service. Notice that it is located on an HTTPS server and that it requires a username, a password, and a <code>.cer</code> file to be installed in the operating system's "root certificate authorities".</p>
  
  <pre><code>WSHttpBinding binding = new WSHttpBinding();
  
  binding.Security.Mode = SecurityMode.TransportWithMessageCredential;
  binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
  binding.Security.Message.NegotiateServiceCredential = true;
  binding.Security.Message.AlgorithmSuite
    = System.ServiceModel.Security.SecurityAlgorithmSuite.Default;
  binding.Security.Message.EstablishSecurityContext = true;
  
  EndpointAddress endpoint = new EndpointAddress("https://address.of.service");
  
  //"GreatClient" was created for me automatically by running
  //"svcutil.exe https://address.of.service?wsdl"
  GreatClient client = new GreatClient(binding, endpoint);
  
  //Username and password for the authentication. Notice that I have also installed
  //the required .cer certificate into the system's "root certificate authorities".
  client.ClientCredentials.UserName.UserName = "username";
  client.ClientCredentials.UserName.Password = "password";
  
  //Now I can start using the client as I wish.
  </code></pre>
  
  <p><strong>My question is this:</strong> How can I obtain all the information necessary so that I can consume the web service with a direct POST to <a href="https://address.of.service" rel="nofollow">https://address.of.service</a>, and how do I actually perform the POST with C#? I only want to use POST, where I can supply raw XML data using POST directly to <a href="https://address.of.service" rel="nofollow">https://address.of.service</a> and get back the result as raw XML data. The question is, what is that raw XML data and how exactly should I send it using POST?</p>
  
  <p>(<strong>The purpose of this question:</strong> The reason I ask is that I wish to consume this service using something other than C# and .NET (such as Ruby, or Cocoa on Mac OS X). I have no way of knowing how on earth to do that, since I don't have any easy-to-use "svcutil.exe" on other platforms to generate the required code for me. This is why I figured that just being able to consume the service using regular POST would allow me to more easily to consume the service on other platforms.)</p>