Problems using EntLib3.0's "[ObjectValidator]" in WSSF

Topics: Development Team Discussion, User Discussion
Oct 15, 2007 at 9:59 AM
I'm trying to use the validation blocks of EntLib3.0 with WSSF(last realese) and I'm having problems to make the MessageTemplate be considered when I use the "ObjectValidator" in a Message Contract: a generic "default" error description is sent inside the FaultException and not the MessageTemplate I put in the DataContract that specify that object!!!
Any suggestion?



For example:
In the file UpdateAnagraficaReq that specify the MessageContract ==>

"
MessageContract
public class UpdateAnagraficaArmadioReq
{
private String ID;
private Anagrafica anagrafica;

MessageBodyMember(Order = 0)
NotNullValidator
StringLengthValidator(16, 16, MessageTemplate = "ID must be of 16 chars")
//This MessageTemplate is correctly considered in case of input error

public String ID
{
get { return ID; }
set { ID = value; }
}

MessageBodyMember(Order = 1)
ObjectValidator
//IF A VALIDATION ERROR OCCUR IN THIS OBJECT, ONLY GENERIC CAUSE IS DISPLAYED AND NOT
//THE MessageTemplate SPECIFIED IN THE ELEMENT OF THAT Object

public AnagraficaArmadioInfo AnagraficaArmadio
{
get { return anagraficaArmadioInfo; }
set { anagraficaArmadioInfo = value; }
}
}



In the file that specify the DataContract for the object used ibn the MessageContract ==>


DataContract(Namespace = "http://DataContracts/2007/04", Name = "Anagrafica")
public partial class AnagraficaInfo
{
private String indirizzo;

DataMember(IsRequired = false, Name = "Indirizzo", Order = 0)
IgnoreNulls
StringLengthValidator(1, 255, MessageTemplate = "The address must be max 255 chars")
//THIS MESSAGE IS NEVER DISPLAYED AND ONLY THE GENERIC FAULT "The value is not null and failed
// all its validation rules for key "Indirizzo". Key=Indirizzo Tag=request" IS DISPLAYED
public String Indirizzo
{
get { return indirizzo; }
set { indirizzo = value; }
}
"