internal override void Post(IQObject apiAction) { XElement parent = new XElement("qdbapi"); apiAction.BuildXmlPayload(ref parent); var bytes = Encoding.UTF8.GetBytes(parent.ToString()); Stream requestStream = null; WebResponse webResponse = null; Stream responseStream = null; string text; try { var request = (HttpWebRequest)WebRequest.Create(apiAction.Uri); request.Method = METHOD; request.ProtocolVersion = HttpVersion.Version10; request.ContentType = CONTENT_TYPE; request.ContentLength = bytes.Length; request.KeepAlive = false; request.Timeout = 300000; request.Headers.Add(QUICKBASE_HEADER + apiAction.Action); requestStream = request.GetRequestStream(); requestStream.Write(bytes, 0, bytes.Length); webResponse = request.GetResponse(); responseStream = webResponse.GetResponseStream(); text = new StreamReader(responseStream).ReadToEnd(); } finally { if (requestStream != null) { requestStream.Close(); } if (responseStream != null) { responseStream.Close(); } if (webResponse != null) { webResponse.Close(); } } Response = XElement.Parse("<?xml version=\"1.0\"?><response_data><![CDATA[" + text + "]]></response_data>"); }
internal override void Post(IQObject qObject) { XElement parent = new XElement("qdbapi");; qObject.BuildXmlPayload(ref parent); var bytes = Encoding.UTF8.GetBytes(parent.ToString()); //File.AppendAllText(@"C:\Temp\QBDebugLog.txt", "**Sent->>" + qObject.Uri + " " + QUICKBASE_HEADER + qObject.Action + "\r\n" + qObject.XmlPayload + "\r\n"); Stream requestStream = null; WebResponse webResponse = null; Stream responseStream = null; XElement xml; try { var request = (HttpWebRequest)WebRequest.Create(qObject.Uri); request.Method = METHOD; request.ProtocolVersion = HttpVersion.Version11; request.ContentType = CONTENT_TYPE; request.ContentLength = bytes.Length; request.KeepAlive = false; request.Timeout = 300000; request.Headers.Add(QUICKBASE_HEADER + qObject.Action); requestStream = request.GetRequestStream(); requestStream.Write(bytes, 0, bytes.Length); webResponse = request.GetResponse(); responseStream = webResponse.GetResponseStream(); xml = XElement.Load(responseStream); //File.AppendAllText(@"C:\Temp\QBDebugLog.txt", "**Received-<<\r\n" + xml.CreateNavigator().InnerXml + "\r\n"); } finally { requestStream?.Close(); responseStream?.Close(); webResponse?.Close(); } Http.CheckForException(xml); Response = xml; }