void IPolicyExportExtension.ExportPolicy(MetadataExporter exporter, PolicyConversionContext context) { if (exporter == null) { throw new ArgumentNullException("exporter"); } if (context == null) { throw new ArgumentNullException("context"); } PolicyAssertionCollection assertions = context.GetBindingAssertions(); XmlDocument doc = new XmlDocument(); var messageEncodingElement = ExportAddressingPolicy(context); if (messageEncodingElement == null) { assertions.Add(doc.CreateElement( "msb", "BinaryEncoding", "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1")); } if (transfer_mode == TransferMode.Streamed || transfer_mode == TransferMode.StreamedRequest || transfer_mode == TransferMode.StreamedResponse) { assertions.Add(doc.CreateElement("msf", "Streamed", "http://schemas.microsoft.com/ws/2006/05/framing/policy")); } }
void IPolicyExportExtension.ExportPolicy( MetadataExporter exporter, PolicyConversionContext context) { if (exporter == null) { throw new ArgumentNullException("exporter"); } if (context == null) { throw new ArgumentNullException("context"); } PolicyAssertionCollection assertions = context.GetBindingAssertions(); XmlDocument doc = new XmlDocument(); assertions.Add(doc.CreateElement("wsaw", "UsingAddressing", "http://www.w3.org/2006/05/addressing/wsdl")); switch (auth_scheme) { case AuthenticationSchemes.Basic: case AuthenticationSchemes.Digest: case AuthenticationSchemes.Negotiate: case AuthenticationSchemes.Ntlm: assertions.Add(doc.CreateElement("http", auth_scheme.ToString() + "Authentication", "http://schemas.microsoft.com/ws/06/2004/policy/http")); break; } }
void IPolicyExportExtension.ExportPolicy(MetadataExporter exporter, PolicyConversionContext context) { if (exporter == null) { throw new ArgumentNullException("exporter"); } if (context == null) { throw new ArgumentNullException("context"); } PolicyAssertionCollection assertions = context.GetBindingAssertions(); var doc = new System.Xml.XmlDocument(); ExportAddressingPolicy(context); switch (auth_scheme) { case AuthenticationSchemes.Basic: case AuthenticationSchemes.Digest: case AuthenticationSchemes.Negotiate: case AuthenticationSchemes.Ntlm: assertions.Add(doc.CreateElement("http", auth_scheme.ToString() + "Authentication", "http://schemas.microsoft.com/ws/06/2004/policy/http")); break; } var transportProvider = this as ITransportTokenAssertionProvider; if (transportProvider != null) { var token = transportProvider.GetTransportTokenAssertion(); assertions.Add(CreateTransportBinding(token)); } }
void IPolicyExportExtension.ExportPolicy(MetadataExporter exporter, PolicyConversionContext context) { PolicyAssertionCollection assertions = context.GetBindingAssertions(); XmlDocument doc = new XmlDocument(); assertions.Add(doc.CreateElement("msb", "BinaryEncoding", "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1")); }
public void ExportPolicy(MetadataExporter exporter, PolicyConversionContext context) { PolicyAssertionCollection assertions = context.GetBindingAssertions(); XmlDocument doc = new XmlDocument(); assertions.Add(doc.CreateElement("wsoma", "OptimizedMimeSerialization", "http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization")); }
public static void ExportRequireContextAssertion(ContextBindingElement bindingElement, PolicyAssertionCollection assertions) { if (bindingElement == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElement"); } if (assertions == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("assertions"); } if (bindingElement.ContextExchangeMechanism == ContextExchangeMechanism.ContextSoapHeader) { XmlElement assertion = Document.CreateElement(null, IncludeContextName, WscNamespace); XmlAttribute protectionLevelAttribute = Document.CreateAttribute(ProtectionLevelName); switch (bindingElement.ProtectionLevel) { case ProtectionLevel.EncryptAndSign: protectionLevelAttribute.Value = EncryptAndSignName; break; case ProtectionLevel.Sign: protectionLevelAttribute.Value = SignName; break; default: protectionLevelAttribute.Value = NoneName; break; } assertion.Attributes.Append(protectionLevelAttribute); assertions.Add(assertion); } else { XmlElement assertion = Document.CreateElement(null, HttpUseCookieName, HttpNamespace); assertions.Add(assertion); } }
public static void ExportRequireContextAssertion(ContextBindingElement bindingElement, PolicyAssertionCollection assertions) { if (bindingElement == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElement"); } if (assertions == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("assertions"); } if (bindingElement.ContextExchangeMechanism != ContextExchangeMechanism.ContextSoapHeader) { XmlElement item = Document.CreateElement(null, "HttpUseCookie", "http://schemas.xmlsoap.org/soap/http"); assertions.Add(item); } else { XmlElement element = Document.CreateElement(null, "IncludeContext", "http://schemas.microsoft.com/ws/2006/05/context"); System.Xml.XmlAttribute node = Document.CreateAttribute("ProtectionLevel"); switch (bindingElement.ProtectionLevel) { case ProtectionLevel.Sign: node.Value = "Sign"; break; case ProtectionLevel.EncryptAndSign: node.Value = "EncryptAndSign"; break; default: node.Value = "None"; break; } element.Attributes.Append(node); assertions.Add(element); } }
public static PolicyAssertionCollection AssertPolicy( WS.ServiceDescription sd, XmlElement element, TestLabel label) { label.EnterScope("wsp:Policy"); Assert.That(element.NamespaceURI, Is.EqualTo(WspNamespace), label.Get()); Assert.That(element.LocalName, Is.EqualTo("Policy") | Is.EqualTo("PolicyReference"), label.Get()); var policy = ResolvePolicy(sd, element); Assert.That(policy, Is.Not.Null, label.Get()); label.EnterScope("wsp:ExactlyOne"); var exactlyOne = AssertExactlyOneChildElement(policy); Assert.That(exactlyOne, Is.Not.Null, label.Get()); Assert.That(exactlyOne.NamespaceURI, Is.EqualTo(WspNamespace), label.Get()); Assert.That(exactlyOne.LocalName, Is.EqualTo("ExactlyOne"), label.Get()); label.LeaveScope(); label.EnterScope("wsp:Any"); var all = AssertExactlyOneChildElement(exactlyOne); Assert.That(all, Is.Not.Null, label.Get()); Assert.That(all.NamespaceURI, Is.EqualTo(WspNamespace), label.Get()); Assert.That(all.LocalName, Is.EqualTo("All"), label.Get()); label.LeaveScope(); var collection = new PolicyAssertionCollection(); label.EnterScope("assertions"); foreach (var node in all.ChildNodes) { if (node is XmlWhitespace) { continue; } Assert.That(node, Is.InstanceOfType(typeof(XmlElement)), label.ToString()); collection.Add((XmlElement)node); } label.LeaveScope(); label.LeaveScope(); return(collection); }
internal static void ExportRetransmissionEnabledAssertion(UdpTransportBindingElement bindingElement, PolicyAssertionCollection assertions) { if (bindingElement == null) { throw FxTrace.Exception.ArgumentNull("bindingElement"); } if (assertions == null) { throw FxTrace.Exception.ArgumentNull("assertions"); } if (bindingElement.RetransmissionSettings.Enabled) { XmlElement assertion = Document.CreateElement(UdpConstants.WsdlSoapUdpTransportPrefix, UdpConstants.RetransmissionEnabled, UdpConstants.WsdlSoapUdpTransportNamespace); assertions.Add(assertion); } }
void IPolicyExportExtension.ExportPolicy(MetadataExporter exporter, PolicyConversionContext context) { if (exporter == null) { throw new ArgumentNullException("exporter"); } if (context == null) { throw new ArgumentNullException("context"); } PolicyAssertionCollection assertions = context.GetBindingAssertions(); XmlDocument doc = new XmlDocument(); assertions.Add(doc.CreateElement("wsaw", "UsingAddressing", "http://www.w3.org/2006/05/addressing/wsdl")); assertions.Add(doc.CreateElement("msmq", "Authenticated", "http://schemas.microsoft.com/ws/06/2004/mspolicy/msmq")); assertions.Add(doc.CreateElement("msb", "BinaryEncoding", "http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1")); if (transport_security.MsmqAuthenticationMode == MsmqAuthenticationMode.WindowsDomain) { assertions.Add(doc.CreateElement("msmq", "WindowsDomain", "http://schemas.microsoft.com/ws/06/2004/mspolicy/msmq")); } if (!durable) { assertions.Add(doc.CreateElement("msmq", "MsmqVolatile", "http://schemas.microsoft.com/ws/06/2004/mspolicy/msmq")); } if (!exactly_once) { assertions.Add(doc.CreateElement("msmq", "MsmqBestEffort", "http://schemas.microsoft.com/ws/06/2004/mspolicy/msmq")); } }
public static PolicyAssertionCollection AssertPolicy ( WS.ServiceDescription sd, XmlElement element, TestLabel label) { label.EnterScope ("wsp:Policy"); Assert.That (element.NamespaceURI, Is.EqualTo (WspNamespace), label.Get ()); Assert.That (element.LocalName, Is.EqualTo ("Policy") | Is.EqualTo ("PolicyReference"), label.Get ()); var policy = ResolvePolicy (sd, element); Assert.That (policy, Is.Not.Null, label.Get ()); label.EnterScope ("wsp:ExactlyOne"); var exactlyOne = AssertExactlyOneChildElement (policy); Assert.That (exactlyOne, Is.Not.Null, label.Get ()); Assert.That (exactlyOne.NamespaceURI, Is.EqualTo (WspNamespace), label.Get ()); Assert.That (exactlyOne.LocalName, Is.EqualTo ("ExactlyOne"), label.Get ()); label.LeaveScope (); label.EnterScope ("wsp:Any"); var all = AssertExactlyOneChildElement (exactlyOne); Assert.That (all, Is.Not.Null, label.Get ()); Assert.That (all.NamespaceURI, Is.EqualTo (WspNamespace), label.Get ()); Assert.That (all.LocalName, Is.EqualTo ("All"), label.Get ()); label.LeaveScope (); var collection = new PolicyAssertionCollection (); label.EnterScope ("assertions"); foreach (var node in all.ChildNodes) { if (node is XmlWhitespace) continue; Assert.That (node, Is.InstanceOfType (typeof (XmlElement)), label.ToString ()); collection.Add ((XmlElement)node); } label.LeaveScope (); label.LeaveScope (); return collection; }