public static Dictionary <string, string> DoRequest(string url, Dictionary <string, string> postParameters)
{
string postData = postParameters == null ? "" : CommunicationHelpers.SerializeDictionary(postParameters);
String str = String.Empty;
#region // Debug
#if DEBUG
m_log.Debug("[OMECONOMY] Request: " + url + "?" + postData);
#endif
#endregion
try
{
#if INSOMNIA
ServicePointManager.ServerCertificateValidationCallback = delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };
#endif
str = SynchronousRestFormsRequester.MakeRequest("POST", url, postData, 20000);
#region // Debug
#if DEBUG
string meth = "";
if ((postParameters != null) && !postParameters.TryGetValue("method", out meth))
{
meth = "";
}
m_log.DebugFormat("[OMECONOMY] Response {0}: {1}", meth, str.Trim());
#endif
#endregion
Dictionary <string, string> returnValue = JsonMapper.ToObject <Dictionary <string, string> >(str);
return(returnValue != null ? returnValue : new Dictionary <string, string>());
}
catch (Exception e)
{
m_log.ErrorFormat("[OMECONOMY]: Could not parse response Exception: {0} - {1}", e.Message, e.StackTrace);
return(null);
}
}