Search This Blog

November 24, 2014

Fixed the WCF issue: When the third digit of Milliseconds is 0, it doesn’t appear In WCF response format

Today one test failed in SOAtest. After looking into this interesting issue, we noticed that it was related to Milliseconds with 2 or 3 digits in WCF response format.

  2014-11-14T16:12:01.107

  2014-11-05T12:01:07.43

In DB, when using the SQL query of RTRIM(CONVERT(char(25),FieldName,127)), I could see Milliseconds with 3 digits all the time:

2014-11-14T16:12:01.107

2014-11-05T12:01:07.430


It means in WCF response format, when the third digit is 0, it is ignored and does not appear. It makes our verification test failed.

The quick workaround to fix this issue is to use Case When in SQL query.

After adding this condition in SQL query, all tests in SOAtest pass without any issue.

(CASE WHEN (CONVERT(char(25),FieldName,127) LIKE '%0')  
      THEN RTRIM(CONVERT(char(22), FieldName,127))
      ELSE RTRIM(CONVERT(char(25), FieldName,127))
 ENDAS RequestDate



No comments: