0
I have a method that receives some parameters, I would like to replace some xml information, at the moment I can only remove and add new information
private void CriacaoDoConfirmarLogin(string CaminhoArquivoParaLeitura, string NomeCaminhoParaArquivoSaida, string Desafio)
{
//remove o conteudo do corpo do arquivo de retorno do webservice
//para que eu possa utilizar para enviar outros metodos
string CaminhoCompletoArquivoConfirmacao = CaminhoArquivoParaLeitura;
XmlDocument doc = new XmlDocument();
doc.Load(CaminhoCompletoArquivoConfirmacao);
var todosOsNos = doc.SelectNodes("//*");
for (int i = 0; i < todosOsNos.Count; i++)
{
var element = todosOsNos[i];
if(element.Name == "ServiceId")
{
element.InnerText.Replace("SolicitaLogon", "ConfirmaLogon");
}
if (element.Name == "MsgDesc")
{
element.InnerText.Replace("Solicitação do Desafio de Logon", "Confirmação do Desafio de Login");
}
if (element.Name == "Resposta")
{
// pega o parent node
XmlNode parent = element.ParentNode;
// remove o node
parent.RemoveChild(element);
//adiciona o node de desafio
XmlElement desafioElemento = doc.CreateElement("DesafioAssinado");
desafioElemento.InnerText = Desafio;
parent.AppendChild(desafioElemento);
// grava a saida do arquivo
string newXML = doc.OuterXml;
doc.Save(NomeCaminhoParaArquivoSaida);
}
}
}
Are you sure the cited session is to be your Session ID? and not another webservice identifier?
– Leandro Angelo
I supplemented my question, see if it’s clearer now, I appreciate the help
– Harry
@Leandroangelo, adjust the question, see if you can help
– Harry
@Leandroangelo, I added the code,
– Harry
Your question is more and more confused, you have two webservices?
ContextoLoginWebService
and objWSProducao?– Leandro Angelo
@Leandroangelo, I have a class "Contextologinwebservice " in my controller I call her, ie in my controler Login, I’m calling my "Contextologinwebservice "
– Harry