i am using this code
XmlDocument xmlDoc = new XmlDocument();
// Write down the XML declaration
XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null);
XmlElement Envelope = xmlDoc.CreateElement("SOAP-ENV", "Envelope", "http://schemas.xmlsoap.org/soap/envelope/");
// XmlAttribute soapenc = xmlDoc.CreateAttribute("soapenc", "xmlns", "http://schemas.xmlsoap.org/soap/encoding/");
XmlAttribute xlink = xmlDoc.CreateAttribute("xlink", "xmlns", "http://www.w3.org/1999/xlink");
XmlAttribute eb = xmlDoc.CreateAttribute("eb", "xmlns", "http://www.ebxml.org/namespaces/messageHeader");
XmlAttribute xsd = xmlDoc.CreateAttribute("xsd", "xmlns", "http://www.w3.org/1999/XMLSchema");
// XmlAttribute xsi = xmlDoc.CreateAttribute("xsi", "xmlns", http://www.w3.org/2001/XMLSchema-instance);
Envelope.SetAttributeNode(xsi);
Envelope.SetAttributeNode(xsd);
Envelope.SetAttributeNode(xlink);
xmlDoc.AppendChild(Envelope);
it gives out put as
<SOAP-ENV:Envelope xlink:xmlns="" eb:xmlns="" xsd:xmlns="" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" />
but i want in the format
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Header/>
please help me
Loading
vipin sainiPosted Sep 24, 2010, 1:15 AM
there was some correction
i using this
XmlDocument xmlDoc = new XmlDocument();
// Write down the XML declaration
XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null);
XmlElement rootNode = xmlDoc.CreateElement("SOAP-ENV", "Envelope", "http://schemas.xmlsoap.org/soap/envelope/");
// XmlElement rootNode = xmlDoc.CreateElement("SOAP-ENV:Envelope");
// rootNode.SetAttribute("xmlns:SOAP-ENV","http://schemas.xmlsoap.org/soap/envelope/");
rootNode.SetAttribute( "xmlns:eb","http://www.ebxml.org/namespaces/messageHeader");
rootNode.SetAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");
rootNode.SetAttribute("xmlns:xsd","http://www.w3.org/1999/XMLSchema");
xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement);
xmlDoc.AppendChild(rootNode);
XmlElement soapbody = xmlDoc.CreateElement("SOAP-ENV", "Body", "abc");
xmlDoc.DocumentElement.PrependChild(soapbody);
it gives the output
xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header xmlns:SOAP-ENV="abc" />
but i want
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Header />
this is the error in header.
please correct it
Mike GoldPosted Sep 23, 2010, 2:59 PM