none
MessageContract and EmitDefaultValue RRS feed

  • Question

  • Hi,

    Is there any way to use message-style operations with [MessageContract] types together with DataMemberAttribute.EmitDefaultValue? Or at least get the same behavior – get rid of empty elements in the resulting SOAP.

    There is, of course, a universal way – to derive from Message, but it is the last chance

    Thanks in advance!

    Friday, February 23, 2007 3:46 PM

Answers

  • datacontract is bound to a particular type, it specifies how do you want to expose data of your type. datacontractserializer serializer according to this contract and you can use it at service level or stand alone. its external representation is xml schema.

    messagecontract is more of a concept that is closely map to soap message, it represent a soap message the can be send between service and client. its external representation in the message and message part in the wsdl file. it normally only used in the service/operation context.

    Sunday, March 4, 2007 6:32 AM
    Moderator
  • So, all the members of a Message Contract are Message Parts in terms of WSDL and not just XML elements defined in XML Schema. Therefore they can not be optionally omitted according to WSDL. Right?
    Tuesday, March 6, 2007 11:10 AM
  • that's correct
    Tuesday, March 6, 2007 6:20 PM
    Moderator

All replies

  • Unfortunate the answer is No. EmitDefaultValue is only for DataContract Serializer. This limitation is actually partially due to WSDL. the WSDL message part doesn't have a 'isnullable' concept.
    Friday, February 23, 2007 4:44 PM
    Moderator
  • Hi Joe,

    Thank you for your answer, but I'm not sure that I understand you right.

    Can you tell me more about the difference between data and message contracts, and how is WSDL related to them?

    Thursday, March 1, 2007 9:57 AM
  • datacontract is bound to a particular type, it specifies how do you want to expose data of your type. datacontractserializer serializer according to this contract and you can use it at service level or stand alone. its external representation is xml schema.

    messagecontract is more of a concept that is closely map to soap message, it represent a soap message the can be send between service and client. its external representation in the message and message part in the wsdl file. it normally only used in the service/operation context.

    Sunday, March 4, 2007 6:32 AM
    Moderator
  • So, all the members of a Message Contract are Message Parts in terms of WSDL and not just XML elements defined in XML Schema. Therefore they can not be optionally omitted according to WSDL. Right?
    Tuesday, March 6, 2007 11:10 AM
  • that's correct
    Tuesday, March 6, 2007 6:20 PM
    Moderator