Пример #1
0
        public static XmlDocument ConstructRegistryErrorResponse(string status, string requestId, string codeContext, string errorCode, string severity, string location)
        {
            XmlDocument       xmlDocRegistryResponse = null;
            RegistryErrorList objRegistryErrorList   = new RegistryErrorList();
            RegistryError     objRegistryError       = new RegistryError();

            objRegistryError.CodeContext = codeContext;
            objRegistryError.ErrorCode   = errorCode;
            objRegistryError.Location    = location;
            objRegistryError.Severity    = severity;

            objRegistryErrorList.RegistryErrors.Add(objRegistryError);

            xmlDocRegistryResponse = ConstructRegistryErrorResponse(status, requestId, objRegistryErrorList);

            return(xmlDocRegistryResponse);
        }
Пример #2
0
        public static XmlDocument ConstructRegistryErrorResponse(string status, string requestId, string codeContext, string errorCode, string severity, string location)
        {
            XmlDocument xmlDocRegistryResponse = null;
            RegistryErrorList objRegistryErrorList = new RegistryErrorList();
            RegistryError objRegistryError = new RegistryError();

            objRegistryError.CodeContext = codeContext;
            objRegistryError.ErrorCode = errorCode;
            objRegistryError.Location = location;
            objRegistryError.Severity = severity;

            objRegistryErrorList.RegistryErrors.Add(objRegistryError);

            xmlDocRegistryResponse = ConstructRegistryErrorResponse(status, requestId, objRegistryErrorList);

            return xmlDocRegistryResponse;
        }
Пример #3
0
        private ProvideAndRegisterResponse interrogateWCFResponse(Message wcfOutput)
        {
            // 
            //Logger.Debug("begin interrogateWCFResponse");
            ProvideAndRegisterResponse pandRResponse = new ProvideAndRegisterResponse();
            try
            {
                XmlDictionaryReader dictReader = wcfOutput.GetReaderAtBodyContents();
                XmlDocument resultsDOM = new XmlDocument();
                resultsDOM.Load(dictReader);

                // handle the response status
                pandRResponse.Status = resultsDOM.DocumentElement.Attributes.GetNamedItem("status").InnerXml;

                // add any registry errors
                XmlNode registryErrorList = resultsDOM.DocumentElement.SelectSingleNode("//*[local-name()='RegistryErrorList']");
                if (registryErrorList == null)
                {
                    pandRResponse.RegistryErrorList = null;
                }
                else  // process all of the registry errors
                {
                    XmlNodeList registryErrors = registryErrorList.SelectNodes("//*[local-name()='RegistryError']");
                    pandRResponse.RegistryErrorList = new RegistryErrorList();
                    pandRResponse.RegistryErrorList.RegistryErrors = new List<RegistryError>();
                    RegistryError theRegistryError = null;
                    XmlNode temp;

                    temp = registryErrorList.Attributes.GetNamedItem("highestSeverity");
                    if (temp != null)
                    {
                        pandRResponse.RegistryErrorList.HighestSeverity = temp.InnerXml;
                    }
                    else  // shouldn't happen....highest should be present
                    {
                        pandRResponse.RegistryErrorList.HighestSeverity = "";
                    } // fi highestSeverity attribute exists

                    foreach (XmlNode aRegError in registryErrors)
                    {
                        theRegistryError = new RegistryError();
                        temp = aRegError.Attributes.GetNamedItem("errorCode");
                        if (temp != null)
                        {
                            theRegistryError.ErrorCode = temp.InnerXml;
                        }
                        else  // should not happen....error code should be present
                        {
                            theRegistryError.ErrorCode = "";
                        } // fi

                        temp = aRegError.Attributes.GetNamedItem("codeContext");
                        if (temp != null)
                        {
                            theRegistryError.CodeContext = temp.InnerXml;
                        }
                        else
                        {
                            theRegistryError.CodeContext = "";  
                        } // fi

                        temp = aRegError.Attributes.GetNamedItem("location");
                        if (temp != null)
                        {
                            theRegistryError.Location = temp.InnerXml;
                        }
                        else
                        {
                            theRegistryError.Location = "";
                        } // fi

                        temp = aRegError.Attributes.GetNamedItem("severity");
                        if (temp != null)
                        {
                            theRegistryError.Severity = temp.InnerXml;
                        }
                        else
                        {
                            theRegistryError.Severity = "";
                        } // fi
                        
                        // highest severity
                        if (string.IsNullOrEmpty(pandRResponse.RegistryErrorList.HighestSeverity))
                        {
                            pandRResponse.RegistryErrorList.HighestSeverity = theRegistryError.Severity;
                        }
                        else
                        {
                            //
                            if (pandRResponse.RegistryErrorList.HighestSeverity != GlobalValues.CONST_SEVERITY_TYPE_ERROR)
                            {
                                pandRResponse.RegistryErrorList.HighestSeverity = theRegistryError.Severity;
                            }
                        }

                        // add to the registry error list
                        pandRResponse.RegistryErrorList.RegistryErrors.Add(theRegistryError);
                    }

                }  // fi some registry errors
            }
            catch (Exception ex)
            {
                //Logger.Error(string.Format("interrogateWCFResponse catches error: {0}; stack: {1}", ex.Message, ex.StackTrace));
                pandRResponse = errorResponse(GlobalValues.CONST_ERROR_CODE_XDSRepositoryError, string.Format("error: {0}; stacktrace{1}", ex.Message, ex.StackTrace));
                //throw;
            }
            //Logger.Debug("end interrogateWCFResponse");
            return pandRResponse;
        }