locked
Missing objects in ws response once XML stream's been serialized (webservice client) RRS feed

  • Question

  • Hi,

    I'm testing a small webservice client I've written, with the following lines (summed up):
     1  namespace account_ws
     2  {
     3    [...]
     4    account_ws.AppWS.appsoapservice ws = new account_ws.AppWS.appsoapservice();
     5    ws.Url = "http://<IP of dev server>:9080/app-ws/services/app-ws";
     6    ws.Credentials = new NetworkCredential("login", "pwd");
     7    account_ws.AppWS.getaccountcommand getAccountCommand = new account_ws.AppWS.getaccountcommand();
     8
     9    getAccountCommand.acntid = "14979";
    10
    11    textBox1.SelectAll();
    12    textBox1.Text = "";
    13
    14    account_ws.AppWS.accountreply epr = ws.getaccount(getAccountCommand);
    15
    16    System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(account_ws.AppWS.accountreply));
    17    System.IO.StringWriter sw = new System.IO.StringWriter();
    18    ser.Serialize(sw, epr);
    19    sw.Flush();
    20    textBox1.Text = sw.ToString();
    21  }

    It's the line 14 where something wrong happens. I know my XML reply is clean, and contains everything
    it must (all nodes, attributes, values...), I've thoroughly debugged and checked what happens on the
    server side. For some reason, certain nodes disappear during unmarshalling (I then serialize again -lines
    16 through 20- to display the result of my request, but when I debug I can see 'epr' contains an account,
    that contains a list of credits, and each credit should contain an external reference: it is null for every
    credit already).

    I will illustrate with an example. Amongst others, I receive the following data from my server:
    <credit accr-id="5241">
      <amount currency="EUR">135</amount>
      <remaining-amount currency="EUR">135</remaining-amount>
      <reason>This is the reason</reason>
      <credit-ext-ref type="STUFFTYPE">VALREF2XB</credit-ext-ref>
    </credit>

    yet once the process has run through line 20, the text in my textBox shows that 'credit-ext-ref' is
    never set (as I said above it's empty because the ext-ref object in credit in account in accountreply
    is null indeed):
    <credit accr-id="5241">
      <amount currency="EUR">135</amount>
      <remaining-amount currency="EUR">135</remaining-amount>
      <reason>This is the reason</reason>
    </credit>

    My question: in debug mode is there a way to dive inside Visual C# to try to figure out what
    goes on behind the scene for line 14, and try understand why, although my 'credit-ext-ref' nodes
    are filled in the XML stream, the corresponding objects always appear empty once they've been
    unmarshalled from this XML ?

    Thanks a lot for any suggestion !
    Regards,
    Seb


    Wednesday, January 13, 2010 3:38 PM

All replies

  • Sorry I posted this question too early... I found out local config files (XSD's) that
    contained nodes names not matching those coming from the server => they were
    ignored (without error).

    Friday, January 15, 2010 12:17 PM