There is good information on these issues: How to generate xs: Date in the WCF OperationContract parameter and Best Practices for Serializing DateTime in .NET 3.5 .
As Alex says in a comment on this question, WCF does not support xs:date types. However, it might be more accurate to say that the default DataContractSerializer does not support this type, while the above questions indicate that the XmlSerializer can handle it.
See the link for comparing DataContractSerializer with XmlSerializer .
If I run:
svcutil http://my_web_site?wsdl /ser:XmlSerializer /d:C:\temp
Then this fragment of WSDL:
<s:complexType name="Contact"> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="BirthDate" type="s:date" /> </s:sequence> </s:complexType>
Is this class generated:
/// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")] public partial class Contact { private System.DateTime birthDateField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(DataType="date", Order=0)] public System.DateTime BirthDate { get { return this.birthDateField; } set { this.birthDateField = value; } } }
This svcutil call creates two files: Service1.cs and output.config . If I include the code file in the project and add the system.serviceModel bits to the configuration file (i.e. Web.config or app.config), I will then call the service as usual. For instance:
Service1SoapClient client = new Service1SoapClient("Service1Soap"); var contact = client.GetContact();
This approach is not without drawbacks. The Service1.cs file is noticeably different if generated without the /ser:XmlSerializer parameter, where you will get additional classes such as WebMethodNameRequest , WebMethodNameRequestBody , WebMethodNameReponse , WebMethodNameReponseBody and so on. If these classes are important in your interactions with the service, my approach may not work for you.
Edit:
In terms of null-value properties, there is good information in this question: svcutil.exe - A proxy-generated non-permissive field with a null-value
In order to get the nullable property in the generated proxy class, the nillable field must be set to WSDL. So something like this:
<s:element minOccurs="0" maxOccurs="1" name="SomeProperty" type="s:date" nillable="true" />
Will generate a property called public System.Nullable<System.DateTime> SomeProperty in the proxy class.
However, in your case, you can use the SomePropertySpecified property to indicate the presence or absence of the property. These properties are generated if you have minOccurs="0" .
Regarding date formatting, I'm not sure. The xs:date values ββmust be yyyy-mm-dd with additional time zone information ( w3.org ). If Oracle expects dates in a different format, I wonder how they can be xs:date values ββin general.
Is there any documentation or other information that you can provide regarding the service you are trying to use?
Edit 2:
I donβt quite understand what exactly βDates should be in database formatβ. means in docs oracle. If the type is xs:date , then serializing them into a database format undoubtedly means that it is no longer xs:date ?
However, there are a few things you are trying to do in this regard:
You may need to simply experiment with submitting multiple requests to the web service to see how this business dates affects things.
Are you sure *IsSpecified missing? To use my Contact class above as an example, minOccurs=0 in the BirthDate property BirthDate provide the Contact class with an additional property called BirthDateIsSpecified .