System.ServiceModel 4.0.0.0

Implement the interface to search WSDL information exposed by a particular endpoint for custom policy assertions about endpoint capabilities or requirements. Typically, a policy importer searches for a specific assertion and either inserts a binding element, configures a binding element, or modifies the contract to support the requirements of the assertion.

Unlike its counterpart, , does not require implementation by a object; you can load it using the client configuration section shown in the Examples section or programmatically by adding it to the constructor.

indigo1 passes two objects to the method, a and a . Typically the object already contains the policy assertions for each binding scope.

An implementation performs the following steps:

Locates the custom policy assertion for which it is responsible by calling either the , , or methods, depending upon the scope.

Removes the policy assertion from the assertion collection. The method locates, returns, and removes the assertion in one step.

Modify the binding stack or the contract by either adding a required custom to the property or by modifying the property.

Step 2 is important. After all policy importers have been called, indigo2 checks for the existence of any policy assertions that remain. If one exists, indigo2 assumes that the policy import was unsuccessful and does not import the associated binding.

A malicious metadata supplier can attempt to send malformed XML as part of metadata in an attempt to exploit a policy importer. It is strongly recommended that custom policy importers be robust to all forms of XML that can be passed to it.

Custom implementations must implement their own object to extract the policy assertions attached to the custom metadata format.

If you want to export and import custom WSDL elements that are not policy assertions, see and .

You can use custom policy importers and exporters with the ServiceModel Metadata Utility Tool (Svcutil.exe) by using the same configuration elements in a configuration file and the /svcutilConfig:<configFile> option.

Defines a method for objects that import custom policy assertions about bindings.

- Method
  4.0.0.0
  System.Void `` ``

  Implement the ImportPolicy method to obtain policy assertions and perform some modification of the imported contract or binding to support the assertion. Typically, a policy importer responds to finding a custom policy assertion by configuring or inserting a binding element into the binding being imported.

  indigo1 passes two objects to the method, a and a . Typically the object already contains the policy assertions for each binding scope.

  An implementation performs the following steps:

  Locates the custom policy assertion for which it is responsible by calling either the , , or methods, depending upon the scope.

  Removes the policy assertion from the assertion collection. The method locates, returns, and removes the assertion in one step.

  Modifies the binding stack or the contract by either adding a required custom to the property or by modifying the property.

  Step 2 is important. After all policy importers have been called, indigo2 checks for the existence of any policy assertions that remain. If one exists, indigo2 assumes that the policy import was unsuccessful and does not import the associated binding.

  Defines a method that can import custom policy assertions and add implementing binding elements.

  The object in use. The that contains both the policy assertions that can be imported and the collections of binding elements to which implementing binding elements can be added.