WebService -> XML

P

Paulo

exportapedidoSoapClient ExpPedido = new exportapedidoSoapClient();
//WebService

XmlNode testeNode = ExpPedido.ExportaPedido(963); //Executing WebSvc method

XmlDocument xmlDoc = new XmlDocument(); //Create a XML Doc

foreach (XmlNode node2 in testeNode.ChildNodes)
{
xmlDoc.CreateElement(node2.Name);
xmlDoc.ImportNode(node2, true);
}

xmlDoc.Save("teste.xml"); //<--ERROR
-------------------------------------------------
I need to save the result to a XML file... How can it be done? What am I
doing wrong? Can you help me?

Thanks

Using C# 3.5 Express



__________ Information from ESET Smart Security, version of virus signature database 3599 (20081110) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
M

Martin Honnen

Paulo said:
exportapedidoSoapClient ExpPedido = new exportapedidoSoapClient();
//WebService

XmlNode testeNode = ExpPedido.ExportaPedido(963); //Executing WebSvc method

XmlDocument xmlDoc = new XmlDocument(); //Create a XML Doc

foreach (XmlNode node2 in testeNode.ChildNodes)
{
xmlDoc.CreateElement(node2.Name);
xmlDoc.ImportNode(node2, true);
}

xmlDoc.Save("teste.xml"); //<--ERROR


XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.ImportNode(testeNode, true));
doc.Save("teste.xml");
 
P

Paulo

Thank you very much Mr. Honnen, it worked !!!!!!

Martin Honnen said:
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.ImportNode(testeNode, true));
doc.Save("teste.xml");

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

__________ Information from ESET Smart Security, version of virus
signature database 3599 (20081110) __________

The message was checked by ESET Smart Security.

http://www.eset.com



__________ Information from ESET Smart Security, version of virus signature database 3599 (20081110) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top