Jump to content
Sign in to follow this  
Anders Melander

SOAP cookie with Expires=Fri, 31-dec-9999 23:59 causes EConvertError - Invalid argument to date encode

Recommended Posts

It seems that the Delphi SOAP framework is unable to handle SOAP responses that contain cookies with Expired=Fri, 31-dec-9999 23:59 GMT.

 

Is this a known problem?

 

The web service that sends this response in my case is the Microsoft Terminology Service.

While there seem to be some disagreement about whether the year 9999 is out of range (some say 2038 is the maximum allowed value), the value so common that Delphi should be able to handle it. Under any circumstance the reason that Delphi fails to handle to value is clearly not by design - i.e. it's a bug.
Here's what happens:

  1. The client (the Delphi application) sends a request to the SOAP server.
  2. The SOAP server responds.
    The response contains a cookie with an expiration time of "Fri, 31-dec-9999 23:59 GMT".
  3. The Delphi SOAP framework converts the expiration date to the local timezone (CET in my case).
    The result is 31-dec-10000 01:59.
  4. The value 31-dec-10000 is passed to SysUtils.EncodeDate but because the year value is outside the allowed TDateTime range (1-9999) this fails with an EConvertError exception: Invalid argument to date encode.

I have not been able to find a way to work around the problem.

Share this post


Link to post
Guest

SOAP problems esp. regarding M$, IMHE is best handled compiling a dll using visual studio and then importing that. AtoZ has a Crosstalk product that let's you call that dll, if you lack time to import it. Wrap edge case stuff in simpler dll exports. HTH

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×