How to generate xs:Date in WCF OperationContract parameter?

Now that this has come to my attention, I have created a new Suggestion in Connect, at Please Fully Support xs:Date for Date-Only Parameters and DataMembers I rated this with four stars (important).

Now that this has come to my attention, I have created a new Suggestion in Connect, at Please Fully Support xs:Date for Date-Only Parameters and DataMembers. I rated this with four stars (important). If anyone reading this feels this is important (or else disagrees), then please use Connect to vote on it or comment on it.

FYI: I rated your Connect suggestion 4 stars as well. – Sly Jun 27 '09 at 17:24 I certainly think it's important. In your connect suggestion you state that "I know that one can use XmlSerializationFormat to cause the XML Serializer to be used instead of the Data Contract Serializer".

While this is a workaround for DataContracts, my understanding is that there isn't a way of specifying XML serailization for operation contract parameters. Is this understanding correct? In any case the MS response to the original (closed) Connect suggestion indicates they are considering this for "v.

Next" (not sure if this means V4 or the following version). – Joe Jun 27 '09 at 19:12 I believe it's possible to configure the entire service contract, service, or endpoint to use the xml serializer. Not quite sure how.

– John Saunders Jun 27 '09 at 20:23.

You specified a requirement to have xs:Date as a parameter in the operation. The thing is, there's a formal way to specify such requirements: WSDL. If I were doing this I would use a WSDL First approach.

Start with a WSDL that defines the contract you want, including an xs:date in the interface, wherever it is you want it. Then generate the service stub using svcutil.exe. Remember to pass in /serializer:xmlSerializer .

Unfortunately WCF doesn't support the xs:Date type. You'd have to create your own "DateOnly" struct, like: _ public struct DateOnly public Month as Integer public Day as Integer public Year as Integer end struct.

So that non-WCF clients that recognize xs:Date don't need yet another custom type. – Joe Apr 22 '09 at 16:55 I'm not aware of any way to change that except for modifying the XML of the WSDL on the fly. I'm not sure of the performance implications though.

This article doesn't completely address your situation but may get you started on how to modify the SOAP message content. Blogs.msdn.Com/kaevans/archive/2008/01/08/… – Keith Apr 23 '09 at 14:43.

WCF's defaut serializer (DataContractSerializer) does not support it. But XmlSerializer supports it. 1 - Add the XmlSerializerFormat attribute to your contract... XmlSerializerFormat ServiceContract public interface IMyContract { MyType GetData(); } 2 - In the DataContract type, add the XmlElement(DataType = "date") to the member.

Public class MyType { XmlElement(DataType = "date") public DateTime BirthDate {get; set;} } Hope this helps.

This doesn't help for date parameters to an OperationContract. – Joe Jun 27 '09 at 17:08 1 I'm sorry, I did not realize you were talking about simple DateTime parameter. But won't you have the same issue with your complex types if you don't switch to XmlSerializerFormat?

– Sly Jun 27 '09 at 17:28 Yes, the same issue exists for DataMembers and for OperationContract parameters. For DataMembers, using XML Serialization is a workaround (even if it does lose some of the benefits of DataContracts). But I'm looking for a solution that works in both cases, pending the fix that Microsoft is considering for "v.

Next": connect.microsoft. Com/wcf/feedback/… – Joe Jun 27 '09 at 20:08.

I've also got described issue. I've developed my own solution - WcfDate custom type. It is published here: WCF Support for xs:date.

Now that this has come to my attention, I have created a new Suggestion in Connect, at Please Fully Support xs:Date for Date-Only Parameters and DataMembers . I rated this with four stars (important).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions