Calling the wladm Ant task

You can use the wladm Ant task and its associated commands to administer MobileFirst applications.

Syntax

Call the wladm Ant task as follows:
<wladm url=... user=... password=...|passwordfile=... [secure=...]>
    some commands
</wladm>

Attributes

The wladm Ant task has the following attributes:

Table 1. List of <wladm> attributes
Attribute Description Required Default
url The base URL of the MobileFirst web application for administration services Yes  
secure Whether to avoid operations with security risks No true
user The user name for accessing the MobileFirst administration services Yes  
password The password for the user Either one is required  
passwordfile The file that contains the password for the user  
timeout Timeout for the entire REST service access, in seconds No  
connectTimeout Timeout for establishing a network connection, in seconds No  
socketTimeout Timeout for detecting the loss of a network connection, in seconds No  
connectionRequestTimeout Timeout for obtaining an entry from a connection request pool, in seconds No  
url
The base URL preferably uses the HTTPS protocol. For example, if you use default ports and context roots, use the following URL.
  • For WebSphere® Application Server: https://server:9443/worklightadmin
  • For Tomcat: https://server:8443/worklightadmin
secure
The default value is true. Setting secure="false" might have the following effects:
  • The user and password might be transmitted in an unsecured way, possibly even through unencrypted HTTP.
  • The server's SSL certificates are accepted even if self-signed or if they were created for a different host name than the specified server's host name.
password
Specify the password either in the Ant script, through the password attribute, or in a separate file that you pass through the passwordfile attribute. The password is sensitive information and therefore needs to be protected. You must prevent other users on the same computer from knowing this password. To secure the password, before you enter the password into a file, remove the read permissions of the file for users other than yourself. For example, you can use one of the following commands:
  • On UNIX: chmod 600 adminpassword.txt
  • On Windows: cacls adminpassword.txt /P Administrators:F %USERDOMAIN%\%USERNAME%:F

Additionally, you might want to obfuscate the password to hide it from an occasional glimpse. To do so, use the wladm config password command to store the obfuscated password in a configuration file. Then, you can copy and paste the obfuscated password to the Ant script or to the password file.

The wladm call contains commands that are encoded in inner elements. These commands are executed in the order in which they are listed. If one of the commands fails, the remaining commands are not executed, and the wladm call fails.

Elements

You can use the following elements in wladm calls:
Table 2. Elements that can be used in <wladm>
Element Description Count
show-info Shows user and configuration information 0..∞
show-versions Shows versions information 0..∞
list-runtimes Lists the runtimes 0..∞
show-runtime Shows information about a runtime 0..∞
delete-runtime Deletes a runtime 0..∞
list-adapters Lists the adapters 0..∞
deploy-adapter Deploys an adapter 0..∞
show-adapter Shows information about an adapter 0..∞
delete-adapter Deletes an adapter 0..∞
adapter Other operations on an adapter 0..∞
list-apps Lists the apps 0..∞
deploy-app Deploys an app 0..∞
show-app Shows information about an app 0..∞
delete-app Deletes an app 0..∞
delete-app-version Delete a version of an app 0..∞
app-version Other operations on an app 0..∞
list-beacons Lists the beacons 0..∞
set-beacon Specifies information about a beacon 0..∞
show-beacon Shows information about a beacon 0..∞
remove-beacon Removes information about a beacon 0..∞
list-beacon-triggers Lists the beacon triggers 0..∞
set-beacon-trigger Specifies a beacon trigger 0..∞
show-beacon-trigger Shows a beacon trigger 0..∞
delete-beacon-trigger Deletes a beacon trigger 0..∞
list-beacon-trigger-associations Lists the associations between beacons and beacon triggers 0..∞
set-beacon-trigger-association Specifies an association between a beacon and a beacon trigger 0..∞
show-beacon-trigger-association Shows the association between a beacon and a beacon trigger 0..∞
delete-beacon-trigger-association Deletes the association between a beacon and a beacon trigger 0..∞
list-devices Lists the devices 0..∞
remove-device Removes a device 0..∞
device Other operations for a device 0..∞

XML Format

The output of most commands is in XML, and the input to specific commands, such as <set-accessrule>, is in XML too. You can find the XML schemas of these XML formats in the product_install_dir/WorklightServer/wladm-schemas/ directory. The commands that receive an XML response from the server verify that this response conforms to the specific schema. You can disable this check by specifying the attribute xmlvalidation="none".

Output character set

Normal output from the wladm Ant task is encoded in the encoding format of the current locale. On Windows, this encoding format is the so-called "ANSI code page". The effects are as follows:
  • Characters outside of this character set are converted to question marks when they are output.
  • When the output goes to a Windows command prompt window (cmd.exe), non-ASCII characters are incorrectly displayed because such windows assume characters to be encoded in the so-called "OEM code page".
To work around this limitation:
  • On operating systems other than Windows, use a locale whose encoding is UTF-8. This locale is the default locale on Red Hat Linux and OS X. Many other operating systems have the en_US.UTF-8 locale.
  • Or use the attribute output="some file name" to redirect the output of a wladm command to a file.