コード例 #1
0
        protected void InvokeAsync(string methodName, object[] parameters, SendOrPostCallback callback, object userState)
        {
            if (userState == null)
            {
                userState = this.NullToken;
            }
            SoapHttpClientProtocol.InvokeAsyncState invokeAsyncState = new SoapHttpClientProtocol.InvokeAsyncState(methodName, parameters);
            AsyncOperation       operation   = AsyncOperationManager.CreateOperation((object)new UserToken(callback, userState));
            WebClientAsyncResult asyncResult = new WebClientAsyncResult((WebClientProtocol)this, (object)invokeAsyncState, (WebRequest)null, new AsyncCallback(this.InvokeAsyncCallback), (object)operation);

            try
            {
                this.AsyncInvokes.Add(userState, (object)asyncResult);
            }
            catch (Exception ex)
            {
                if (ex is ThreadAbortException || ex is StackOverflowException || ex is OutOfMemoryException)
                {
                    throw;
                }
                else
                {
                    if (Tracing.On)
                    {
                        Tracing.ExceptionCatch(TraceEventType.Warning, (object)this, "InvokeAsync", ex);
                    }
                    InvokeCompletedEventArgs completedEventArgs = new InvokeCompletedEventArgs(new object[1], (Exception) new ArgumentException(System.Web.Services.Res.GetString("AsyncDuplicateUserState"), ex), false, userState);
                    operation.PostOperationCompleted(callback, (object)completedEventArgs);
                    return;
                }
            }
            try
            {
                this.BeginSend(this.Uri, asyncResult, true);
            }
            catch (Exception ex)
            {
                if (ex is ThreadAbortException || ex is StackOverflowException || ex is OutOfMemoryException)
                {
                    throw;
                }
                else
                {
                    if (Tracing.On)
                    {
                        Tracing.ExceptionCatch(TraceEventType.Warning, (object)this, "InvokeAsync", ex);
                    }
                    this.OperationCompleted(userState, new object[1], ex, false);
                }
            }
        }
コード例 #2
0
 protected void InvokeAsync(string methodName, object[] parameters, SendOrPostCallback callback, object userState)
 {
   if (userState == null)
     userState = this.NullToken;
   SoapHttpClientProtocol.InvokeAsyncState invokeAsyncState = new SoapHttpClientProtocol.InvokeAsyncState(methodName, parameters);
   AsyncOperation operation = AsyncOperationManager.CreateOperation((object) new UserToken(callback, userState));
   WebClientAsyncResult asyncResult = new WebClientAsyncResult((WebClientProtocol) this, (object) invokeAsyncState, (WebRequest) null, new AsyncCallback(this.InvokeAsyncCallback), (object) operation);
   try
   {
     this.AsyncInvokes.Add(userState, (object) asyncResult);
   }
   catch (Exception ex)
   {
     if (ex is ThreadAbortException || ex is StackOverflowException || ex is OutOfMemoryException)
     {
       throw;
     }
     else
     {
       if (Tracing.On)
         Tracing.ExceptionCatch(TraceEventType.Warning, (object) this, "InvokeAsync", ex);
       InvokeCompletedEventArgs completedEventArgs = new InvokeCompletedEventArgs(new object[1], (Exception) new ArgumentException(System.Web.Services.Res.GetString("AsyncDuplicateUserState"), ex), false, userState);
       operation.PostOperationCompleted(callback, (object) completedEventArgs);
       return;
     }
   }
   try
   {
     this.BeginSend(this.Uri, asyncResult, true);
   }
   catch (Exception ex)
   {
     if (ex is ThreadAbortException || ex is StackOverflowException || ex is OutOfMemoryException)
     {
       throw;
     }
     else
     {
       if (Tracing.On)
         Tracing.ExceptionCatch(TraceEventType.Warning, (object) this, "InvokeAsync", ex);
       this.OperationCompleted(userState, new object[1], ex, false);
     }
   }
 }
コード例 #3
0
 internal override void AsyncBufferedSerialize(WebRequest request, Stream requestStream, object internalAsyncState)
 {
     SoapHttpClientProtocol.InvokeAsyncState invokeAsyncState = (SoapHttpClientProtocol.InvokeAsyncState)internalAsyncState;
     invokeAsyncState.Message.SetStream(requestStream);
     this.Serialize(invokeAsyncState.Message);
 }
コード例 #4
0
 internal override void InitializeAsyncRequest(WebRequest request, object internalAsyncState)
 {
     SoapHttpClientProtocol.InvokeAsyncState invokeAsyncState = (SoapHttpClientProtocol.InvokeAsyncState)internalAsyncState;
     invokeAsyncState.Message = this.BeforeSerialize(request, invokeAsyncState.MethodName, invokeAsyncState.Parameters);
 }