public static void SearchTransactionOneByOne(string SearchType, string Class, string QueryType, string Query, Boolean saveFile, Boolean PersistOnDatabase, int Count = 1, string Limit = "None", int Offset = 1, string Culture = "en-CA", string Format = "STANDARD-XML") { string requestArguments = "?Format=" + Format + "&SearchType=" + SearchType + "&Class=" + Class + "&QueryType=" + QueryType + "&Query=" + String.Format("(ID={0})", Query) + "&Count=" + Count + "&Limit=" + Limit + "&Offset=" + Offset + "&Culture=" + Culture; string searchService = RetsUrl + "/Search.svc/Search" + requestArguments; httpWebRequest = (HttpWebRequest)WebRequest.Create(searchService); httpWebRequest.CookieContainer = cookieJar; //GRAB THE COOKIE httpWebRequest.Credentials = requestCredentials; //PASS CREDENTIALS DumpJson dump = DumpJson.Get(); try { using (HttpWebResponse httpResponse = httpWebRequest.GetResponse() as HttpWebResponse) { Stream stream = httpResponse.GetResponseStream(); // READ THE RESPONSE STREAM USING XMLTEXTREADER String Content = String.Empty; if (saveFile) { String filecomplete = String.Format(@"{0}\{1}.xml", AppSettings.GetAppSettings().load_folder, Query); using (Stream file = File.Create(filecomplete)) { CopyStream(stream, file); } Content = Archive.ReadFile(filecomplete); } else { Content = Treatment.StreamToString(stream); } //GetImages Quantity Content = Treatment.Replaces(Content); XmlSerializer serializer = new XmlSerializer(typeof(Idx)); using (TextReader reader = new StringReader(Content)) { Idx result = (Idx)serializer.Deserialize(reader); if (PersistOnDatabase) { result.Persist(dump); } Int32 TotalPhotos = Treatment.GetPhotosQuantity(result); for (int i = 0; i < TotalPhotos; i++) { GetImagesFromId(Query, Model.Type.TYPE_LARGET_PHOTO, String.Format("{0}", i)); } } } } catch (Exception ex) { Console.WriteLine(ex); } }