C# calling a Java web service with a Calendar parameter
<p>I'm writing a C# desktop client that needs to call a web service written in Java. Two of the parameters are of type Calendar. I'm having great difficulty in trying to pass these two dates to the web service.</p>

<p>I've tried the following ways, all without success.</p>

<pre><code>DateTime startDate = DateTime.Now;
DateTime endDate = startDate.AddDays(2);

DateTime startDate = new DateTime(2012, 3, 1, 1, 1, 1, DateTimeKind.Unspecified);
DateTime endDate = new DateTime(2012, 4, 1, 1, 1, 1, DateTimeKind.Unspecified);

DateTime startDate = new DateTime(2012, 3, 1, 1, 1, 1, DateTimeKind.Utc);
DateTime endDate = new DateTime(2012, 4, 1, 1, 1, 1, DateTimeKind.Utc);

DateTime startDate = new DateTime(2000, 1, 1, new System.Globalization.GregorianCalendar());
DateTime endDate = new DateTime(2012, 1, 1, new System.Globalization.GregorianCalendar());
</code></pre>

<p>I wrote a test Java client using the following code and this works...</p>

<pre><code>GregorianCalendar calStartDate = new GregorianCalendar();
GregorianCalendar calEndDate = new GregorianCalendar();

calStartDate.set(2011, 5, 21);
calEndDate.set(2012, 5, 24);

XMLGregorianCalendar startDate = dtf.newXMLGregorianCalendar(calStartDate);
XMLGregorianCalendar endDate = dtf.newXMLGregorianCalendar(calEndDate);
</code></pre>

<p>Any suggests as to how I can pass a Calendar parameter from C#?</p>

<p>Thanks!</p>
