Boa tarde!
Senhores, estou penando para remover o cabeçalho do xml de retorno do meu WS.
Queria retirar essas linhas;
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">
Meu código esta desta maneira.
// Parametros
byte[] buffer = Encoding.UTF8.GetBytes("");
// Url
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create("http://" + ConsumindoMeuWS.Properties.Settings.Default.WSHost + "/MinhaAsmx.asmx/MeuMetodo");//localhost:3987
// Metodo
WebReq.Method = "POST";
WebReq.ContentType = "application/x-www-form-urlencoded";
WebReq.ContentLength = buffer.Length;
//Requisição
Stream PostData = WebReq.GetRequestStream();
// Chamada
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
//Retorno
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
Stream Answer = WebResp.GetResponseStream();
StreamReader _Answer = new StreamReader(Answer);
string a = _Answer.ReadToEnd().Replace("<", "<").Replace(">", ">").Replace("<", "<").Replace(">", ">");
System.IO.File.WriteAllText(Application.StartupPath + "\\Dat\\" + "DG" + batchIdExternal + ".XML", a);
Desde já, grato.
M. Almeida