Note that there are some explanatory texts on larger screens.

plurals
  1. PO"The data at the root level is invalid" Error when using a Web Serivce
    primarykey
    data
    text
    <p>I'm trying to run a method of a Web Service in a desktop .net app but have a problem in phrasing its XML result. when i run the mentioned method compiler throws this error:</p> <blockquote> <p>There is a problem with the XML that was received from the network. See inner exception for more details.</p> </blockquote> <p>the Web service is hosted on Apache server and has written with PHP. there is a client sample which could run that method successfully. and the result XML is as this:</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;ServicesList&gt; &lt;Service&gt; &lt;token&gt;11838-78&lt;/token&gt; &lt;coName&gt;test&lt;/coName&gt; &lt;/Service&gt; &lt;/ServicesList&gt; </code></pre> <p>here is part of the details of inner exception which says: "The data at the root level is invalid"</p> <pre><code>Message=The data at the root level is invalid. Line 1, position 1. Source=System.Runtime.Serialization LineNumber=0 LinePosition=0 StackTrace: at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3) at System.Xml.XmlUTF8TextReader.Read() at System.Xml.XmlBaseReader.IsStartElement() at System.Xml.XmlBaseReader.IsStartElement(XmlDictionaryString localName, XmlDictionaryString namespaceUri) at System.ServiceModel.Channels.ReceivedMessage.ReadStartEnvelope(XmlDictionaryReader reader) at System.ServiceModel.Channels.BufferedMessage..ctor(IBufferedMessageData messageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders, Boolean understoodHeadersModified) at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType) at System.ServiceModel.Channels.MessageEncoder.ReadMessage(Stream stream, BufferManager bufferManager, Int32 maxBufferSize, String contentType) at System.ServiceModel.Channels.HttpInput.ReadChunkedBufferedMessage(Stream inputStream) InnerException: </code></pre> <p>I have spending so much time on Google to find out what the problem is from. and just figured out that it maybe the result XML starts with BOM (Byte order mark) which cause the XMLReader to throw exception.</p> <p>finally here is where i call the method:</p> <pre><code> mywebservice.wsobjectDLPortTypeClient mys = new mywebservice.wsobjectDLPortTypeClient(); try { string res; // mys.Open(); res = mys.srvReq(sourcecode, destinationcode, date, time, count); catch (Exception e) { //do something } </code></pre> <p>any body know what is that cause this problem and how i can solve it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload