Result object for asynchronous test service response that uses a simple web service / POX call.
Inheritance: ServiceResult
示例#1
0
        /// <summary>
        /// Process the response callback from a POX method call.
        /// </summary>
        /// <param name="ar">The async result object.</param>
        private void ResponseCallback(IAsyncResult ar)
        {
            RequestData            data     = (RequestData)ar.AsyncState;
            HttpWebRequest         request  = data.Request;
            Action <ServiceResult> callback = data.Callback;
            WebServiceResult       wsr      = null;

            try
            {
                HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(ar);
                wsr = data.ConvertToResult(response);
                wsr.ReadHttpWebResponse();
            }
            catch (SecurityException)
            {
                // HTTP request failed, cross domain issue, or unable to
                // complete.
            }
            catch (WebException)
            {
            }
            finally
            {
                _sync.Post(UserInterfaceThreadCallback, new CrossThreadState(callback, wsr));
            }
        }
 /// <summary>
 /// Initializes a new TemporaryStateObject object.
 /// </summary>
 /// <param name="callback">The callback action.</param>
 /// <param name="result">The result object.</param>
 public CrossThreadState(Action <ServiceResult> callback, WebServiceResult result)
 {
     Callback = callback;
     Result   = result;
 }
 /// <summary>
 /// Initializes a new TemporaryStateObject object.
 /// </summary>
 /// <param name="callback">The callback action.</param>
 /// <param name="result">The result object.</param>
 public CrossThreadState(Action<ServiceResult> callback, WebServiceResult result)
 {
     Callback = callback;
     Result = result;
 }