Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void geraXML()
- {
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.PreserveWhitespace = true;
- string xml = @"<?xml version=""1.0""?>...";
- xmlDoc.LoadXml(xml);
- string caminho = path/+"xmldoc.xml";
- string nomeArquivo = "xmldoc.xml";
- xmlDoc.Save(caminho);
- //call method to generate hash
- geraHASH(caminho, nomeArquivo);
- }
- private void enviaACCS001(string protocolo, string caminho)
- {
- string base64 = Convert.ToBase64String(Encoding.Default.GetBytes("user:password"));
- string authorization = String.Concat("Basic ", base64);
- String finalResult;
- HttpWebRequest hwrRequest = (HttpWebRequest)HttpWebRequest.Create("addres/" + protocolo);
- hwrRequest.UseDefaultCredentials = true;
- hwrRequest.Headers.Add("Authorization", authorization);
- hwrRequest.Method = "PUT";
- string finalXML = @"<?xml version=""1.0""?>...";
- byte[] bytes = Encoding.Default.GetBytes(finalXML);
- hwrRequest.ContentLength = bytes.Length;
- using (Stream putStream = hwrRequest.GetRequestStream())
- {
- putStream.Write(bytes, 0, bytes.Length);
- }
- using (HttpWebResponse response = (HttpWebResponse)hwrRequest.GetResponse())
- using (StreamReader reader = new StreamReader(response.GetResponseStream()))
- {
- finalResult = reader.ReadToEnd();
- visualiza.Text = visualiza.Text + "n " + finalResult;
- }
- private void geraXML()
- {
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.PreserveWhitespace = true;
- string xml = @"<?xml version=""1.0"" encoding=""UTF-16BE""?>...";
- xmlDoc.LoadXml(xml);
- string caminho = path/+"xmldoc.xml";
- string nomeArquivo = "xmldoc.xml";
- xmlDoc.Save(caminho);
- //call method to generate hash
- geraHASH(caminho, nomeArquivo);
- }
- private void enviaACCS001(string protocolo, string caminho)
- {
- string base64 = Convert.ToBase64String(Encoding.Default.GetBytes("user:password"));
- string authorization = String.Concat("Basic ", base64);
- String finalResult;
- HttpWebRequest hwrRequest = (HttpWebRequest)HttpWebRequest.Create("addres/" + protocolo);
- hwrRequest.UseDefaultCredentials = true;
- hwrRequest.Headers.Add("Authorization", authorization);
- hwrRequest.Method = "PUT";
- string finalXML = @"<?xml version=""1.0"" encoding=""UTF-16BE""?>...";
- byte[] bytes = Encoding.Default.GetBytes(finalXML);
- hwrRequest.ContentLength = bytes.Length;
- using (Stream putStream = hwrRequest.GetRequestStream())
- {
- putStream.Write(bytes, 0, bytes.Length);
- }
- using (HttpWebResponse response = (HttpWebResponse)hwrRequest.GetResponse())
- using (StreamReader reader = new StreamReader(response.GetResponseStream()))
- {
- finalResult = reader.ReadToEnd();
- visualiza.Text = visualiza.Text + "n " + finalResult;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement