<div>when instantiating one of webservices I get the following Exception
"'date' is an invalid value for the SoapElementAttribute.DataType property. The property may only be specified for primitive types."</div> <div> </div> <div>The
same code is working fine in VS 2003 , when i migrate to VS 2005 i am getting the above error.</div> <div> </div> <div>Please suggest a solution to overcome this issue.
</div> <div> </div> <div>Regards</div> <div>Saravanan</div>
I know this is an old post, but I'm having this problem right now and there seems to be no literature about it online.
I have found a few things while investigating though. It is nillable dates that are a problem. You can do either of the following to resolve it.
1. If you have control over the web service causing the problem, change it's specification so that all nillable date fields are nillable dateTime fields. This seemed to work in my solution.
2. If you do not have control over the web service you are calling, you will have to edit the generated reference.cs class to replace all instances of System.Nullable<System.DateTime> with just DateTime. This means the field on the object is no longer nullable,
so you will have problems representing null values. It also means you have to edit it again every time you update your web service.
Hopefully this has been resolved in .NET 3.0 and WCF?
I had a similar issue adding a TestTrack Pro web reference to VS 2008. I got the error "'date' is an invalid value for the SoapElementAttribute.DataType property. The property may only be specified for primitive types."
my fix is at http://bit.ly/bsMQaB
I know this is too late to help you but hopefully it helps someone else.
Replacing xsd:date with xsd:dateTime in the WSDL seems to work for me. I think it's a better solution because in theory it should keep null dates working.
saravananin
Member
7 Points
3 Posts
error when instantiating a web services
Jun 23, 2006 03:54 PM|LINK
"'date' is an invalid value for the SoapElementAttribute.DataType property. The property may only be specified for primitive types."</div> <div> </div> <div>The same code is working fine in VS 2003 , when i migrate to VS 2005 i am getting the above error.</div> <div> </div> <div>Please suggest a solution to overcome this issue. </div> <div> </div> <div>Regards</div> <div>Saravanan</div>
sbarnes
Member
116 Points
34 Posts
Re: error when instantiating a web services
Apr 19, 2007 01:30 PM|LINK
I know this is an old post, but I'm having this problem right now and there seems to be no literature about it online.
I have found a few things while investigating though. It is nillable dates that are a problem. You can do either of the following to resolve it.
1. If you have control over the web service causing the problem, change it's specification so that all nillable date fields are nillable dateTime fields. This seemed to work in my solution.
2. If you do not have control over the web service you are calling, you will have to edit the generated reference.cs class to replace all instances of System.Nullable<System.DateTime> with just DateTime. This means the field on the object is no longer nullable, so you will have problems representing null values. It also means you have to edit it again every time you update your web service.
Hopefully this has been resolved in .NET 3.0 and WCF?
Colin Freela...
Member
14 Points
2 Posts
Re: error when instantiating a web services
Jun 10, 2010 11:37 PM|LINK
I had a similar issue adding a TestTrack Pro web reference to VS 2008. I got the error "'date' is an invalid value for the SoapElementAttribute.DataType property. The property may only be specified for primitive types." my fix is at http://bit.ly/bsMQaB
I know this is too late to help you but hopefully it helps someone else.
nizam133
Contributor
3538 Points
638 Posts
Re: error when instantiating a web services
Jul 12, 2010 08:24 PM|LINK
hey checkout this link
http://support.microsoft.com/kb/311327
serggusak
Member
2 Points
1 Post
Re: error when instantiating a web services
Aug 25, 2011 11:44 AM|LINK
Replacing xsd:date with xsd:dateTime in the WSDL seems to work for me. I think it's a better solution because in theory it should keep null dates working.