/// <summary> /// Builds the error response. /// </summary> /// <param name="notification"> /// The notification. /// </param> /// <param name="exception"> /// The exception. /// </param> /// <returns> /// The <see cref="RegistryInterface"/>. /// </returns> public RegistryInterface BuildErrorResponse(ISubscriptionObject notification, Exception exception) { var responseType = new RegistryInterface(); RegistryInterfaceType regInterface = responseType.Content; V21Helper.Header = regInterface; var returnType = new SubmitSubscriptionsResponseType(); regInterface.SubmitSubscriptionsResponse = returnType; var subscriptionStatus = new SubscriptionStatusType(); returnType.SubscriptionStatus.Add(subscriptionStatus); if (notification != null) { subscriptionStatus.SubscriptionURN = notification.Urn; } var statusMessageType = new StatusMessageType(); subscriptionStatus.StatusMessage = statusMessageType; this.AddStatus(statusMessageType, exception); return responseType; }
/// <summary> /// The build success response. /// </summary> /// <param name="notifications"> /// The notifications. /// </param> /// <returns> /// The <see cref="RegistryInterface"/>. /// </returns> public RegistryInterface BuildSuccessResponse(ICollection<ISubscriptionObject> notifications) { var responseType = new RegistryInterface(); RegistryInterfaceType regInterface = responseType.Content; V21Helper.Header = regInterface; /* foreach */ foreach (ISubscriptionObject currentNotification in notifications) { var returnType = new SubmitSubscriptionsResponseType(); regInterface.SubmitSubscriptionsResponse = returnType; var subscriptionStatus = new SubscriptionStatusType(); returnType.SubscriptionStatus.Add(subscriptionStatus); var statusMessageType = new StatusMessageType(); subscriptionStatus.StatusMessage = statusMessageType; this.AddStatus(statusMessageType, null); subscriptionStatus.SubscriptionURN = currentNotification.Urn; } return responseType; }