Tuesday, March 16, 2010

WCF Oracle adapter: Field xxx has a value with time zone information set. Specify a value without time zone

Problem

I tried to call a Oracle stored procedure from orchestration with WCF Oracle Adapter.

My source message contains a date element like this <deliveryDate>2010-03-17T16:20:34.252125+02:00</deliveryDate> and when I put that value to destination message which is sent to Oracle: <DELIVERYDATE>2010-03-15T16:20:34.2365000Z</DELIVERYDATE>

I got an error "Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: Field DELIVERYDATE has a value with time zone information set. Specify a value without time zone.


Solution
Destination messsage date value should be modified to XML date format without timezone:

DateTime date = XmlConvert.ToDateTime(xmldate, XmlDateTimeSerializationMode.Unspecified);
DestinationElementValue = date.ToString("yyyy-MM-ddThh:mm:ss"));

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. thanks for info !

    ReplyDelete