Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2008

Tip: Looking for answers? Try searching our database.

Invalid xml and 400 Bad Request

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Laan - 20 Mar 2008 14:47 GMT
Does anyone know why an ASP.NET web service considers this to be invalid
xml:
<endTime>9999-12-31T23:59:59.9999999</endTime>

while this works:
<endTime>9999-12-31T23:59:59.9999999+01:00</endTime>

this also works:
<endTime>2008-03-21T00:00:00</endTime>

The first example is sent from a 3.5 winform client with DateTime.Max as
endTime. Here's the complete xml:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><CesHeader
xmlns="http://mynta.se/ces/order/LogService"><culture>sv-SE</culture><timeZone>W.
Europe Standard
Time</timeZone></CesHeader></soap:Header><soap:Body><GetLogEntries
xmlns="http://mynta.se/ces/order/LogService"><type /><category /><channel
/><servicePacket /><status /><companyName
/><accountOwnerId>-1</accountOwnerId><accountOwnerFirstName
/><accountOwnerLastName
/><accountId>-1</accountId><startTime>2008-03-19T00:00:00</startTime><endTime>9999-12-31T23:59:59.9999999</endTime><bookingId>-1</bookingId></GetLogEntries></soap:Body></soap:Envelope>

The second example is sent from a 1.1 winform client with DateTime.Max as
endTime. Here's the complete xml:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><CesHeader
xmlns="http://mynta.se/ces/order/LogService"><culture>sv-SE</culture><timeZone>W.
Europe Standard
Time</timeZone></CesHeader></soap:Header><soap:Body><GetLogEntries
xmlns="http://mynta.se/ces/order/LogService"><type /><category /><channel
/><servicePacket /><status /><companyName
/><accountOwnerId>-1</accountOwnerId><accountOwnerFirstName
/><accountOwnerLastName
/><accountId>-1</accountId><startTime>2008-03-20T00:00:00.0000000+01:00</startTime><endTime>9999-12-31T23:59:59.9999999+01:00</endTime><bookingId>-1</bookingId></GetLogEntries></soap:Body></soap:Envelope>

The third example is sent from a 3.5 winform client with a 'normal' date.
Here's the complete xml:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><CesHeader
xmlns="http://mynta.se/ces/order/LogService"><culture>sv-SE</culture><timeZone>W.
Europe Standard
Time</timeZone></CesHeader></soap:Header><soap:Body><GetLogEntries
xmlns="http://mynta.se/ces/order/LogService"><type /><category /><channel
/><servicePacket /><status /><companyName
/><accountOwnerId>-1</accountOwnerId><accountOwnerFirstName
/><accountOwnerLastName
/><accountId>-1</accountId><startTime>2008-03-20T00:00:00</startTime><endTime>2008-03-21T00:00:00</endTime><bookingId>-1</bookingId></GetLogEntries></soap:Body></soap:Envelope>

The 3.5 client is just the 1.1 client converted to 3.5.

I get either a 400 Bad Request (when compiling the web service under 3.5)
and a 500 internal server error with the message: 'Element' is an invalid
node type. Line 1 position 713 (when compiled under 1.1). Anyone have any
ideas?

Peter
Tiago Halm - 24 Mar 2008 20:41 GMT
AFAIK ASMX uses .NET serialization and DateTime format (serialization
included probably) changed from 1.x to 2.0 (from a CLR perspective). This
may be the cause to the issue you're seeing.

Tiago Halm

> Does anyone know why an ASP.NET web service considers this to be invalid
> xml:
[quoted text clipped - 59 lines]
>
> Peter
Peter Laan - 28 Mar 2008 16:58 GMT
But I get an error even if both the client and web service is running .Net
3.5. It's easy to avoid the problem by sending some other value than
DateTime.MaxValue though. So it's not a big problem, I'm just curious.

Peter

> AFAIK ASMX uses .NET serialization and DateTime format (serialization
> included probably) changed from 1.x to 2.0 (from a CLR perspective). This
[quoted text clipped - 11 lines]
>> this also works:
>> <endTime>2008-03-21T00:00:00</endTime>

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.