private void HTTPPost()
{
string sParam = "sParam1=value1&sParam2=value2";
string sUrl = "http://abc/web";
// 서버 접속
WebRequest webRequest = WebRequest.Create(sUrl);
webRequest.Method = "POST";
// 데이터 전송
byte[] bytearry = Encoding.UTF8.GetBytes(sParam);
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.ContentLength = bytearry.Length;
Stream stream = webRequest.GetRequestStream();
stream.Write(bytearry, 0, bytearry.Length);
stream.Close();
// 응답 데이터 받기
WebResponse webResponse = webRequest.GetResponse();
stream = webResponse.GetResponseStream();
StreamReader streamReader = new StreamReader(stream);
string sReturn = streamReader.ReadToEnd();
streamReader.Close();
stream.Close();
webResponse.Close();
/*
응답 데이터 구조
sReturn :
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://tempuri.org/literalTypes">
<NewDataSet>
value
</NewDataSet>
</string>
*/
// 응답받은 데이터는 xml 파싱을 하여 처리한다.
}