Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I am very new to working with WCF stuff. I am consuming a third party WCF and getting the responses for all the objects properly except one. I checked from fiddler tool to verify the response from the WCF and it is coming fine from their end but when the response is assigned to the object at my end it does not come there.

The piece of code related to that is given below:

WSDL:

HTML
<xsd:complexType name="accountIdentifier">
<xsd:choice>
<xsd:element name="accountNumber" type="tns:officeAccountFA"/>
<xsd:element name="keyAccount" type="tns:keyAccountId"/>
</xsd:choice>
</xsd:complexType>



Proxy code:

C#
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.2022")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.ms.com/com/ms/banking/lending/services/LendingService/2.0.0")]
public partial class accountIdentifier {
        private object itemField;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute("accountNumber", typeof(officeAccountFA), Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
        [System.Xml.Serialization.XmlElementAttribute("keyAccount", typeof(string), Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public object Item {
            get {
                return this.itemField;
            }
            set {
                this.itemField = value;
            }
        }
    }
/// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.2022")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://xml.ms.com/com/ms/banking/lending/services/LendingService/2.0.0")]
    public partial class officeAccountFA {
                private string branchField;
                private string accountNumberField;
                private string faField;
                /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string branch {
            get {
                return this.branchField;
            }
            set {
                this.branchField = value;
            }
        }
                /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string accountNumber {
            get {
                return this.accountNumberField;
            }
            set {
                this.accountNumberField = value;
            }
        }
                /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string fa {
            get {
                return this.faField;
            }
            set {
                this.faField = value;
            }
        }
    }




Response from service as I see in Fiddler tool

HTML
<facilitationAccount><accountNumber><branch>101</branch><accountNumber>150550</accountNumber></accountNumber><keyAccount>2013-07-31-03.09.58.692118</keyAccount></facilitationAccount>


When I hit the service and get the response from in my object only the data that I get is:

<accountNumber><branch>101</branch><accountNumber>150550</accountNumber></accountNumber>

I am not able to get the below data in my object:

<keyAccount>2013-07-31-03.09.58.692118</keyAccount>


Please help. I am stuck with this problem for so long, please do let me know if I am missing something.

Thanks in Advance.
Posted

Try to check weather this issue is related to node,child node identification .
 
Share this answer
 
See http://www.w3schools.com/schema/el_choice.asp[^]:
XML Schema choice element allows only one of the elements contained in the  declaration to be present within the containing element.

The XML you receive contains both accountNumber and keyAccount, which is not acceptable with that xsd. That means, the other side sends wrong data.
 
Share this answer
 
Comments
deeptibansal 27-May-14 3:32am    
yes, they were sending the wrong data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900