I’ve created web service by using below coding
[WebMethod(Description = “Echo Soap Request”)]
public XmlDocument EchoSoapRequest()
{
// Initialize soap request XML
XmlDocument xmlSoapRequest = new XmlDocument();
// Get raw request body
Stream receiveStream = HttpContext.Current.Request.InputStream;
// Move to begining of input stream and read
receiveStream.Position = 0;
using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
{
// Load into XML document
xmlSoapRequest.Load(readStream);
}
// Return
return xmlSoapRequest;
}
And I’m getting following error:
System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.Load(TextReader txtReader) at Recievingsoap.recieve.EchoSoapRequest() in C:\Users\kbvn189\Documents\Visual Studio 2010\Projects\Recievingsoap\Recievingsoap\recieve.asmx.cs:line 70 If you have any idea get me soon. Urgent