Q:

Get only selected attributes via Java/WebService API

Using a Java application and the Rally WS API (XML) I'd like to make a query that returns me only a subsite of attributes for the object HierarchicalRequirement. 
What I've written is:
 QueryResult result = new QueryResult();
 result = service.query(ws, resultType, query, null, false, 0, 100);

where resultType = HierarchicalRequirement e query is 

(Project. Name = "Sample Project")& fetch="Name,FormattedID"

Am I doing something wrong or is it not a supported function? 
Thanks

A:

SOAP works a bit differently from REST insofar as there is no Fetch parameter.  It either fully hydrates the objects returned from Rally with their data fields, or it doesn't.  The function prototype for a query looks like this:
    queryResult = rallyService.query(workspace, artifactType, queryString, order, 
                    fetchFullObjects, start, pageSize);

So in your query you have specified "false" for fetchFullObjects.  This is certainly more efficient in terms of data transfer because you are only fetching Object shells.  If you want to hydrate a specific returned object with data, you can do an additional service.read() on it, i.e.
    DomainObject myObject = (DomainObject) queryResult. Results[0];
    DomainObject myFullObject = service.read(myObject);

Alternatively, you could just set fetchFullObject = true; recognizing there will be a performance impact in terms of the amount of data serialized and returned to your client. 
From there, you can use the object's get methods to pull data out of its fields.