Note that there are some explanatory texts on larger screens.

plurals
  1. POC#: Deserialise XML File error (think it's a namespace issue - cant for the life of me work it out though)
    primarykey
    data
    text
    <p>I'm deserialising an XML file which comes from a webservice of one of our clients.</p> <p>Problem is, after creating the class with xsd.exe I deserialise the file and get the usual "There is an error in XML document (2, 2)." visual studio error. This, I presume is line 2, which points to the namespace declarations:</p> <p><strong>Top of XML file:</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"&gt; &lt;soapenv:Body&gt;&lt;MXWorkorderOutResp language="EN" xmlns="http://www.mro.com/mx/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;Header event="0" operation="Response" rsCount="8" rsStart="0" rsTotal="8"&gt; &lt;SenderID build="127" dbbuild="V600-467" majorversion="6" minorversion="1" type="MAXIMO"&gt;MX&lt;/SenderID&gt; &lt;CreationDateTime&gt;2009-05-11T09:48:51+01:00&lt;/CreationDateTime&gt; &lt;RecipientID&gt;SUPPLIER&lt;/RecipientID&gt; &lt;MessageID&gt;12420317323327108&lt;/MessageID&gt; &lt;/Header&gt; &lt;Content&gt; &lt;MXWORKORDER&gt; &lt;WORKORDER&gt; </code></pre> <p><strong>Top Of Class:</strong></p> <pre><code>[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.mro.com/mx/integration")] [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.mro.com/mx/integration", IsNullable=false)] public partial class MXWorkorderOutResp { private MXWorkorderOutRespHeader[] headerField; private MXWorkorderOutRespContentMXWORKORDERWORKORDER[][][] contentField; private string languageField; /// &lt;remarks/&gt; [System.Xml.Serialization.XmlElementAttribute("Header")] public MXWorkorderOutRespHeader[] Header { get { return this.headerField; } set { this.headerField = value; } } /// &lt;remarks/&gt; [System.Xml.Serialization.XmlArrayItemAttribute("MXWORKORDER", typeof(MXWorkorderOutRespContentMXWORKORDERWORKORDER[]), IsNullable=false)] [System.Xml.Serialization.XmlArrayItemAttribute("WORKORDER", typeof(MXWorkorderOutRespContentMXWORKORDERWORKORDER), IsNullable=false, NestingLevel=1)] public MXWorkorderOutRespContentMXWORKORDERWORKORDER[][][] Content { </code></pre> <p>I presume there's an error with the:</p> <pre><code>[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.mro.com/mx/integration")] [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.mro.com/mx/integration", IsNullable=false)] </code></pre> <p>part of the XML, but I have no idea what to change it to - or what VS wants.</p> <p>any help at all appreciated guys, I'm still pretty new to all this and my boss is breathing down me all the time to get this working :(</p> <p><strong>EDIT:</strong> There is an inner exception yes! Sorry guys!</p> <pre><code>{"&lt;Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'&gt; was not expected."} </code></pre> <p>So how do I add this namespace declaration to the class?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    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