Removing policy set bindings using wsadmin scripting

You can use the Jython or Jacl scripting language to remove binding configurations for policies and resources to match your installation environment or requirements.

Before you begin

Before you use the commands in this topic, verify that you are using the most recent version of the wsadmin tool. The policy set management commands that accept a properties object as the value for the attributes or bindingLocation parameters are not supported on previous versions of the wsadmin tool. For example, the commands do not run on a Version 6.1.0.x node.

When administrative security is enabled, verify that you use the correct administrative role, as the following table describes:
Table 1. Administrative roles . This table describes the administrative roles and associated authorization when administrative security is enabled.
Administrative role Authorization
Administrator The Administrator role must have cell-wide access to delete bindings. If you have access to a specific resource only, you can delete bindings for the resource for which you have access.
Configurator The Configurator role can unassign bindings, but cannot delete bindings.
Deployer The Deployer role can unassign bindings, but cannot delete bindings.
Operator The Operator role cannot modify bindings.
Monitor The Monitor role cannot modify bindings.

About this task

Use the following steps to remove specific policies from your application-specific binding configuration, or to remove your entire binding configuration. For both of these removal options, you must use the -bindingLocation parameter to specify whether you are deleting an application-specific binding, server-specific default binding, or a binding for the trust service. Use the following table for examples using Jython syntax when specifying the type of binding to modify or remove:

Table 2. bindingLocation parameter options . Use the following values for the -bindingLocation parameter for the associated types of bindings.
Type of binding Value for the -bindingLocation parameter
Server-level (for Version 6.1 bindings only) -bindingLocation [[node node1][server server1]]
Application -bindingLocation [[application application1][attachmentId 123]]
Trust service binding -bindingLocation [[systemType trustService] [attachmentId 123]]
WS-Notification client -bindingLocation [[bus myBus][WSNService myService][attachmentId 123]]
General bindings -bindingLocation []

Procedure

  • Remove a policy from your application-specific binding configuration.

    Use the following steps to remove a specific policy from your binding configuration. If you remove the last policy remaining in your binding configuration, the command removes binding information from all attachments and deletes it from your configuration.

    1. Launch the wsadmin scripting tool using the Jython scripting language.
      To learn more, see the starting the wsadmin scripting client information.
    2. Review the binding configuration to edit.
      Use the getBinding command to view the attributes for the binding, as the following example demonstrates:
      AdminTask.getBinding('-policyType WSAddressing -bindingLocation "[[application application1][attachmentId 1234]]"')
      If the binding of interest is not referenced by an attachment ID, specify an asterisk character (*) for the attachmentId parameter to view the attributes for the binding, as the following example demonstrates:
      AdminTask.getBinding('-policyType WSAddressing -bindingLocation "[[application application1][attachmentId *]]"')
    3. Remove the policy from the binding configuration.
      Use the setBinding command with the -policyType and -remove parameters to remove the policy of interest from the binding configuration. For example, use the following command to remove the WSAddressing policy from the binding configuration for the application1 application:
      AdminTask.setBinding('-policyType WSAddressing -remove true -bindingLocation "[[application application1][attachmentId 1234]]"
      If the binding to delete is not referenced by an attachment ID, specify an asterisk character (*) for the attachmentId parameter to delete the binding, as the following example demonstrates:
      AdminTask.setBinding('-policyType WSAddressing -remove true -bindingLocation "[[application application1][attachmentId *]]"')
    4. Save your configuration changes.
      Use the following command example to save your configuration changes:
      AdminConfig.save()
  • Remove binding configurations from an attachment.

    Use the following steps to remove a server-specific default binding or a custom binding. You cannot remove cell-level default bindings from your configuration. When a binding is removed from an attachment, the resource it was removed from will inherit the server-level default binding, if one is present, or the cell-level default binding if the server-level binding is not present. Use the following steps to remove a binding configuration:

    1. Start the wsadmin scripting tool.
    2. Verify the current binding configuration to delete.
      Before removing the binding from the attachment, use the getBinding command to view the attributes for the binding, as the following example demonstrates:
      AdminTask.getBinding('-policyType WSAddressing -bindingLocation "[[application application1][attachmentId 123]]"')
    3. Remove the current binding configuration from the attachment.
      For this example, this command removes the bindings from the 123 attachment for the application1 application:
      AdminTask.setBinding('-bindingLocation "[[application application1][attachmentId 123]]" -remove true')
      If the binding to delete is not referenced by an attachment ID, specify an asterisk character (*) for the -attachmentId parameter to remove the binding, as the following example demonstrates:
      AdminTask.setBinding('-bindingLocation "[[application application1][attachmentId *]]" -remove true')
      To remove a server-specific default binding, specify the node name and server name with the -bindingLocation parameter. Server specific default bindings are deprecated. For example, this command removes the server-level default binding for the WS-Addressing policy from the server1 server on the node1 node:
      AdminTask.setBinding('-policyType WSAddressing -bindingLocation "[[node node1][server server1]]" -remove true')
    4. Save your configuration changes.
      Use the following command example to save your configuration changes:
      AdminConfig.save()
  • Remove a policy from a general binding.
    1. Start the wsadmin scripting tool.
    2. Verify the current binding configuration to delete.
      Before removing the binding from the attachment, use the getBinding command to view the attributes for the binding, as the following example demonstrates:
      AdminTask.getBinding('-policyType WSAddressing -bindingName "General Provider Binding" -bindingLocation []')
    3. Remove the general binding.
      For this example, this command removes the General Provider Binding general binding:
      AdminTask.setBinding('-bindingLocation [] -bindingName "General Provider Binding" -remove true')
    4. Save your configuration changes.
      Use the following command example to save your configuration changes:
      AdminConfig.save()