poniedziałek, sierpnia 30, 2010

.NET HTTPS WS client

An error occurred while making the HTTP request to https://host:443/ws/op. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.

Workaround:

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;

A wyjęcie tekstu z rozbudowanego SOAPFault-a wygląda tak:

try {
resp = cli.enterOrder(eo);
}
catch (Exception ex)
{
if (ex is FaultException)
{
this.richTextBox1.Text = (ex as FaultException).CreateMessageFault()
.GetDetail<string>();
}
else
this.richTextBox1.Text = ex.Message;
}

0 komentarze: