ServiceManager/NetSuiteServiceManager.cs
/// <summary>Invokes the remote method using the specified parameters and settings.</summary>
/// <param name="arg">Method arguments</param>
/// <param name="method">Name of the remote method to execute.</param>
/// <param name="searchPrefs">Search Preference settings.</param>
/// <returns>Result of the web service.</returns>
Invokes the remote method using the specified parameters and settings.
Invokes the remote method using the specified parameters and settings .
internal override T InvokeService<T>(object arg, string method, SearchPreferences searchPrefs)
        {
            lock (ServiceProxy)
            {
                Configuration.Configure(ServiceProxy, searchPrefs);
                T result = null;
                MethodInfo mi = ServiceProxy.GetType().GetMethod(method);
                ParameterInfo[] parameters = mi.GetParameters();
                Func<object, T> invokerFunc = GetInvokerFunction<T>(mi, parameters);
                ServiceInvocationEventArgs invokerEventArgs = new ServiceInvocationEventArgs(method, arg);
                for (; invokerEventArgs.InvokationAttempt < Configuration.RetryCount; invokerEventArgs.InvokationAttempt++)
                {
                    ServiceProxy.passport = Credentials.GetPassport();
                    OnBeforeServiceInvocation(invokerEventArgs);
                    if (!invokerEventArgs.Cancel && this.IsSuspended)
                        throw new WebservicesLockdownException();
                    else if (invokerEventArgs.Cancel)
                        break;
                    else if (_log.IsDebugEnabled && parameters.Length == 0)
                        LogInvocationMeaningfully(invokerEventArgs.MethodName);
                    else if (_log.IsDebugEnabled)
                        LogInvocationMeaningfully(invokerEventArgs.MethodName, invokerEventArgs.Arguments);
                    bool retry;
                    result = TryInvokeService<T>(invokerFunc, invokerEventArgs, out retry);
                    if (!retry)
                        break;
                }
                if (invokerEventArgs.InvokationAttempt == Configuration.RetryCount) 
                {
                    invokerEventArgs.Exception = new RetryCountExhaustedException("Operation Failed", invokerEventArgs.Exception);
                    OnServiceInvocationError(invokerEventArgs);
                    throw invokerEventArgs.Exception;
                }
                return result;
            }
        }
internal override T InvokeService < T > ( object arg , string method , SearchPreferences searchPrefs ) { lock ( ServiceProxy ) { Configuration . Configure ( ServiceProxy , searchPrefs ) ; T result = null ; MethodInfo mi = ServiceProxy . GetType ( ) . GetMethod ( method ) ; ParameterInfo [ ] parameters = mi . GetParameters ( ) ; Func < object , T > invokerFunc = GetInvokerFunction < T > ( mi , parameters ) ; ServiceInvocationEventArgs invokerEventArgs = new ServiceInvocationEventArgs ( method , arg ) ; for ( ; invokerEventArgs . InvokationAttempt < Configuration . RetryCount ; invokerEventArgs . InvokationAttempt ++ ) { ServiceProxy . passport = Credentials . GetPassport ( ) ; OnBeforeServiceInvocation ( invokerEventArgs ) ; if ( ! invokerEventArgs . Cancel && this . IsSuspended ) throw new WebservicesLockdownException ( ) ; else if ( invokerEventArgs . Cancel ) break ; else if ( _log . IsDebugEnabled && parameters . Length == 0 ) LogInvocationMeaningfully ( invokerEventArgs . MethodName ) ; else if ( _log . IsDebugEnabled ) LogInvocationMeaningfully ( invokerEventArgs . MethodName , invokerEventArgs . Arguments ) ; bool retry ; result = TryInvokeService < T > ( invokerFunc , invokerEventArgs , out retry ) ; if ( ! retry ) break ; } if ( invokerEventArgs . InvokationAttempt == Configuration . RetryCount ) { invokerEventArgs . Exception = new RetryCountExhaustedException ( " " , invokerEventArgs . Exception ) ; OnServiceInvocationError ( invokerEventArgs ) ; throw invokerEventArgs . Exception ; } return result ; } }
Invokes the remote method using the specified parameters and settings.
Invokes the remote method using the specified parameters and settings .
// Retry count was exhausted..
Result of the web service.
Result of the web service .
arg
object
None
method
string
Name of the remote method to execute.
Name of the remote method to execute .
searchPrefs
SearchPreferences
Search Preference settings.
Search Preference settings .