Asp.net C# application invoice post in tally in XML format - Web base application connect to tally ERP using static IP
public string xmlPosting(string xml)
{
WebRequest request = WebRequest.Create("http://00.000.00.000:9000");//Static IP
request.Method = "POST";
request.Timeout = 99000;
byte[] byteArray = Encoding.UTF8.GetBytes(xml);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
Response.Write(((HttpWebResponse)response).StatusDescription);
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
//Response.Write(responseFromServer);
// Clean up the streams.
reader.Close();
dataStream.Close();
response.Close();
StringBuilder output = new StringBuilder();
return XmlError(responseFromServer);
}
public string xmlPosting(string xml)
{
WebRequest request = WebRequest.Create("http://00.000.00.000:9000");//Static IP
request.Method = "POST";
request.Timeout = 99000;
byte[] byteArray = Encoding.UTF8.GetBytes(xml);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
Response.Write(((HttpWebResponse)response).StatusDescription);
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
//Response.Write(responseFromServer);
// Clean up the streams.
reader.Close();
dataStream.Close();
response.Close();
StringBuilder output = new StringBuilder();
return XmlError(responseFromServer);
}
0 comments :
Post a Comment