/// <summary>
        /// Asynchronously downloads an xml file from the specified url
        /// </summary>
        /// <param name="url"></param>
        /// <param name="callback">A <see cref="DownloadXmlCompletedCallback"/> to be invoked when the request is completed</param>
        /// <param name="userState">A state object to be returned to the callback</param>
        /// <returns></returns>
        public object DownloadXmlAsync(string url, HttpPostData postData, DownloadXmlCompletedCallback callback, object userState)
        {
            string urlValidationError;
            if (!IsValidURL(url, out urlValidationError))
            {
                throw new ArgumentException(urlValidationError);
            }

            XmlRequestAsyncState state = new XmlRequestAsyncState(callback, DownloadXmlAsyncCompleted, userState);
            HttpWebServiceRequest request = GetRequest();
            request.GetResponseAsync(url, new MemoryStream(), XML_ACCEPT, postData, state);
            return request;
        }
        /// <summary>
        /// Asynchronously downloads an xml file from the specified url
        /// </summary>
        /// <param name="url"></param>
        /// <param name="callback">A <see cref="DownloadXmlCompletedCallback"/> to be invoked when the request is completed</param>
        /// <param name="userState">A state object to be returned to the callback</param>
        /// <returns></returns>
        public object DownloadXmlAsync(string url, HttpPostData postData, DownloadXmlCompletedCallback callback, object userState)
        {
            string urlValidationError;

            if (!IsValidURL(url, out urlValidationError))
            {
                throw new ArgumentException(urlValidationError);
            }

            XmlRequestAsyncState  state   = new XmlRequestAsyncState(callback, DownloadXmlAsyncCompleted, userState);
            HttpWebServiceRequest request = GetRequest();

            request.GetResponseAsync(url, new MemoryStream(), XML_ACCEPT, postData, state);
            return(request);
        }
 public XmlRequestAsyncState(DownloadXmlCompletedCallback callback, WebRequestAsyncCallback webRequestCallback, object userState)
     : base(webRequestCallback)
 {
     _downloadXmlCompleted = callback;
     _userState            = userState;
 }
 public XmlRequestAsyncState(DownloadXmlCompletedCallback callback, WebRequestAsyncCallback webRequestCallback, object userState)
     : base(webRequestCallback)
 {
     _downloadXmlCompleted = callback;
     _userState = userState;
 }