By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,139 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,139 IT Pros & Developers. It's quick & easy.

Webservice Error

P: 1
I've created webservice using by code:
[WebMethod(Description = "Echo Soap Request")]
public XmlDocument EchoSoapRequest(string input)
// 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;
System.Text.Encoding encoding = System.Text.Encoding.Unicode;
//BinaryWriter bw = new BinaryWriter(receiveStream, encoding);
using (StreamReader readStream = new StreamReader(receiveStream,Encoding.UTF8))
// Load into XML documen

//xmlSoapRequest.Load(ConfigurationManager.AppSettin gs["CatalogXMlRootPath"] + readStream + ".xml");

// Return
return xmlSoapRequest;

But I got following error,if you have any error give me suggestion:

System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitesp ace()
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 GettingLists.lsts.EchoSoapRequest(String input) in E:\Practice\Sharepoint\GettingLists\GettingLists\l sts.asmx.cs:line
Nov 17 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.