We Know Web services are a category of software components that provide functionality over a network.Comparing to other protocols HTTP (Hyper text transfer protocol) is the powerful protocol in network.
We can very easily access a web service using HTTP-POST Method.
c# Code:
string WSurl = ConfigurationSettings.AppSettings["URL"].ToString();
string Request_Xml = Create yours soap request xml here.
Xmldocument xmldoc = new Xmldocument ();
xmldoc.LoadXml(Request_Xml);
HttpWebRequest wsreq = (HttpWebRequest) WebRequest.Create(WSurl);
byte[] reqbytes = UTF8Encoding.UTF8.GetBytes(xmldoc.Innerxml);
wsreq.contentLength = reqbytes.length;
wsreq.ContentType = “text/xml”;
wsreq.Method =”POST”;
Stream str = wsreq.GetRequestStream();
str.write(reqbytes,0,reqbytes.Length);
str.Close();
WebResponse resp = wsreq.GetResponse();
stream respstream = resp.GetResponseStream();
Streamreader sr = new Streamreader(respstream );
string responsexml = sr.ReadToEnd();
Hope this Helps,
Happy Coding