Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>xml-rpc.net certainly takes a System.Datetime and converts to dateTime.iso8601. A gotcha I had was with the various interpretations of dateTime.iso8601. From your xml template, your datetime output is supported (20101117T09:42:00) and you won't have the same problem. I had a very strict upstream server that wanted some offset (e.g +001) and I had to extend and pass a datetime format to xml-rpc.net.</p> <p><strong>Edit</strong></p> <p>Yea I modified the code to achieve the new DateTimeFormat. I downloaded the source and made the following modifications (I wish it was better hosted and one could offer a modification).</p> <p>There is an XmlRpcSerializer.cs, which is where the serialization of the type to xml-rpc format happens. The method you need is naturally...</p> <pre><code>void Serialize( XmlWriter xtw, Object o, MappingActions mappingActions, List&lt;object&gt; nestedObjs) </code></pre> <p>Somewhere in this method, is a check for XmlRpcType.tDateTime:</p> <pre><code>else if (xType == XmlRpcType.tDateTime) { DateTime dt = (DateTime)o; //The following line is what you need, if a custom DateTime format was supplied, to override the default string sdt = dt.ToString((string.IsNullOrEmpty(DateTimeFormat) ? "yyyyMMdd'T'HH':'mm':'ss" : DateTimeFormat), DateTimeFormatInfo.InvariantInfo); WriteFullElementString(xtw, "dateTime.iso8601", sdt); } </code></pre> <p>The rest of the story is how to pass the custom datetime format to the XmlRpcSerializer class. You could just add a property to this class to make it happen. There is an XmlRpcFormatSettings that could be used but that's up to you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload