示例#1
0
        private XmlNode updateFacadeObject(string objectName, string objectKey, XmlNode oNode, bool isRetry)
        {
            String logMethodName = ".updateFacadeObject(string objectName, string objectKey, XmlNode oNode, bool isRetry) - ";

            _log.Debug(logMethodName + "Begin Method");

            XmlNode queryResults             = null;
            netForumXMLSoapClient xWebClient = null;

            try
            {
                //throw new CommunicationException();
                _log.Debug(logMethodName + "Creating netForumXMLSoapClient.");
                xWebClient = new netForumXMLSoapClient();
                _log.Debug(logMethodName + "netForumXMLSoapClient created successfuly.");

                _log.Debug(logMethodName + "Calling netForumXMLSoapClient.UpdateFacadeObjectResponse ASA.Web.Services.Common.xWeb.netForumXMLSoap.UpdateFacadeObject(ASA.Web.Services.Common.xWeb.UpdateFacadeObjectRequest request)");
                logFacadeObject("UPDATE", objectName, objectKey, oNode, isRetry);
                queryResults = xWebClient.UpdateFacadeObject(ref _authToken, objectName, objectKey, oNode);
                _log.Debug(logMethodName + "netForumXMLSoapClient.UpdateFacadeObject(...) completed");
            }
            catch (TimeoutException te)
            {
                _log.Error(logMethodName + "updateFacadeObject: TimeoutException on xWeb service call.  make sure endpoint is reachable and configured correctly.", te);
                if (!retryUpdate(xWebClient, out queryResults, objectName, oNode, objectKey))
                {
                    ProxyHelper.HandleServiceException(xWebClient);
                    throw te;
                }
            }
            //we do not want to retry these. These are errors that will not be fixed by a retry, i.e. invalid credentials
            //catch (FaultException fe)
            //{
            //    _log.Error(logMethodName + "There has been an error for an xWeb UPDATE operation: ", fe);
            //    throw fe;
            //}
            catch (CommunicationException ce)
            {
                _log.Error(logMethodName + "There has been an error attempting to communicate with XWeb, attempting retry (if enabled)", ce);


                // This will cause the AuthorizationToken to be refreshed,
                // and it will perform ONE retry call to xWeb to GetQuery() following this CommunicationException
                if (isRetry == false && ce.Message.StartsWith("System.Web.Services.Protocols.SoapException: Failed"))
                {
                    ProxyHelper.HandleServiceException(xWebClient);
                    _log.Info(logMethodName + "updateFacadeObject: Going to retry after getting a new Auth Token");
                    getNewAuthToken();

                    _log.Debug(logMethodName + "Calling netForumXMLSoapClient.UpdateFacadeObjectResponse ASA.Web.Services.Common.xWeb.netForumXMLSoap.UpdateFacadeObject(ASA.Web.Services.Common.xWeb.UpdateFacadeObjectRequest request)");
                    queryResults = updateFacadeObject(objectName, objectKey, oNode, true);
                    _log.Debug(logMethodName + "netForumXMLSoapClient.UpdateFacadeObject(...) completed");

                    //what happens if this throws an exception?
                }
                else
                {
                    _log.Warn(logMethodName + "updateFacadeObject: CommunicationException on xWeb service call.  make sure endpoint is reachable and configured correctly... this may be due to Token expiration", ce);
                    if (!retryUpdate(xWebClient, out queryResults, objectName, oNode, objectKey))
                    {
                        ProxyHelper.HandleServiceException(xWebClient);
                        throw ce;
                    }
                }
            }
            finally
            {
                if (xWebClient.State != CommunicationState.Closed)
                {
                    ProxyHelper.CloseChannel(xWebClient);
                }
            }

            _log.Debug(logMethodName + "End Method");
            return(queryResults);
        }
示例#2
0
        private XmlNode executeMethod(string serviceName, string methodName, Parameter[] parameters, bool isRetry)
        {
            String logMethodName = ".executeMethod(string serviceName, string methodName, Parameter[] parameters, bool isRetry) - ";

            _log.Debug(logMethodName + "Begin Method");

            XmlNode queryResults             = null;
            netForumXMLSoapClient xWebClient = null;

            try
            {
                _log.Debug(logMethodName + "Creating netForumXMLSoapClient.");
                xWebClient = new netForumXMLSoapClient();
                _log.Debug(logMethodName + "netForumXMLSoapClient created successfuly.");

                _log.Debug(logMethodName + "Calling netForumXMLSoapClient.ExecuteMethod(ASA.Web.Services.Common.xWeb.ExecuteMethodRequest request)");
                logExecuteMethod(serviceName, methodName, parameters, isRetry);
                queryResults = xWebClient.ExecuteMethod(ref _authToken, serviceName, methodName, parameters);
                _log.Debug(logMethodName + "netForumXMLSoapClient.ExecuteMethod(...) completed");
            }
            catch (TimeoutException te)
            {
                _log.Error(logMethodName + "executeMethod: TimeoutException on xWeb service call.  make sure endpoint is reachable and configured correctly.", te);
                if (!retryExecute(xWebClient, out queryResults, serviceName, methodName, parameters))
                {
                    ProxyHelper.HandleServiceException(xWebClient);
                    throw te;
                }
            }
            //we do not want to retry these. These are errors that will not be fixed by a retry, i.e. invalid credentials
            //catch (FaultException fe)
            //{
            //    _log.Error(logMethodName + "There has been an error for an xWeb Execute operation: ", fe);
            //    throw fe;
            //}
            catch (CommunicationException ce)
            {
                // This will cause the AuthorizationToken to be refreshed,
                // and it will perform ONE retry call to xWeb to GetQuery() following this CommunicationException
                if (isRetry == false && ce.Message.StartsWith("System.Web.Services.Protocols.SoapException: Failed"))
                {
                    ProxyHelper.HandleServiceException(xWebClient);
                    _log.Info(logMethodName + "executeMethod: Going to retry after getting a new Auth Token");
                    getNewAuthToken();
                    queryResults = executeMethod(serviceName, methodName, parameters, true);
                }
                else
                {
                    _log.Error(logMethodName + "executeMethod: CommunicationException on xWeb service call.  make sure endpoint is reachable and configured correctly... this may be due to Token expiration", ce);
                    if (!retryExecute(xWebClient, out queryResults, serviceName, methodName, parameters))
                    {
                        ProxyHelper.HandleServiceException(xWebClient);
                        throw ce;
                    }
                }
            }
            finally
            {
                if (xWebClient.State != CommunicationState.Closed)
                {
                    ProxyHelper.CloseChannel(xWebClient);
                }
            }

            _log.Debug(logMethodName + "End Method");

            return(queryResults);
        }
示例#3
0
        private XmlNode getQuery(string objectName, string columnList, string whereClause, string orderBy, bool isRetry)
        {
            String logMethodName = ".getQuery(string objectName, string columnList, string whereClause, string orderBy, bool isRetry) - ";

            _log.Debug(logMethodName + "Begin Method");

            XmlNode queryResults             = null;
            netForumXMLSoapClient xWebClient = null;

            try
            {
                _log.Debug(logMethodName + "Creating netForumXMLSoapClient.");
                xWebClient = new netForumXMLSoapClient();
                _log.Debug(logMethodName + "netForumXMLSoapClient Created Successfully");

                logGetQuery(objectName, columnList, whereClause, orderBy, isRetry);
                _log.Debug(logMethodName + "Calling netForumXMLSoapClient.GetQuery(ref ASA.Web.Services.Common.xWeb.AuthorizationToken AuthorizationToken, string szObjectName, string szColumnList, string szWhereClause, string szOrderBy)");
                queryResults = xWebClient.GetQuery(ref _authToken, objectName, columnList, whereClause, orderBy);
                _log.Debug(logMethodName + "xWebClient.GetQuery(...) completed");
            }
            catch (TimeoutException te)
            {
                _log.Error(logMethodName + "getQuery: TimeoutException on xWeb service call.  make sure endpoint is reachable and configured correctly.", te);

                if (!retryGet(xWebClient, out queryResults, objectName, columnList, whereClause, orderBy))
                {
                    ProxyHelper.HandleServiceException(xWebClient);
                    throw te;
                }
            }
            //we do not want to retry these. These are errors that will not be fixed by a retry, i.e. invalid credentials
            //catch (FaultException fe)
            //{
            //    _log.Error(logMethodName + "There has been an error for an xWeb GET operation: " + objectName, fe);
            //    throw fe;
            //}
            catch (CommunicationException ce)
            {
                _log.Error(logMethodName + "There has been an error attempting to communicate with XWeb, attempting retry (if enabled)", ce);


                // This will cause the AuthorizationToken to be refreshed,
                // and it will perform ONE retry call to xWeb to GetQuery() following this CommunicationException
                if (isRetry == false && ce.Message.StartsWith("System.Web.Services.Protocols.SoapException: Failed"))
                {
                    ProxyHelper.HandleServiceException(xWebClient);
                    _log.Info(logMethodName + "getQuery: Going to retry after getting a new Auth Token");
                    getNewAuthToken();

                    _log.Debug(logMethodName + "Calling netForumXMLSoapClient.GetQuery(ref ASA.Web.Services.Common.xWeb.AuthorizationToken AuthorizationToken, string szObjectName, string szColumnList, string szWhereClause, string szOrderBy)");
                    queryResults = getQuery(objectName, columnList, whereClause, orderBy, true);
                    _log.Debug(logMethodName + "xWebClient.GetQuery(...) completed");
                }
                else
                {
                    _log.Warn(logMethodName + "getQuery: CommunicationException on xWeb service call.  make sure endpoint is reachable and configured correctly... this may be due to Token expiration", ce);
                    if (!retryGet(xWebClient, out queryResults, objectName, columnList, whereClause, orderBy))
                    {
                        ProxyHelper.HandleServiceException(xWebClient);
                        throw ce;
                    }
                }
            }
            finally
            {
                if (xWebClient.State != CommunicationState.Closed)
                {
                    ProxyHelper.CloseChannel(xWebClient);
                }
            }

            _log.Debug(logMethodName + "End Method");
            return(queryResults);
        }