Created
October 7, 2014 03:17
-
-
Save pglezen/56d1069b55b5f3caa363 to your computer and use it in GitHub Desktop.
Script WAS WS-Security client policy set bindings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
appName = "CCConsumerApp" | |
serviceName = "WebService:/CCConsumerWeb.war:{urn:issw:bare:wssec:cc:query}CCService" | |
policySetExport = "\\policySets\\Sign Timestamp.zip" | |
policySetName = "Sign Timestamp" | |
clientBindingExport = "\\policySets\\CCConsumerBindings.zip" | |
clientBindingName = "CCConsumerBindings" | |
print "Cell name", AdminControl.getCell() | |
print "Node name", AdminControl.getNode() | |
print "The following are hard-coded parameters." | |
print "\tApplication name =", appName | |
print "\tService name =", serviceName | |
print "\tPolicy Set Export =", policySetExport | |
print "\tPolicy Set Name =", policySetName | |
print "\tClient Bindings Export =", clientBindingExport | |
print "\tClient Bindings Name =", clientBindingName | |
print "Importing policy set from", policySetExport | |
rc = AdminTask.importPolicySet('[-importFile "' + policySetExport + '" -verifyPolicySetType application]') | |
if rc == 'true': | |
print "Policy set import succeeded." | |
else: | |
print "Policy set import failed with return code", rc | |
sys.exit() | |
print "Import client binding from, ", clientBindingExport | |
rc = AdminTask.importBinding('[-importFile "' + clientBindingExport + '" -verifyBindingType client]') | |
if rc == 'true': | |
print "Client binding import succeeded." | |
else: | |
print "Client binding import failed." | |
sys.exit() | |
print "Attaching policy set to", appName, " with client", serviceName | |
attachID = AdminTask.createPolicySetAttachment('[-applicationName ' + appName + ' -attachmentType client -policySet "' + policySetName + '" -resources [' + serviceName + ']]') | |
print "Attachment ID = ", attachID | |
print "Assigning binding ..." | |
rc = AdminTask.setBinding('[-bindingScope domain -bindingName ' + clientBindingName + ' -attachmentType client -bindingLocation [[application ' + appName + '] [attachmentId ' + attachID + ']]]') | |
if rc == 'true': | |
print "Binding assigned successfully. Saving result." | |
AdminConfig.save() | |
print "Saved. Remember to restart client service JVM for changes to take affect." | |
else: | |
print "Binding assignment failed. Return code", rc | |
print "Not saving changes." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>wsadmin -lang jython -f \wsadmin\ccConsumer.py | |
WASX7209I: Connected to process "server1" on node node1 using SOAP connector; The type of process is: UnManagedProcess | |
Cell name WIN-Node06Cell | |
Node name node1 | |
The following are hard-coded parameters. | |
Application name = CCConsumerApp | |
Service name = WebService:/CCConsumerWeb.war:{urn:issw:bare:wssec:cc:query}CCService | |
Policy Set Export = \policySets\Sign Timestamp.zip | |
Policy Set Name = Sign Timestamp | |
Client Bindings Export = \policySets\CCConsumerBindings.zip | |
Client Bindings Name = CCConsumerBindings | |
Importing policy set from \policySets\Sign Timestamp.zip | |
Policy set import succeeded. | |
Import client binding from, \policySets\CCConsumerBindings.zip | |
Client binding import succeeded. | |
Attaching policy set to CCConsumerApp with client WebService:/CCConsumerWeb.war:{urn:issw:bare:wssec:cc:query}CCService | |
Attachment ID = 1013 | |
Assigning binding ... | |
Binding assigned successfully. Saving result. | |
Saved. Remember to restart client service JVM for changes to take affect. | |
C:\> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment