Logging in to TEXTML Server
How to connect and login to an instance of TEXTML Server. How to free resources and logoff from TEXTML Server.
To connect and login to a TEXTML Server instance:
- TEXTML Server must be installed and running on a computer ("the server"). The server can be the same computer as the one which runs your client application, or it can be a remote computer.
- Your application must know the name of the server. If TEXTML Server and your client application are running on the same computer, then you can use "localhost" as the server name.
Logging in to a TEXTML Server instance is the first step to managing the instance and its document bases.
To connect to a server:
- Get a ClientServices object from ClientServicesFactory.
IxiaClientServices cs = Ixiasoft.TextmlServer41.ClientServicesFactory.getInstance();
The ClientServices object allows you login to instances of TEXTML Server, to logout from them, and to get access to various TEXTML Services.
- Prepare the credentials required to login to the TEXTML Server instance.
// The 3 parameters are all String objects. cs.Login(domain, userName, password));These credentials must be the same as the ones you use to login to the computer hosting the TEXTML Server instance.Note: ClientServices.Login() does not actually log you in to TEXTML Server. Instead, it just stores the information for the next step.
- Login by getting an IxiaPowerServices object for the TEXTML Server instance
running on the server that you specify.
// The parameter is a String object. IxiaPowerServices ps = cs.GetPowerServices(serverName);
This call connects to the TEXTML Server instance running on the server specified by serverName, and then uses the credentials you specified earlier to login.
Any problems (serverName not found in your domain, invalid userName or password, no TEXTML Server instance running, etc.) will throw an exception that you must catch and handle appropriately. See the reference documentation for ClientServicesFactory.getPowerServices(), and the sample program mentioned below.
You can use the IxiaPowerServices object to make sure that the TEXTML Server instance is running properly: for example, that the server is Running and not Paused. See the sample program below.Note: This is the starting point for many topics that discuss code snippets: your application is logged in to a TEXTML Server instance, and contains an IxiaClientServices object named cs and a IxiaPowerServices object named ps.
- When you have finished using a TEXTML SDK object, free its memory by calling
the object's Release() method.
ps.Release(); // Free memory used by IxiaPowerServices object
- When you are finished using the TEXTML Server instance, logout and disconnect
by calling the logout() method of the ClientServices object
that you used to login.
You can build and run a working sample program located here: