Monday, April 13, 2009

Using Rally Java Web Service API

 There are a number of developer tools that can be used from Rally ranging from integrating Rally to a different application(s) or just plainly extracting data from Rally. This link provides necessary rally developer documentation.

Web Service API

Since Rally supports several implementation of their WS API this will mainly focus on SOAP in Java. You can find on this link the other implementations. The only thing I don't like about this API implementation is that you always have to pass the object reference through the wire to get the values of the object. The WS calls are so fine-grained that the number of objects queried is directly proportional to the number of round-trip calls. The sample usage of the SOAP in Java implementation is shown below in sequence.

Assuming our target of interest is to extract a Story from Rally. The Story in Rally is actually map to a SOAP object called HierarchicalRequirement. Always remember to use the read() method of RallyService? object to grab the physical object from Rally.

  1. Grab the WSDL from the current version of your Rally application which might have the form
  2. Generate the Java code from the given wsdl file. Their will be 3 packages generated - com.rallydev.webservice.domain and com.rallydev.webservice.service.
    • com.rallydev.webservice.domain contains all SOAP objects that represent the data in Rally.
    • com.rallydev.webservice.service contains the web service interface.
  3.  Acquire connection from the web service endpoint and grab available Workspaces.
     URL url = new URL("");
    RallyService service = (new RallyServiceServiceLocator()).getRallyService(url);

    Stub stub = (Stub)service;
    Subscription subscription = (Subscription)service.getCurrentSubscription();
    Workspace[] workspaces = subscription.getWorkspaces();
    if(workspaces==null || workspaces.length==0){
    errorBuf.append("The login credentials doesn't have any subscription or there are " +
    "no Workspaces configured from Rally.");
    writeToFile(serviceBean, errorBuf.toString());
    return null;
  4. If the target workspace is "IT: the next generation" then loop through the workspaces that matches that workspace.
    Workspace workspace = null;
    for(int i=0; i<workspaces.length;i++){
    WSObject wsObject = (WSObject)[i]);
    workspace = (Workspace)wsObject;
    String workspaceName = workspace.getName();
    if(workspaceName.equalsIgnoreCase("IT: the next generation" )){
  5. Submit query and get results (DomainObject?[]). The serviceBean.getQuery() is a name/value pair which might be of the form Release.Name= "Test Release For TWiki" AND ScheduleState? = "Completed". Process each DomainObject?.
    QueryResult queryResult = service.query(workspace, "HierarchicalRequirement", serviceBean.getQuery(), "", false, 1, 100);
    for(int i=0; i<queryResult.getErrors().length;i++){
    errorBuf.append("ERROR: ");
    writeToFile(serviceBean, errorBuf.toString());
    return null;
    DomainObject[] domainObjects = queryResult.getResults();
    if(domainObjects!=null && domainObjects.length>0){
    List releaseNotesBeanList = new ArrayList();
    TwikiBean twikiBean = new TwikiBean();
    Map packageStoryMap = new HashMap();
       for(int i=0;i<domainObjects.length;i++){
    HierarchicalRequirement story = (HierarchicalRequirement)[i]);
    Release release = (Release);
    DateFormat dateFormat = DateFormat.getInstance();
    String releaseDate = dateFormat.format(release.getReleaseDate().getTime());
          if(story.getAttachments()==null || story.getAttachments().length==0){
    if(story.get_package()==null || story.get_package().equals("")){
    if(release==null || release.getName()==null
    || release.getName().equals("")){
    errorBuf.insert(0, "ERROR: User Story ID: " + story.getFormattedID() + "\n");
    writeToFile(serviceBean, errorBuf.toString());
          ReleaseNotesBean releaseNotesBean = new ReleaseNotesBean();
          Attachment[] attachments = story.getAttachments();
    Attachment attachment = attachments[0];
    attachment = (Attachment);
          AttachmentContent attachmentContent = (AttachmentContent);
    byte[] content = attachmentContent.getContent();
          String twikiTopic = new String(content);
    prepareTopics(releaseNotesBean, packageStoryMap);
    return twikiBean;


  1. I'm trying to do this with Iteration Burndown's in rally and for some reason when I query the CumulativeFlowData it doesn't compile. any tips?

  2. This is the perfect website for anybody who wants to find out about
    this topic. You understand a whole lot its almost tough to argue with you (not that I actually
    will need to…HaHa). You certainly put a fresh spin on a subject which
    has been discussed for decades. Excellent stuff, just great!

    Feel free to visit my web page ::

  3. Howdy! Do you use Twitter? I'd like to follow you if that would be ok. I'm definitely enjoying your blog and look forward to new updates.

    Here is my site ::

  4. I am extremely impressed together with your
    writing skills and also with the layout in your weblog. Is this a paid
    theme or did you modify it your self? Either way stay up
    the excellent quality writing, it's uncommon to look a nice weblog like this one nowadays..

    My web site ... Author's
    external home page...

  5. I constantly spent my half an hour to read this website's posts daily along with a mug of coffee.

    Here is my web-site; remove hair

  6. Generally we don't find out article on blogs, but I wish to assert that this write-up very forced me to confirm out and choose therefore! Your authorship essence has been surprised me personally. Say thanks a ton, really sweet article.

    Here is my web-site ... Author's external home page.

  7. Hello, Neat post. There is an issue together with your web site in web explorer, may test this?
    IE nonetheless is the market leader and a good element of
    folks will pass over your magnificent writing due to this problem.

    my website ::