Re: Invalid xml and 400 Bad Request

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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

"Peter Laan" <plnews2000@xxxxxxxx> wrote in message
news:%23wfRHEpiIHA.5088@xxxxxxxxxxxxxxxxxxxxxxx
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




.



Relevant Pages

  • Invalid xml and 400 Bad Request
    ... Does anyone know why an ASP.NET web service considers this to be invalid ... Here's the complete xml: ... Europe Standard ... The second example is sent from a 1.1 winform client with DateTime.Max as ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: An Update to the Roadmap
    ... and have them saved in XML instead. ... dfm streaming is built into TPersistent. ... So advocate the goal (i.e. compatibility with .NET serialization), ...
    (borland.public.delphi.non-technical)