Hello guys.
i write my first c# program for fhir. I installed Fhir.DSTU2.Core v.0.90.4
so there is my code:
var client = new FhirClient(EndPoint);
HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Reload);
client.OnBeforeRequest += (object sl, BeforeRequestEventArgs e1) =>
{
// Replace with a valid bearer token for the server
e1.RawRequest.Headers.Add("authorization", "N3 " + miacGuid);
e1.RawRequest.Headers.Add("LastModified", System.DateTime.Now.ToString("O"));
e1.RawRequest.CachePolicy = noCachePolicy;
e1.RawRequest.ContentType = "application/json";
// e1.RawRequest.Date = System.DateTime.UtcNow;
//e1.RawRequest.Headers..Add("content-type", "application/json");
};
client.PreferredFormat = ResourceFormat.Json;//xml
client.UseFormatParam = false;
client.ReturnFullResource = true;
client.Timeout = 60000;
try
{
var t=client.Get(EndPoint+"Patient/a6bfef9f-fd80-4c7b-b6c2-5c55ed842e6b");
}
catch
{}
so a have a problem:
System.ArgumentOutOfRangeException: The Year, Month, and Day parameters describe an unrepresentable DateTime value.
BUT in Fiddler i have
HTTP/1.1 200 OK and get data.
another mistake is
System.Net.ProtocolViolationException: The date string value in the header is not valid.
в System.Net.HttpProtocolUtils.string2date(String S)
BUT in Fiddler i have HTTP/1.1 200 OK and get data.
i think that is something wrong in my preconfig of client or my c#.
Thanks