Toolboxcategory cloud |
ViewsPersonal toolsSDK Java TutorialFrom Seapine Labs(Redirected from SOAP SDK Java Tutorial)
This article includes everything you ever wanted to know about writing SOAP-based TestTrack SDK applications in Java! Don't like Java? Use the C#, VB or Python tutorials. Be sure to check out the TestTrack SDK Help pages for more information. Want Seapine to write your SOAP app for you? Email us!
[edit] Getting StartedYou must install the TestTrack SDK as part of your server installation. If you haven't done this, you'll need to run the TestTrack installer for the version you have installed. Once installed, there are two files of interest.
Once you've installed the TestTrack SDK, generate the stub code from the wsdl. Finally, import the namespace and you're ready to roll! import com.seapine.testtrackpro.ttpsoap.*;
[edit] Create a ConnectionThe TestTrack SDK requires authentication before you can retrieve and save data.
// Set the URL, based on your SDK installation.
java.net.URL url = new URL("http://127.0.0.1:80/cgi-bin/ttsoapcgi.exe");
// Create the connection.
TtsoapcgiStub cgiengine = new TtsoapcgiStub(url, new TtsoapcgiLocator());
// Fetch a list of projects you have access to.
CProject[] aproject = cgiengine.getProjectList( "administrator", "");
// Or, build your own.
CProject project = new CProject();
CDatabase db = new CDatabase();
db.setName("MyProject");
project.setDatabase(db);
CProjectDataOption[] apdo = new CProjectDataOption[2];
apdo[0] = new CProjectDataOption();
apdo[0].setName("TestTrack Pro"); // add TTP functionality.
apdo[1] = new CProjectDataOption();
apdo[1].setName("TestTrack TCM"); // add TCM functionality.
project.setOptions(apdo);
// Login.
long lSession = cgiengine.ProjectLogon( project, "administrator", "");
...do some stuff...
// When you're finished, log off.
cgiengine.DatbaseLogoff(lSession);
Things to Know:
[edit] Query ObjectsThere are two ways to retrieve data through the TestTrack SDK. You can explicitly call a getObject method or you can call the getRecordListForTable method. [edit] getObjectCalling the get method on an object is useful when you know exactly which object you need. For performance reasons, this is not recommended when you want to extract data from multiple objects of the same type. When calling getRecordListForTable you must specify both the object type you want to query and an array of fields you want to retrieve. Optionally, you can also specify a filter that you've pre-configured in TestTrack. All of this information can be hard-coded as shown in the previous example, or dynamically passed as shown below. Things to Know:
[edit] Create ObjectAdding an object is simply a matter of creating a new instance and calling the addObject method. For example, to create a defect: Things to Know:
[edit] Update ObjectBefore updating an object, you must first lock it for editing by calling editObject. Things to Know:
[edit] Update Custom FieldThings to Know:
[edit] Update StatusTestTrack calculates state based on event history. This means you can't simply set a value to change state. Instead, you have to apply the necessary events to move the object into the desired state.
[edit] Add File Attachment[edit] TroubleshootingWith Java, using the TestTrack SDK can be really simple or really frustrating. Following are some tools that can help you deubg issues.
|
|


