I thought I would post this since I have run into this several times,...
Many times when accessing a Webservice from .net you use the Proxy classes that are auto generated... This can cause an issue with DateTime fields and you will get the
Processing Error. Details in WS Error Log (transaction SRT_UTIL, note 1558107) by selection with UTC timestamp 20121018164542
After the Whole Process of getting the Log via an incident ( I WISH I HAD ACCESS TO IT... I heard 4.0 does but can not find it anywhere)
you will find this entry
| The value 2012-08-16T00:00:00 is not a valid date with time. It does not correspond to the XML format for ABAP. |
ABAP uses ISO 8601 See http://en.wikipedia.org/wiki/ISO_8601
This is Bothersome since you are using the Proxy Classes in .net.... and the serialization of a date time does not include the "Z" or offset time zone and ABAP requires this. Even though the LOCALNORMALISED_DateTime1 Time has a Timezone Component
To remedy this I took the following approach... (I am sure there is a better way and If you have one please Let me know)
in the Proxy Classes I found the LOCALNORMALISED_DateTime1 definition
(AHHH VB.net... I know but that is how I roll :wink: )
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(TypeName:="LOCALNORMALISED_DateTime", [Namespace]:="http://sap.com/xi/BASIS/Global")> _
Partial Public Class LOCALNORMALISED_DateTime1
Private timeZoneCodeField As String
Private valueField As Date
'''<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="token")> _
Public Property timeZoneCode() As String
Get
Return Me.timeZoneCodeField
End Get
Set
Me.timeZoneCodeField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlTextAttribute()> _
Public Property Value() As Date
Get
Return Me.valueField
End Get
Set
Me.valueField = Value
End Set
End Property
End ClassSo I changed this to
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(TypeName:="LOCALNORMALISED_DateTime", [Namespace]:="http://sap.com/xi/BASIS/Global")> _
Partial Public Class LOCALNORMALISED_DateTime1
Private timeZoneCodeField As String
Private valueField As String ''<----------------------------------
'''<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="token")> _
Public Property timeZoneCode() As String
Get
Return Me.timeZoneCodeField
End Get
Set
Me.timeZoneCodeField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlTextAttribute()> _
Public Property Value() As Date
Get
Return Me.valueField
End Get
Set
Me.valueField = Value.ToString("s") & "Z" ''<----------------------------------
End Set
End Property
End ClassThe Z is there because
If the time is in UTC, add a 'Z' directly after the time without a space. 'Z' is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "0930Z". "14:45:15 UTC" would be "14:45:15Z" or "144515Z".
And that did the Trick...
Note that with this all my times need to be in UTC...... I could change the Fromat to do an offset time form the "Z" component of the time by the following
Dim hours As Integer = TimeZoneInfo.Local.BaseUtcOffset.Hours
Dim offset As String = String.Format("{0}{1}", (If((hours > 0), "+", "")), hours.ToString("00"))
Dim isoformat As String = DateTime.Now.ToString("s") & offsetFINAL BIG NOTE Updating the WSDL or Webreference will Override these changes... So Be aware of that....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 3143 | |
| 1916 | |
| 1916 | |
| 1213 | |
| 1081 | |
| 757 | |
| 755 | |
| 742 |