Configure namespace bindings using the wsadmin scripting tool
Use this topic to configure name space bindings with the Jython or Jacl scripting languages and the wsadmin tool.
Use this task and the following examples to configure string, EJB, CORBA, or indirect name space bindings on a cell.
Tasks
- Start the wsadmin scripting tool.
- Identify the cell and assign it to the cell variable.
Use Jacl:
set cell [$AdminConfig getid /Cell:mycell/]Example output:
mycell(cells/mycell|cell.xml#Cell_1)Use Jython:
cell = AdminConfig.getid('/Cell:mycell/') print cellWe can change this example to configure on a node or server here.- Add a new name space binding on the cell. There are four binding types to choose from when configuring a new name space binding. They are string, EJB, CORBA, and indirect.
- To configure a string type name space binding:
Use Jacl:
$AdminConfig create StringNameSpaceBinding $cell {{name binding1} {nameInNameSpace myBindings/myString} {stringToBind "This is the String value that gets bound"}}Example output:
binding1(cells/mycell|namebindings.xml#StringNameSpaceBinding_1)Use Jython:
print AdminConfig.create('StringNameSpaceBinding', cell, [['name', 'binding1'], ['nameInNameSpace', 'myBindings/myString'], ['stringToBind', "This is the String value that gets bound"]])- To configure an EJB type name space binding:
Use Jacl:
$AdminConfig create EjbNameSpaceBinding $cell {{name binding2} {nameInNameSpace myBindings/myEJB} {applicationNodeName mynode} {bindingLocation SINGLESERVER} {applicationServerName server1} {ejbJndiName ejb/myEJB}}Use Jython:
print AdminConfig.create('EjbNameSpaceBinding', cell, [['name', 'binding2'], ['nameInNameSpace', 'myBindings/myEJB'], ['applicationNodeName', 'mynode'], ['bindingLocation', 'SINGLESERVER'], ['applicationServerName', 'server1'], ['ejbJndiName', 'ejb/myEJB']])This example is for an EJB located in a server. For an EJB in a cluster, change the configuration example to:
Use Jacl:
$AdminConfig create EjbNameSpaceBinding $cell {{name binding2} {nameInNameSpace myBindings/myEJB} {bindingLocation SERVERCLUSTER} {applicationServerName cluster1} {ejbJndiName ejb/myEJB}}Use Jython:
print AdminConfig.create('EjbNameSpaceBinding', cell, [['name','binding2'], ['nameInNameSpace','myBindings/myEJB'], ['bindingLocation','SERVERCLUSTER'], ['applicationServerName','cluster1'], ['ejbJndiName','ejb/myEJB']])Example output:
binding2(cells/mycell|namebindings.xml#EjbNameSpaceBinding_1)- To configure a CORBA type name space binding:
Use Jacl:
$AdminConfig create CORBAObjectNameSpaceBinding $cell {{name binding3} {nameInNameSpace myBindings/myCORBA}{corbanameUrl corbaname:iiop:somehost.somecompany.com:2809#stuff/MyCORBAOjbect} {federatedContext false}}Example output:
binding3(cells/mycell|namebindings.xml#CORBAObjectNameSpaceBinding_1)Use Jython:
print AdminConfig.create('CORBAObjectNameSpaceBinding', cell, [['name', 'binding3'],['nameInNameSpace', 'myBindings/myCORBA'],['corbanameUrl','corbaname:iiop:somehost.somecompany.com:2809#stuff/MyCORBAOjbect'], ['federatedContext', 'false']])- To configure an indirect type name space binding:
Use Jacl:
$AdminConfig create IndirectLookupNameSpaceBinding $cell {{name binding4} {nameInNameSpace myBindings/myIndirect} {providerURL corbaloc::myCompany.com:9809/NameServiceServerRoot} {jndiName jndi/name/for/EJB}}Example output:
binding4(cells/mycell|namebindings.xml#IndirectLookupNameSpaceBinding_1)Use Jython:
print AdminConfig.create('IndirectLookupNameSpaceBinding', cell, [['name', 'binding4'], ['nameInNameSpace','myBindings/myIndirect'], ['providerURL', 'corbaloc::myCompany.com:9809/NameServiceServerRoot'], ['jndiName', 'jndi/name/for/EJB']])
- Save the configuration changes.
AdminConfig.save()
Start the wsadmin scripting client Use the script library to automate the application serving environment Enable and disable security using scripting Use wsadmin scripting Get started with wsadmin scripting