locked
Invalid or missing value of the choice identifier 'ItemsElementName' of type 'Entities.ItemsChoiceType3[]'. RRS feed

  • Question

  • Hi have a very huge object generated off the HL7 XSD (health level 7 compliance)

    the generated object as the following generic time field which is basically a string.

           

    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(Namespace = "urn:hl7-org:v3")]
        public partial class IVL_TS : SXCM_TS
        {

            private QTY[] itemsField;

            private ItemsChoiceType3[] itemsElementNameField;

    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(Namespace = "urn:hl7-org:v3")]
        public partial class IVL_TS : SXCM_TS
        {
    
            private QTY[] itemsField;
    
            private ItemsChoiceType3[] itemsElementNameField;
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute("any", typeof(TS))]
            [System.Xml.Serialization.XmlElementAttribute("center", typeof(TS))]
            [System.Xml.Serialization.XmlElementAttribute("high", typeof(IVXB_TS))]
            [System.Xml.Serialization.XmlElementAttribute("low", typeof(IVXB_TS))]
            [System.Xml.Serialization.XmlElementAttribute("width", typeof(PQ))]
            [System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")]
            public QTY[] Items
            {
                get
                {
                    return this.itemsField;
                }
                set
                {
                    this.itemsField = value;
                }
            }
    
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute("ItemsElementName", IsNullable = true)] //inserted by Adil
            [System.Xml.Serialization.XmlIgnoreAttribute()]
            public ItemsChoiceType3[] ItemsElementName
            {
                get
                {
                    return this.itemsElementNameField;
                }
                set
                {
                    this.itemsElementNameField = value;
                }
            }
        }

    the enum ItemsChoiceType3 is as follow:

    public enum ItemsChoiceType3    
    {
            /// <remarks/>
            any,
            /// <remarks/>
            center,
            /// <remarks/>
            high,
            /// <remarks/>
            low,
            /// <remarks/>
            width,
        }

    following is the derivation tree of this element node IVL_TS:

    public partial class IVL_TS : SXCM_TS : TS
    
    // the above inheritance hierarchy is deep than TS ...
    // Anyways, the class TS has following attribute below
    
        public partial class TS : QTY
        {
    	private string valueField;
    
    	/// <remarks/>
    	[System.Xml.Serialization.XmlAttributeAttribute()]
    	public string value
    	{
    		get
    		{
    			return this.valueField;
    		}
    		set
    		{
    			this.valueField = value;
    		}
    	}
        }


    the object property setting is all fine but when it comes to serialziation it gives:
    Invalid or missing value of the choice identifier 'ItemsElementName' of type 'Entities.ItemsChoiceType3[]'.

    Why is this not letting me serialize the object? this is bizzare! is there not a:
    [System.Xml.Serialization.XmlIgnoreAttribute()] on the attribute ItemsElementName ??

    for the federal government's documentation the XML serialization should allow both:

    <receiver negationInd="false">
    <time value="20050101"/>
    </receiver>

    AND

    <receiver negationInd="false">
    <time>
    <low value="20050110"/>
    <high value="20050114"/>
    ...
    </time>
    </receiver>

    As soon as i set atleast one enum value in the ItemsElementName array, the serlialization is fine! else it craps on me! 

    PLEASE HELP OUT AS WE HAVE A FEDERAL GOVERNMENT SUBMISSION OF OUR PATIENT DATA END OF THIS MONTH!


    new to every thing

    Friday, November 16, 2012 1:53 AM

All replies

  • This is not a forum question. If it's that important, then you need to open a support ticket with Microsoft.

    AND YOU NEED TO DO THAT RIGHT NOW INSTEAD OF YELLING AT US!


    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects

    Saturday, November 17, 2012 4:00 AM
    Moderator