private static void ProcessWsrm11Policy(MetadataImporter importer, XmlNode node, ReliableSessionBindingElement settings) { XmlElement element = ThrowIfNotPolicyElement(node, ReliableMessagingVersion.WSReliableMessaging11); IEnumerable <IEnumerable <XmlElement> > alternatives = importer.NormalizePolicy(new XmlElement[] { element }); List <Wsrm11PolicyAlternative> wsrmAlternatives = new List <Wsrm11PolicyAlternative>(); foreach (IEnumerable <XmlElement> alternative in alternatives) { Wsrm11PolicyAlternative wsrm11Policy = Wsrm11PolicyAlternative.ImportAlternative(importer, alternative); wsrmAlternatives.Add(wsrm11Policy); } if (wsrmAlternatives.Count == 0) { // No specific policy other than turn on WS-RM. return; } foreach (Wsrm11PolicyAlternative wsrmAlternative in wsrmAlternatives) { // The only policy setting that affects the binding is the InOrder assurance. // Even that setting does not affect the binding since InOrder is a server delivery assurance. // Transfer any that is valid. if (wsrmAlternative.HasValidPolicy) { wsrmAlternative.TransferSettings(settings); return; } } // Found only invalid policy. // This throws an exception about security since that is the only invalid policy we have. Wsrm11PolicyAlternative.ThrowInvalidBindingException(); }
public static Wsrm11PolicyAlternative ImportAlternative(MetadataImporter importer, IEnumerable <XmlElement> alternative) { State state = State.Security; Wsrm11PolicyAlternative wsrmPolicy = new Wsrm11PolicyAlternative(); foreach (XmlElement node in alternative) { if (state == State.Security) { state = State.DeliveryAssurance; if (wsrmPolicy.TryImportSequenceSTR(node)) { continue; } } if (state == State.DeliveryAssurance) { state = State.Done; if (wsrmPolicy.TryImportDeliveryAssurance(importer, node)) { continue; } } string exceptionString = string.Format(SRServiceModel.UnexpectedXmlChildNode, node.LocalName, node.NodeType, ReliableSessionPolicyStrings.ReliableSessionName); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidChannelBindingException(exceptionString)); } return(wsrmPolicy); }
private static void ProcessWsrm11Policy(MetadataImporter importer, System.Xml.XmlNode node, ReliableSessionBindingElement settings) { XmlElement element = ThrowIfNotPolicyElement(node, ReliableMessagingVersion.WSReliableMessaging11); IEnumerable <IEnumerable <XmlElement> > enumerable = importer.NormalizePolicy(new XmlElement[] { element }); List <Wsrm11PolicyAlternative> list = new List <Wsrm11PolicyAlternative>(); foreach (IEnumerable <XmlElement> enumerable2 in enumerable) { Wsrm11PolicyAlternative item = Wsrm11PolicyAlternative.ImportAlternative(importer, enumerable2); list.Add(item); } if (list.Count != 0) { foreach (Wsrm11PolicyAlternative alternative2 in list) { if (alternative2.HasValidPolicy) { alternative2.TransferSettings(settings); return; } } Wsrm11PolicyAlternative.ThrowInvalidBindingException(); } }
public static Wsrm11PolicyAlternative ImportAlternative(MetadataImporter importer, IEnumerable<XmlElement> alternative) { State state = State.Security; Wsrm11PolicyAlternative wsrmPolicy = new Wsrm11PolicyAlternative(); foreach (XmlElement node in alternative) { if (state == State.Security) { state = State.DeliveryAssurance; if (wsrmPolicy.TryImportSequenceSTR(node)) { continue; } } if (state == State.DeliveryAssurance) { state = State.Done; if (wsrmPolicy.TryImportDeliveryAssurance(importer, node)) { continue; } } string exceptionString = SR.GetString(SR.UnexpectedXmlChildNode, node.LocalName, node.NodeType, ReliableSessionPolicyStrings.ReliableSessionName); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidChannelBindingException(exceptionString)); } return wsrmPolicy; }