Again, sorry about the code display. If you select and copy/paste the code will be much more readable.
First, in your config file (or in code I guess, my example is a config file), replace whatever was automatically generated for your security setting in your binding when you added the service with the following.
<transport clientCredentialType="Basic" />
Next, you have to pass the username and password to the webservice. This I did in code, you can probably put the username and password in your config file somewhere as well. Here is a sample page_load method I did for a web page to do a test of the webservice.
Here are the namespaces that I referenced as well.
protected void Page_Load ( object sender, EventArgs e )
//ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback ( customXertificateValidation );
TheService.proxyname t = new TheService.proxyname ();
t.ClientCredentials.UserName.UserName = "someusername";
t.ClientCredentials.UserName.Password = "somepassword";
Response.Write(t.SomeMethod ( "123456789", 123 ));
catch ( System.Exception ex )
Response.Write ( ex.ToString () );
Lastly, if you don't have the root certificate setup, uncomment out the ServicePointManager line and add the following method. This will override any sort of certificate goofiness on your end.
private static bool customXertificateValidation ( object sender,
X509Certificate cert, X509Chain chain,
System.Net.Security.SslPolicyErrors error )
And walla! You should be able to connect. Hope this helps someone.