This section describes how to interact with TrackStudio from a Java application using TrackStudio SOAP API.
To develop a client application which uses TrackStudio SOAP API:
1. Enable TrackStudio SOAP API
2. Start TrackStudio Enterprise
3. Implement client application. In order to work with SOAP API you should first perform authentication. For this, you need to:
DevPack dp = new DevPack("http://localhost:8888/TrackStudio");
String sessionId = dp.getUserService().authenticate("root","root");
The session ID received as the result of authentication can be used to call other methods.
The code presented below shows the example of the simplest Java client:
import gran.trackstudio.DevPack; public class ATest { public static void main(String[] args) throws Exception { DevPack dp = new DevPack("http://localhost:8888/TrackStudio"); String sessionId = dp.getUserService() .authenticate("root","root"); System.out.println("Session ID is:"+sessionId); } }
4. Compile the client application
javac -classpath tssoapclient.jar;axis.jar;jaxrpc.jar Test.java
5. Run the client application
C:\>java -classpath tssoapclient.jar;axis.jar;jaxrpc.jar; commons-logging.jar;commons-discovery.jar;saaj.jar;. Test Session ID is:SESSION:297e234cfbf9889500fbf989ee890012
The set of examples is included in the TrackStudio DevPack demonstrating the use of the TrackStudio SOAP API. The examples are made as JUnit tests. To run the examples:
1. Install JDK, Apache Ant.
2. Enable TrackStudio SOAP API
3. Start TrackStudio Enterprise
4. Specify the TrackStudio URL and the administrator login/password in the DevPack\soap\test\account.properties file
ts.url = http://localhost:8888/TrackStudio ts.login = root ts.password = root
5. Switch to the DevPack\soap\test folder and run the ant script.