0
Reply

WCF xml input partially read...

Piero Alberto

Piero Alberto

Jul 7 2015 5:29 AM
417

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??