Skip Navigation LinksForums > SpiraTeam Forums > SpiraTeam Issues & Questi... > Example code on how to us...

Example code on how to use spira Team web services RSS Feed

Wednesday, July 4, 2012
I have found the WSDL of the spira Team web services. I notice that it contains numerous get methods and two authentication methods.
It  would be helpful to have a document to say how to use the web services in general.
Eg open a connection using either of these methods. Then call your methods to get your data then close the connection.

Specifically I want to get all the incident number, descriptions for the incidents fixed in a specific release so I can generate some release notes.
So I need to do what?
2 Replies
Adam SAdam S
re: Alan Heath on Wednesday, July 4, 2012
Thursday, July 5, 2012

Hi Alan

We've typed up a quick KB article for you -

Let us know if you have any questions.

Alan HeathAlan Heath
re: Adam S on Thursday, July 5, 2012
Wednesday, July 11, 2012
Thanks Adam that was helpful.
I have replicated your c# code in java. I used eclipse and axis to convert the WSDL into java stubs then called those stubs as follows.

import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;

import org.datacontract.schemas._2004._07.Inflectra_SpiraTest_Web_Services_v3_0.ServiceFaultMessage;
import org.datacontract.schemas._2004._07.Inflectra_SpiraTest_Web_Services_v3_0_DataObjects.RemoteFilter;
import org.datacontract.schemas._2004._07.Inflectra_SpiraTest_Web_Services_v3_0_DataObjects.RemoteIncident;
import org.datacontract.schemas._2004._07.Inflectra_SpiraTest_Web_Services_v3_0_DataObjects.RemoteRelease;
import org.datacontract.schemas._2004._07.Inflectra_SpiraTest_Web_Services_v3_0_DataObjects.RemoteSort;

import com.inflectra.www.SpiraTest.Services.v3_0.IImportExport;
import com.inflectra.www.SpiraTest.Services.v3_0.ImportExportLocator;

public class SpiraTeamClient
     * Print the release notes for a particular release.
     * @param p_projectId the project id, in SpiraTeam if a project is PR000062 then use 62
     * @param p_releaseVersion the release Version, in spiraTeam is shown as Version #
     * @param p_user user name used for authentication
     * @param p_passwd password used for authentication
     * @throws ServiceException
     * @throws ServiceFaultMessage
     * @throws RemoteException
    private static void printReleaseNotes(int p_projectId, String p_releaseVersion, String p_user, String p_passwd) throws ServiceException, ServiceFaultMessage, RemoteException
        int releaseId = 0; // spira team release id
        IImportExport spiraImportExport = null;
            ImportExportLocator spiraTeamLocator = new ImportExportLocator();
            spiraTeamLocator.setMaintainSession(true); // enable cookies
            spiraTeamLocator.setEndpointAddress(spiraTeamLocator.getBasicHttpBinding_IImportExportWSDDServiceName(), spiraTeamLocator.getBasicHttpBinding_IImportExportAddress());
            spiraImportExport = spiraTeamLocator.getBasicHttpBinding_IImportExport();
            spiraImportExport.connection_Authenticate(p_user, p_passwd);
            // get the release id
            RemoteFilter[] releaseFilters = new RemoteFilter[1];
            releaseFilters[0] = getStringFilter("VersionNumber", p_releaseVersion);
            RemoteRelease[] releases = spiraImportExport.release_Retrieve2(releaseFilters, 1, 4);
            if (releases.length != 1)
                System.err.println("Web service found " + releases.length + " releases for version: " + String.valueOf(p_releaseVersion));
            releaseId = releases[0].getReleaseId();
            // only want incidents resolved in a single release
            RemoteFilter[] incidentFilters = new RemoteFilter[1];
            incidentFilters[0] = getIntFilter("ResolvedReleaseId", releaseId);
            // want the list of incidents sorted by Incident number, lowest
            // incident number first
            RemoteSort remoteSort = new RemoteSort();
            // make the web service call to get the incidents
            RemoteIncident[] remoteIncidents = spiraImportExport.incident_Retrieve(incidentFilters, remoteSort, 1, 9999);
            // Loop through and display ID, and name
            for (RemoteIncident remoteIncident : remoteIncidents)
                System.out.print("  ");
            if (spiraImportExport != null)
                spiraImportExport.connection_Disconnect(); // tidy up
    private static RemoteFilter getStringFilter(String p_name, String p_value)
        RemoteFilter filter = new RemoteFilter();
        return filter;
    private static RemoteFilter getIntFilter(String p_name, int p_value)
        RemoteFilter filter = new RemoteFilter();
        return filter;
    public static void main(String[] args) throws Exception
        int projectId = 28    // PR000028; 
        String user = "username";
        String passwd = "password";
        String releaseVersion = "2.1.0__13";  // Version #
        if (args.length == 1)
            releaseVersion = args[0];
        printReleaseNotes(projectId, releaseVersion, user, passwd);

  • Started: 7/4/2012
  • Last Reply: 7/11/2012
  • Replies: 2
  • Views: 1343
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2017 | Licensed to Inflectra Corporation.