public static void ProcedureU() { try { String requestFile = @"Company.XML"; String signatureFile = @"Company.XML.sig"; String resultComment; String code; Int64 ldd = ZapretSOAPServices.LastDumpDate(); Int64 LastDumpDate = 0; DateTime LastDumpDt = (new DateTime(1970, 1, 1, 0, 0, 0, 0)).AddSeconds(ldd / 1000); Logging("getLastDumpDate (дата последнего дампа): " + LastDumpDt.ToString("yyyy-MM-dd HH:mm:ss")); if (ldd != LastDumpDate) { LastDumpDate = ldd; Logging("Отправляю файлы :" + requestFile + " и " + signatureFile + "\n"); if (ZapretSOAPServices.SendRequest(out resultComment, out code, File.ReadAllBytes(requestFile), File.ReadAllBytes(signatureFile))) { Logging("Ответ сервера на SendRequest: resultComment = " + resultComment + ", code = " + code); string MyFileName = @"BlackListCompanyConsole.code"; FileStream fs = new FileStream(MyFileName, FileMode.OpenOrCreate); StreamWriter sw = new StreamWriter(fs, Encoding.GetEncoding("Windows-1251")); sw.Write(code); sw.Close(); fs.Close(); } } } catch (Exception) { Logging("Ошибка при отправке запроса"); } }
public static void ProcedureD() { try { string code = System.IO.File.ReadAllText(@"BlackListCompanyConsole.code"); Byte[] registerZipArchive; String registerZipArchivePath = @"register.zip"; String resultComment; Logging("Проверяем статус по коду: " + code); ZapretSOAPServices.GetResult(out resultComment, out registerZipArchive, code); Logging("Ответ сервера на GetResult: resultComment = " + resultComment); if (resultComment != "запрос обрабатывается") { File.WriteAllBytes(registerZipArchivePath, registerZipArchive); Logging("Файл register.zip сохранен"); } } catch (Exception) { Logging("Ошибка при получении ответа от сервера"); } }