public void retrieve(int connId, string method, string url, string postData, string[] headerKeys, string[] headerVals)
        {
            try
            {
                _LastReq = new ReqVals(connId, method, url, postData, headerKeys, headerVals);
                isGet    = "GET".Equals(method);
                if (!isGet)
                {
                    if (!"POST".Equals(method) && !"PUT".Equals(method))
                    {
                        throw new InvalidOperationException(method + " is not a valid method, only GET, POST or PUT supported");
                    }
                }
                if (postData != null && !isGet)
                {
                    toPost = postData.ToString();
                }

                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
                for (var i = 0; i < headerKeys.Length; i++)
                {
                    var key = headerKeys[i];
                    var val = headerVals[i];

                    if ("content-type".Equals(key, StringComparison.InvariantCultureIgnoreCase))
                    {
                        req.ContentType = val;
                    }
                    else
                    {
                        req.Headers[key] = val;
                    }
                }

                req.Method = method;
                PerformRequest(req);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
            }
        }
 private void _retrieve(ReqVals req)
 {
     retrieve(req._ConnId, req._Method, req._Url, req._PostData, req._HeaderKeys, req._HeaderVals);
 }