protected override void ValidateRequest(string requestId)
        {
            base.ValidateRequest(requestId);

            TryGetParameter(_dataRequest, PARAM_USE_SUBMISSION_HISTORY_TABLE_KEY, 0, ref _useSubmissionHistoryTable);

            if (TryGetParameter(_dataRequest, PARAM_NAAS_SUBMIT_USERNAME, 1, ref _submitUsername))
            {
                if (_naasUsernameToPasswordMap == null)
                {
                    throw new ArgumentException(string.Format("A request parameter \"{0}\" = \"{1}\" was specified, but the service does not specify a \"{2}\" config parameter",
                                                              PARAM_NAAS_SUBMIT_USERNAME, _submitUsername, CONFIG_NAAS_USER_MAPPING_FILE_PATH));
                }
                if (!_naasUsernameToPasswordMap.ContainsKey(_submitUsername.ToUpper()))
                {
                    throw new ArgumentException(string.Format("A request parameter \"{0}\" = \"{1}\" was specified, but the username was not found in the mapping file specified by the \"{2}\" config parameter",
                                                              PARAM_NAAS_SUBMIT_USERNAME, _submitUsername, CONFIG_NAAS_USER_MAPPING_FILE_PATH));
                }
                UserSubmitInfo userSubmitInfo = _naasUsernameToPasswordMap[_submitUsername.ToUpper()];
                _rcraInfoUserId = userSubmitInfo.RCRAInfoUserID;
                AppendAuditLogEvent("{0}: {1}", PARAM_NAAS_SUBMIT_USERNAME, _submitUsername);
            }
            else
            {
                AppendAuditLogEvent("{0} was not specified", PARAM_NAAS_SUBMIT_USERNAME);
            }
        }
        public string SubmitFile(string filePath, string localTransactionId)
        {
            string transactionId;

            try
            {
                UserSubmitInfo userSubmitInfo = _naasUsernameToPasswordMap[_submitUsername.ToUpper()];
                AppendAuditLogEvent("Submitting results to endpoint \"{0}\" using NAAS account: \"{1}\"", _submitPartnerNode.Name,
                                    _submitUsername);
                string networkFlowName = RCRABaseSolicitProcessor.RCRA_FLOW_NAME, networkFlowOperation = null;
                try
                {
                    using (INodeEndpointClient endpointClient = _nodeEndpointClientFactory.Make(_submitPartnerNode.Url, _submitPartnerNode.Version,
                                                                                                new AuthenticationCredentials(_submitUsername, userSubmitInfo.Password)))
                    {
                        if (endpointClient.Version == EndpointVersionType.EN20)
                        {
                            IList <string> notificationUris = null;
                            if (!string.IsNullOrEmpty(_notifications))
                            {
                                notificationUris = StringUtils.SplitAndReallyRemoveEmptyEntries(_notifications, ',', ';');
                            }
                            transactionId =
                                endpointClient.Submit(networkFlowName, "default",
                                                      string.Empty, notificationUris, new string[] { filePath });
                            networkFlowOperation = "default";
                        }
                        else
                        {
                            transactionId =
                                endpointClient.Submit(networkFlowName, null, new string[] { filePath });
                        }
                    }
                    AppendAuditLogEvent("Successfully submitted results to endpoint \"{0}\" with returned transaction id \"{1}\"",
                                        _submitPartnerNode.Name, transactionId);
                }
                catch (Exception e)
                {
                    AppendAuditLogEvent("Failed to submit results to endpoint \"{0}\": {1}",
                                        _submitPartnerNode.Name, ExceptionUtils.ToShortString(e));
                    throw;
                }
                _transactionManager.SetNetworkId(localTransactionId, transactionId, _submitPartnerNode.Version,
                                                 _submitPartnerNode.Url, networkFlowName, networkFlowOperation);
            }
            catch (Exception e)
            {
                AppendAuditLogEvent("Failed to submit results to endpoint \"{0}\" with exception: {1}",
                                    _submitPartnerNode.Name, ExceptionUtils.ToShortString(e));
                throw;
            }
            finally
            {
                FileUtils.SafeDeleteFile(filePath);
            }
            return(transactionId);
        }
        public void ProcessSolicit(string requestId)
        {
            LOG.DebugEnter(MethodBase.GetCurrentMethod(), requestId);

            LazyInit();

            _dataRequest = _requestManager.GetDataRequest(requestId);

            if (TryGetParameter(_dataRequest, PARAM_NAAS_SUBMIT_USERNAME, 0, ref _submitUsername))
            {
                if (_naasUsernameToPasswordMap == null)
                {
                    throw new ArgumentException(string.Format("A request parameter \"{0}\" = \"{1}\" was specified, but the service does not specify a \"{2}\" config parameter",
                                                              PARAM_NAAS_SUBMIT_USERNAME, _submitUsername, CONFIG_NAAS_USER_MAPPING_FILE_PATH));
                }
                if (!_naasUsernameToPasswordMap.ContainsKey(_submitUsername.ToUpper()))
                {
                    throw new ArgumentException(string.Format("A request parameter \"{0}\" = \"{1}\" was specified, but the username was not found in the mapping file specified by the \"{2}\" config parameter",
                                                              PARAM_NAAS_SUBMIT_USERNAME, _submitUsername, CONFIG_NAAS_USER_MAPPING_FILE_PATH));
                }
                UserSubmitInfo userSubmitInfo = _naasUsernameToPasswordMap[_submitUsername.ToUpper()];
                _rcraInfoUserId = userSubmitInfo.RCRAInfoUserID;
            }

            object returnData = GetObjectFromRequest(_dataRequest);

            string serializedFilePath = null;

            if (_addHeader)
            {
                LOG.Debug("Serializing results and making header...");
                AppendAuditLogEvent("Serializing results and making header...");
                serializedFilePath = MakeHeaderFile(returnData);
            }
            else
            {
                LOG.Debug("Serializing results to file...");
                AppendAuditLogEvent("Serializing results to file...");
                serializedFilePath = _serializationHelper.SerializeToTempFile(returnData);
                if (_validateXml)
                {
                    ValidateXmlFileAndAttachErrorsAndFileToTransaction(serializedFilePath, "xml_schema.xml_schema.zip",
                                                                       null, _dataRequest.TransactionId);
                }
            }

            LOG.Debug("Serialized file path: " + serializedFilePath);
            AppendAuditLogEvent("Serialized file path: " + serializedFilePath);

            LOG.Debug("Compressing serialized file...");
            AppendAuditLogEvent("Compressing serialized file...");
            string compressedFilePath = _compressionHelper.CompressFile(serializedFilePath);

            LOG.Debug("Compressed file path: " + compressedFilePath);
            AppendAuditLogEvent("Compressed file path: " + compressedFilePath);

            LOG.Debug("Adding document...");
            AppendAuditLogEvent("Adding document...");
            _documentManager.AddDocument(_dataRequest.TransactionId,
                                         CommonTransactionStatusCode.Processed,
                                         "Request Processed: " + _dataRequest.ToString(),
                                         compressedFilePath);

            if (_submitUsername != null)
            {
                SubmitFile(compressedFilePath, _dataRequest.TransactionId);
            }
            LOG.Debug("OK");
            AppendAuditLogEvent("ProcessQuery: OK");
        }