problem in reading DateTime from webservice

  • Thread starter Thread starter pranesh.nayak
  • Start date Start date
P

pranesh.nayak

I'm facing an error:"String was not recognized as a valid DateTime"
whille accessing DateTime from webservice.

And when I try to set DateTime to the same webservice it fails with
error:"Date value is of wrong type"

it looks like xs:DateTime is not compatible with .Net DateType. Any
suggestions on how to fix this without touching the webservice (3rd
party webservice)?

Thanks
 
Let me guess that you need to use XmlConvert.ToDateTime to get the DateTime
in the XML format.
If it doesn't help could you show a short but complete code demonstrating
the problem?

I'm facing an error:"String was not recognized as a valid DateTime"
whille accessing DateTime from webservice.

And when I try to set DateTime to the same webservice it fails with
error:"Date value is of wrong type"

it looks like xs:DateTime is not compatible with .Net DateType. Any
suggestions on how to fix this without touching the webservice (3rd
party webservice)?

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
my code is somethign like this...

Employee E = WS.GetEmployess(<emp id>)
// Error: String was not recognized as a valid DateTime

DateTime is returned by one of the property of type Employee.
ie E.JoiningDate

The code fails when i call GetEmployess, So i cant use xmlConvert in
this case.


Also when I set value to E.JoiningDate and call CreatenewEmployee it
fails again ..
Employee E = new Employee();
E.JoiningDate = DateTime;
WS.CreatenewEmployee(E);
// error: Date value is of wrong type

Please let me know if you have any idea abt this. I need a soluiotn for
2nd problem(error: Date value is of wrong type) as its very urgent
now..

Please not that i cant touch webservice code.

-Thanks
 
my code is somethign like this...
Employee E = WS.GetEmployess(<emp id>)
// Error: String was not recognized as a valid DateTime

What exactly rise exception there?
DateTime is returned by one of the property of type Employee.
ie E.JoiningDate
The code fails when i call GetEmployess, So i cant use xmlConvert in
this case.
Also when I set value to E.JoiningDate and call CreatenewEmployee it
fails again ..
Employee E = new Employee();
E.JoiningDate = DateTime;

This you need to use smth like
E.JoiningDate = XmlConvert.ToDateTime(DateTime);
Please let me know if you have any idea abt this. I need a soluiotn for
2nd problem(error: Date value is of wrong type) as its very urgent
now..

Please not that i cant touch webservice code.

-Thanks

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
Back
Top