0

I'm trying to use the WCF Oracle adapter to insert data in an Oracle table. The table has a DateTime field. I set the field's value in an orchestration, using a distinguished field, then send the message to a send port configured to use the WCF Oracle adapter.

This gives me the following error when the message is sent to Oracle:

Value for the field is invalid. DateTime.Kind must be DateTimeKind.Unspecified. Ensure that there is no TimeZone or TimeZoneOffset contained in the DateTime value.

I tried to use this to force the DateTimeKind to be unspecified:

msg.ProcessedDateTime = System.DateTime.SpecifyKind(
    System.DateTime.Now.ToLocalTime(), 
    System.DateTimeKind.Unspecified); 

but I still get the same error message.

I can also see that the XML generated for this message uses the following format for dates: yyyy-MM-ddTHH:mm:ss.ffffffZ

The problem seems to be with the Z at the end of the string, which specifies a time zone (GMT+0)

I can't simply assign to the "ProcessedDateTime" property an arbitrary string (with a format I could control), because the schema defines the field as a xs:dateTime, so an orchestration requires that I use a System.DateTime value.

How can I force the System.DateTime representation to not contain any time zone information? Note that I can't control the representation directly, since the DateTime is converted to a string by BizTalk, not by my code.

ckarras
  • 4,786
  • 2
  • 30
  • 36

1 Answers1

0

A workaround I found was to have a map/xslt/pipeline in the send port that reformats the datetime in the format expected by Oracle. So the orchestration still writes the date with the time zone, but it is removed before being sent to Oracle.

ckarras
  • 4,786
  • 2
  • 30
  • 36