Member 11180435 Ответов: 0

Wcf messagecontract и messagebodymember


Hi,

I'm looking for a way to specify that some MessageBodyMember is required, so that the generated schema would have minOccurs=1 instead of minOccurs=0.

I know that the DataMember has such an option(IsRequired=true), however I prefer using the MessageContract for controlling other aspects of the message.


Что я уже пробовал:

[MessageContract(IsWrapped = true, WrapperName = "CityRequestObject")]
public class CityInfoRequest
{
   
    [MessageHeader]
    public string UserKey { get; set; }
    [MessageHeader]
    public string TransactionID { get; set; }
    [MessageHeader]
    public string EntityCode { get; set; }
    [MessageBodyMember]
    [System.Xml.Serialization.XmlElementAttribute(IsNullable = true, Form = System.Xml.Schema.XmlSchemaForm.Qualified, Order = 0)] 
    public string Lang { get; set; }

}

0 Ответов