P
patrick bes
Hi,
I have a situation where i have to post an XML document to a thirdparty
application. We have used to following code for a couple of months now and
everything worked just fine. The URL I used was just http and no SSL was
used, but the thirdparty application now implemented SSL and now uses HTTPS.
When I change the URL to HTTPS i get the following exception on
request.GetResponse():
The underlying connection was closed: An unexpected error occurred on a send.
The handshake failed due to an unexpected packet format.
The code:
UriBuilder u = new UriBuilder(AUrl);
u.Port = APort;
WebRequest request = WebRequest.Create(u.Uri);
request.Method = WebRequestMethods.Http.Post;
request.ContentType = "text/xml";
Stream requestStream = request.GetRequestStream();
StreamWriter send = new StreamWriter(requestStream,
System.Text.Encoding.UTF8);
try
{
send.Write(ARequest);
}
finally
{
send.Close();
requestStream.Close();
}
response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
reader = new StreamReader(responseStream);
return reader.ReadToEnd();
Can anyone shed some light on this error?
Thank you in advance.
I have a situation where i have to post an XML document to a thirdparty
application. We have used to following code for a couple of months now and
everything worked just fine. The URL I used was just http and no SSL was
used, but the thirdparty application now implemented SSL and now uses HTTPS.
When I change the URL to HTTPS i get the following exception on
request.GetResponse():
The underlying connection was closed: An unexpected error occurred on a send.
The handshake failed due to an unexpected packet format.
The code:
UriBuilder u = new UriBuilder(AUrl);
u.Port = APort;
WebRequest request = WebRequest.Create(u.Uri);
request.Method = WebRequestMethods.Http.Post;
request.ContentType = "text/xml";
Stream requestStream = request.GetRequestStream();
StreamWriter send = new StreamWriter(requestStream,
System.Text.Encoding.UTF8);
try
{
send.Write(ARequest);
}
finally
{
send.Close();
requestStream.Close();
}
response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
reader = new StreamReader(responseStream);
return reader.ReadToEnd();
Can anyone shed some light on this error?
Thank you in advance.