none
Problem with input xml.. some attrs are read, other are null... RRS feed

  • Question

  • I have a WCF on iis. I have a method called by post and I have to send to it an xml. the methods needs a List<WrapClienti> and two strings. The List<WrapClienti> have some issues.. I mean, some attributes are correctly set and other... not!!

    With this xml:

    <?xml version="1.0" encoding="utf-8" ?><SetClientiXML xmlns="http://tempuri.org/">
        <dati>
            <WrapClienti xmlns="http://schemas.datacontract.org/2004/07/MultipayOnline" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> 
                <CODRETE>0018</CODRETE> 
                <CODICE>20685</CODICE> 
                <NOME>A.T.E.R. Azienda Territoriale</NOME> 
                <INDIRIZZO>PIAZZA POZZA</INDIRIZZO> 
                <CITTA>Verona</CITTA> 
                <CAP>37123</CAP>
                <PROV>VR</PROV> 
                <CODICEFISCALE>00223640236</CODICEFISCALE> 
                <PIVA>223640236</PIVA> 
                <EMAIL/> 
                <ESPOSIZ_CONTABILE>937,02</ESPOSIZ_CONTABILE> 
                <STATO>FALSE</STATO> 
            </WrapClienti> 
        </dati>
        <retista>3303903</retista>
        <hashedString>oklkokokokok</hashedString>
    </SetClientiXML>

    the wcf read some attributes of the List, and other.. are nul!!!

    I my WrapClienti I have a lof of attributes. Two of them are:

        private string p_CAP { get; set; }
        public string CAP
        {
            get
            {
                if (model == null)
                    return p_CAP.ToSafeString();
                else
                    return this.model.CAP.ToSafeString();
            }
            set { p_CAP = value; }
        }
        private string p_PROV { get; set; }
        public string PROV
        {
            get
            {
                if (model == null)
                    return p_PROV.ToSafeString();
                else
                    return this.model.PROV.ToSafeString();
            }
            set { p_PROV = value; }
        }

    the problem is, with the xml above and with two breakpoint on the two set methods, only the set of PROV is called and, the one of CAP, not!!! Why? Now I'm really getting crazy... why this behavior??


    • Edited by Skas Tuesday, July 7, 2015 9:25 AM
    Tuesday, July 7, 2015 9:23 AM

Answers

All replies

  • How did you create your client classes?

    Tuesday, July 7, 2015 9:39 AM
  • I don't have client classes or a program.. I'm simply calling it from javascript console of my browser:

    $.ajax({
      type: "POST",
      contentType: "text/xml",
      url: "http://localhost:56178/MultiPOService.svc/SetClienti.xml",
      data: '<?xml version="1.0" encoding="utf-8" ?><SetClientiXML xmlns="http://tempuri.org/"><dati><WrapClienti xmlns="http://schemas.datacontract.org/2004/07/MultipayOnline" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <CODRETE>0018</CODRETE> <CODICE>20685</CODICE> <NOME>A.T.E.R. Azienda Territoriale</NOME> <INDIRIZZO>PIAZZA POZZA</INDIRIZZO> <CITTA>Verona</CITTA> <CAP>37123</CAP> <PROV>VR</PROV> <CODICEFISCALE>00223640236</CODICEFISCALE> <PIVA>223640236</PIVA> <EMAIL>ppp@libero.it</EMAIL> <ESPOSIZ_CONTABILE>937,02</ESPOSIZ_CONTABILE> <STATO>FALSE</STATO> </WrapClienti> </dati><retista>3303903</retista><hashedString>oklkokokokok</hashedString></SetClientiXML>',
      complete: function(f) {
          console.log(f);
        },
    });

    Tuesday, July 7, 2015 9:50 AM
  • I see. Calling a SOAP service by hand is pretty error prone. Never done that.

    Take a look at some JavaScript SOAP client tools:

    javascriptsoapclient.codeplex.com/
    Implementing a SOAP client in Javascript
    Call SOAP Web services with Ajax

    Tuesday, July 7, 2015 12:05 PM