Configuring 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.

About this task

Use this task and the following examples to configure string, Enterprise JavaBeans (EJB), CORBA, or indirect name space bindings on a cell.

Procedure

  1. Start the wsadmin scripting tool.
  2. Identify the cell and assign it to the cell variable.

    Using Jacl:

    set cell [$AdminConfig getid /Cell:mycell/]
    Example output:
    mycell(cells/mycell|cell.xml#Cell_1)

    Using Jython:

    cell = AdminConfig.getid('/Cell:mycell/')
    print cell
    You can change this example to configure on a node or server here.
  3. 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:

      Using 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)

      Using 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:

      Using Jacl:

      $AdminConfig create EjbNameSpaceBinding $cell {{name binding2} {nameInNameSpace myBindings/myEJB} 
      {applicationNodeName mynode} {bindingLocation SINGLESERVER} {applicationServerName server1} 
      {ejbJndiName ejb/myEJB}}

      Using 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:

      Using Jacl:

      $AdminConfig create EjbNameSpaceBinding $cell {{name binding2} {nameInNameSpace myBindings/myEJB} 
      {bindingLocation SERVERCLUSTER} {applicationServerName cluster1} {ejbJndiName ejb/myEJB}}

      Using 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:

      Using 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)

      Using 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:

      Using 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)

      Using Jython:

      print AdminConfig.create('IndirectLookupNameSpaceBinding', cell, [['name', 'binding4'], 
      ['nameInNameSpace','myBindings/myIndirect'], ['providerURL', 'corbaloc::myCompany.com:9809/NameServiceServerRoot'], 
      ['jndiName', 'jndi/name/for/EJB']])
  4. Save the configuration changes.
    Use the following command example to save your configuration changes:
    AdminConfig.save()