示例#1
0
        /// <summary>
        /// Преобразовать SOAP ответ с ошибкой в ответ для службы
        /// </summary>
        /// <param name="response">SOAP ответ</param>
        /// <returns></returns>
        private AccountLegendNResult ErrorResponse(SOAPResponse response, string server)
        {
            AccountLegendNResult result = new AccountLegendNResult()
            {
                AccountLegends = new AccountLegend[0],
                Errors         = response.Errors
            };

            return(result);
        }
示例#2
0
        /// <summary>
        /// Получить данные с веб сервиса
        /// </summary>
        /// <param name="server">Сервер</param>
        /// <param name="requestString">Строка запроса</param>
        /// <returns></returns>
        private AccountLegendNResult GetMethodData(string server, string requestString)
        {
            AccountLegendNResult result;

            SOAPResponse response = GetDataFromWebService(_UserName, _UserPassword, requestString, server);

            if (response.Errors.Length != 0)
            {
                result = ErrorResponse(response, server);
            }
            else
            {
                result = SuccessResponse(response, server);
            }

            return(result);
        }
示例#3
0
        /// <summary>
        /// Преобразовать успешный SOAP ответ в ответ для службы
        /// </summary>
        /// <param name="response">SOAP ответ</param>
        /// <returns></returns>
        private AccountLegendNResult SuccessResponse(SOAPResponse response, string server)
        {
            SOAPResponseGetAccountsList soapResponseObject = default;

            try {
                soapResponseObject = DeserializeResponse <SOAPResponseGetAccountsList>(response.Response);
            }
            catch (Exception ex) {
                return(ErrorResponse(ex.Message));
            }

            AccountLegend[]      sbList = soapResponseObject?.Body?.GetAccountsListResponse?.Return?.AccountLegends ?? new AccountLegend[0];
            AccountLegendNResult result = new AccountLegendNResult {
                AccountLegends = sbList,
                Errors         = new string[0]
            };

            return(result);
        }