protected override void ProcessResponse() { try { Stream responseStream = base.Response.GetResponseStream(); XmlReaderSettings xmlReaderSetting = new XmlReaderSettings() { CloseInput = true }; using (XmlReader xmlReader = XmlReader.Create(responseStream, xmlReaderSetting)) { SyndicationFeed syndicationFeed = SyndicationFeed.Load <SyndicationFeed>(xmlReader); if (syndicationFeed != null) { this.UpdatedRegistrations = (new NamespaceManager.RegistrationSyndicationFeed(syndicationFeed)).Registrations; } else { this.UpdatedRegistrations = new RegistrationDescription[0]; } } } catch (WebException webException1) { WebException webException = webException1; base.Complete(ServiceBusResourceOperations.ConvertWebException(base.TrackingContext, webException, base.Request.Timeout, false)); } }
protected override void ProcessResponse() { try { Stream responseStream = base.Response.GetResponseStream(); XmlReaderSettings xmlReaderSetting = new XmlReaderSettings() { CloseInput = true }; using (XmlReader xmlReader = XmlReader.Create(responseStream, xmlReaderSetting)) { DataContractSerializer dataContractSerializer = new DataContractSerializer(typeof(RegistrationCounts)); this.Result = (RegistrationCounts)dataContractSerializer.ReadObject(xmlReader); } } catch (WebException webException1) { WebException webException = webException1; base.Complete(ServiceBusResourceOperations.ConvertWebException(base.TrackingContext, webException, base.Request.Timeout, false)); } }
protected override void ProcessResponse() { try { if (!this.testSend) { NotificationOutcome notificationOutcome = new NotificationOutcome() { State = NotificationOutcomeState.Enqueued, TrackingId = base.TrackingContext.TrackingId }; this.Result = notificationOutcome; } else { Stream responseStream = base.Response.GetResponseStream(); XmlReaderSettings xmlReaderSetting = new XmlReaderSettings() { CloseInput = true }; using (XmlReader xmlReader = XmlReader.Create(responseStream, xmlReaderSetting)) { DataContractSerializer dataContractSerializer = new DataContractSerializer(typeof(NotificationOutcome)); this.Result = (NotificationOutcome)dataContractSerializer.ReadObject(xmlReader); this.Result.State = NotificationOutcomeState.DetailedStateAvailable; this.Result.TrackingId = base.TrackingContext.TrackingId; } } } catch (XmlException xmlException) { throw new MessagingException(SRClient.InvalidXmlFormat, xmlException); } catch (WebException webException1) { WebException webException = webException1; throw ServiceBusResourceOperations.ConvertWebException(base.TrackingContext, webException, base.Request.Timeout, false); } }
protected override void ProcessResponse() { try { string responseHeader = base.Response.GetResponseHeader("Location"); string scheduledNotificationId = this.GetScheduledNotificationId(responseHeader); ScheduledNotification scheduledNotification = new ScheduledNotification() { ScheduledNotificationId = scheduledNotificationId, Tags = this.tagExpression, ScheduledTime = this.scheduledTime, Payload = this.notification, TrackingId = base.TrackingContext.TrackingId }; this.Result = scheduledNotification; } catch (WebException webException1) { WebException webException = webException1; throw ServiceBusResourceOperations.ConvertWebException(base.TrackingContext, webException, base.Request.Timeout, false); } }
protected override IEnumerator <IteratorAsyncResult <TAsyncResult> .AsyncStep> GetAsyncSteps() { this.PrepareRequest(); if (this.needRequestStream) { NotificationRequestAsyncResult <TAsyncResult> notificationRequestAsyncResult = this; IteratorAsyncResult <TAsyncResult> .BeginCall beginCall = (TAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.Request.BeginGetRequestStream(c, s); yield return(notificationRequestAsyncResult.CallAsync(beginCall, (TAsyncResult thisPtr, IAsyncResult r) => thisPtr.RequestStream = thisPtr.Request.EndGetRequestStream(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); if (base.LastAsyncStepException == null) { try { this.WriteToStream(); } catch (WebException webException1) { WebException webException = webException1; base.Complete(ServiceBusResourceOperations.ConvertWebException(this.TrackingContext, webException, this.Request.Timeout, false)); goto Label0; } } else { Exception lastAsyncStepException = base.LastAsyncStepException; WebException webException2 = lastAsyncStepException as WebException; if (webException2 != null) { lastAsyncStepException = ServiceBusResourceOperations.ConvertWebException(this.TrackingContext, webException2, this.Request.Timeout, false); } base.Complete(lastAsyncStepException); goto Label0; } } NotificationRequestAsyncResult <TAsyncResult> notificationRequestAsyncResult1 = this; IteratorAsyncResult <TAsyncResult> .BeginCall beginCall1 = (TAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.Request.BeginGetResponse(c, s); yield return(notificationRequestAsyncResult1.CallAsync(beginCall1, (TAsyncResult thisPtr, IAsyncResult r) => thisPtr.Response = (HttpWebResponse)thisPtr.Request.EndGetResponse(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); if (base.LastAsyncStepException == null) { try { using (this.Response) { if (this.Response.StatusCode == HttpStatusCode.Created || this.Response.StatusCode == HttpStatusCode.OK) { this.ProcessResponse(); } else { base.Complete(ServiceBusResourceOperations.ConvertWebException(this.TrackingContext, new WebException(this.Response.StatusDescription, null, WebExceptionStatus.ProtocolError, this.Response), this.Request.Timeout, false)); goto Label0; } } } catch (Exception exception) { base.Complete(exception); } } else { Exception lastAsyncStepException1 = base.LastAsyncStepException; WebException webException3 = lastAsyncStepException1 as WebException; if (webException3 != null) { lastAsyncStepException1 = ServiceBusResourceOperations.ConvertWebException(this.TrackingContext, webException3, this.Request.Timeout, false); } base.Complete(lastAsyncStepException1); } Label0: yield break; }