473,386 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

string not recognized as valid datetime

I'm connecting to a java web service that defines the following complex type
in the wsdl

<xs:complexType name="employee">
<xs:sequence>
<xs:element minOccurs="0" name="firstName" type="xs:string" />
<xs:element minOccurs="0" name="hireDate" type="xs:date" />
<xs:element minOccurs="0" name="lastName" type="xs:string" />
<xs:element minOccurs="0" name="terminationDate" type="xs:date" />
</xs:sequence>
</xs:complexType>

When the type is marshalled to my VS2005 generated proxy the java web
service will omit the terminationDate in the soap message. The proxy then
throws the "string not recognized as valid datetime" error. The proxy code
for the field is copied below. How can I get the proxy to marshal this
type? Shouldn't it set the terminationDateField to 0 and set
terminationDateSpecified=false?
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified,
DataType="date")]
public System.DateTime terminationDate {
get {return this.terminationDateField;}
set {this.terminationDateField = value;}
}

[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool terminationDateSpecified {
get {
return this.terminationDateFieldSpecified;
}
set {
this.terminationDateFieldSpecified = value;
}
}
Jul 12 '07 #1
1 5996
Found the issue. The termination dates where passed as
'2007-001-01T00:00:00-3:00' in the response message and the xsd and proxy
are typed as 'date' and not 'dateTime'.

"Scott Holman" <sh*****@micros.comwrote in message
news:OW*************@TK2MSFTNGP05.phx.gbl...
I'm connecting to a java web service that defines the following complex
type in the wsdl

<xs:complexType name="employee">
<xs:sequence>
<xs:element minOccurs="0" name="firstName" type="xs:string" />
<xs:element minOccurs="0" name="hireDate" type="xs:date" />
<xs:element minOccurs="0" name="lastName" type="xs:string" />
<xs:element minOccurs="0" name="terminationDate" type="xs:date" />
</xs:sequence>
</xs:complexType>

When the type is marshalled to my VS2005 generated proxy the java web
service will omit the terminationDate in the soap message. The proxy then
throws the "string not recognized as valid datetime" error. The proxy
code for the field is copied below. How can I get the proxy to marshal
this type? Shouldn't it set the terminationDateField to 0 and set
terminationDateSpecified=false?
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified,
DataType="date")]
public System.DateTime terminationDate {
get {return this.terminationDateField;}
set {this.terminationDateField = value;}
}

[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool terminationDateSpecified {
get {
return this.terminationDateFieldSpecified;
}
set {
this.terminationDateFieldSpecified = value;
}
}

Jul 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RSH | last post by:
I am having a bit of trouble filling a datatable with a query. I'm getting the error message: System.FormatException: String was not recognized as a valid DateTime. at...
6
by: Rookie Card | last post by:
I know this is a very common issue but cannot find a thread that resolves the issue. I need to re-format my dates to "MMM d, yyyy". The problem I have is I have an MSSQL database that allows...
11
by: Bob Day | last post by:
The IsDate code below should result in False, instead it throws the exception below. Why? How do I check if a string can be converted to a date if this function does not work properly? Bob ...
1
by: database | last post by:
I AM FACING A PROBLEM WHEN I ACCESS ONE OF THE PAGES. IT USED TO WORK BEFORE BUT AFTER RESTARTING THE APPLICATION SEVER IT GIVES THE FOLLOWING ERROR. - Server Error ...
10
by: mercea | last post by:
hi all, i'm trying to insert the time/date a button was clicked on a gridview and it generates an error:the string was not recognized as a valid DateTime.There is an unknown word starting at index 0...
0
by: Andres Bohren | last post by:
Hi i have a GridView and have Problems to put the values into the right Datatypes. Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As...
4
by: dhanashivam | last post by:
hi, in my web application i am getting date values from sql server database and store in the datatable. it works fine when i use the US culture. But when i change the culture to british i am...
1
by: Magnus.Moraberg | last post by:
Hi, I have the following event which checks if a cell in a dgv contains a date and if so, checks if it is formatted correctly. I don't think its good practice for be to try this by catching an...
3
by: lucindaa | last post by:
Hi, i have a string variable having date as following format "05-01-2010" when convert this date into DateTime Format i got the following error 'String was not recognized as a valid DateTime'...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.