document. ---> System.InvalidOperationException: Value of ItemsElementName
ESRI.ArcXml.ItemsChoiceType4.@PROPERTIES.
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterGET_IMAGE.Write151_GET_IMAGE(String
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterGET_IMAGE.Write152_GET_IMAGE(Object
"cd~" <ralibey@community.nospam> wrote in message
news:u12ykX1IGHA.2696@TK2MSFTNGP14.phx.gbl...
> This is the test code that I am having trouble with, it fails on the first
> line of the try block:
>
> using System;
> using System.Collections.Generic;
> using System.Text;
> using System.Xml;
> using System.Xml.Serialization;
> using ESRI.ArcIMS.Server;
> using ESRI.ArcXml;
> using System.Diagnostics;
>
> namespace ArcXmlTest {
> class Program {
> private static ARCXML CreateImageRequest() {
> ARCXML ax = new ARCXML();
> REQUEST req = new REQUEST();
> GET_IMAGE gi = new GET_IMAGE();
>
> ax.Item = req;
> req.Item = gi;
> return ax;
> }
>
> private static XmlDocument Serialize<T>(T xmlObject) {
> XmlSerializer xs = new
> System.Xml.Serialization.XmlSerializer(typeof(T));
> StringBuilder sb = new StringBuilder();
>
> using (XmlWriter xw = XmlWriter.Create(sb)){
> XmlDocument xml = new XmlDocument();
> xs.Serialize(xw, xmlObject);
> xml.LoadXml(sb.ToString());
> return xml;
> }
> }
>
> static void Main(string[] args) {
> ARCXML arcxml = CreateImageRequest();
> GET_IMAGE imageRequest = ((GET_IMAGE)((REQUEST)arcxml.Item).Item);
> PROPERTIES props = new PROPERTIES();
>
> imageRequest.Items = new object[] {props};
> imageRequest.ItemsElementName = new ItemsChoiceType4[] {
> ItemsChoiceType4.PROPERTIES };
> props.Items = new object[]{new ENVELOPE()};
>
> TextWriterTraceListener listener = new
> TextWriterTraceListener(@"c:\ArcXmlTest.trc");
> Trace.AutoFlush = true;
> Trace.Listeners.Add(listener);
>
> try {
>
> Trace.WriteLine(Serialize<GET_IMAGE>(imageRequest).OuterXml);
>
> Trace.WriteLine(IMSConnection.Send(arcxml.Serialize().OuterXml));
> }
> catch(System.Exception e){
> Trace.WriteLine(e.ToString());
> }
> }
> }
> }
>
> "cd~" <ralibey@community.nospam> wrote in message
> news:uEkY1M1IGHA.916@TK2MSFTNGP10.phx.gbl...
>>I can provide a test app, the news server won't allow me to post the files
>> because they are too large (93KB and 1.2KB)
>>
>> I downloaded the ESRI ArcXml schema and generated the classes from the
>> schema using xsd.exe, which took a while because xsd doesn't handle
>> recursive elements very well (StackOverFlow exception during generation).
>> Now that I have the classes I am trying to serialize them to an xml
>> document
>> to send to ArcIMS to generate map images. The .trc file is a text file
>> that
>> contains the exception information that this throws.
>>
>> This is the only document I am able to find on this bug on the web,
>> convieniently on MSDN:
>>
http://msdn.microsoft.com/netframework/programming/breakingchanges/designtime/xmlserial.aspx >> The only solution that I can come up with is to install VS2003 and
>> compile
>> the ArcXml classes since this seems to be something that has been broken
>> in
>> VS2005
>>
>> Thank you for your time,
>> Russell
>>
>>
>>
>>
>>
>
>