This section describes how to realize the interaction between TrackStudio and a .NET application using TrackStudio SOAP API.
To develop the client application that uses TrackStudio SOAP API you are to:
1. Enable TrackStudio SOAP API
2. Start TrackStudio Enterprise
3. Create XML Web service proxy classes.
Create a proxy class for each service. Every proxy class must be a separate namespace. To generate a proxy to access the User service execute the following command:
wsdl.exe http://localhost:8888/TrackStudio/services/User?wsdl /out:dll/UserService.cs /namespace:User
As a result the UserService.cs proxy class will be created in the dll folder. Repeat these steps for other services and link all the created proxy classes to the ts.dll library:
csc.exe /t:library /out:ts.dll dll\*.cs
4. Implement client application. In order to work with SOAP API you should first perform authentication. To do this:
UserService uSrv = new UserService();
tSrv.Url = "http://localhost:8888/TrackStudio/services/User";
string sessionId = uSrv.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 simple .NET client application:
using System; using User; public class SoapTest { public static void Main(string[] args) { UserService uSrv = new UserService(); uSrv.Url = "http://localhost:8888/TrackStudio/services/User"; string sessionId = uSrv.authenticate("root", "root"); Console.WriteLine("Session ID is: " + sessionId); } }
5. Compile the client application
csc.exe /reference:ts.dll SoapTest.cs
6. Run the client application
C:\soap\dotNET>SoapTest.exe 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 csUnit tests. To run the examples:
1. Install .NET Framework, Apache Ant, csUnit.
2. Enable TrackStudio SOAP API
3. Start TrackStudio Enterprise
4.Specify the TrackStudio URL and the administrator login/password in the DevPack\soap\dotNET\account.properties file.
ts.url = http://localhost:8888/TrackStudio ts.login = root ts.password = root
5. Specify paths to the external programs in the DevPack\soap\dotNET\dotNET.properties file.
wsdl.exe C:\\Program Files\\Microsoft.NET\\SDK\\v1.1\\Bin\\wsdl.exe csc.exe C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\csc.exe csUnitRunner.exe "C:\\csUnit 1.9.4\\csUnitRunner.exe"
6. Execute the DevPack\soap\dotNET\build.bat script.
7. When the csUnit window appears press F5 to execute samples.