forked from nmusaelian-rally/rally-java-rest-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSOAPupdateUserStory.java
84 lines (57 loc) · 2.85 KB
/
SOAPupdateUserStory.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import com.rallydev.webservice.v1_43.domain.*;
import com.rallydev.webservice.v1_43.service.*;
import org.apache.axis.client.Stub;
import java.net.URL;
import java.net.MalformedURLException;
//SOAP AND XML ARE NO LONGER SUPPORTED. IT IS RECOMMENDED TO USE REST INSTEAD OF SOAP. THIS CODE IS ONLY AN EXAMPLE.
public class SOAPupdateUserStory {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
URL rallyURL;
RallyService rallyService = null;
try {
rallyURL = new URL("https://rally1.rallydev.com/slm/webservice/1.43/rallyservice");
rallyService = (new RallyServiceServiceLocator()).getRallyService(rallyURL);
} catch (MalformedURLException e) {
e.printStackTrace();
throw new Exception("RallyWebServiceClient.main problem in creating the URL.");
} catch (Exception e) {
e.printStackTrace();
throw new Exception("RallyWebServiceClient.main problem in creating the service.");
}
if (rallyService == null) {
throw new Exception("RallyWebServiceClient.main service null!");
}
Stub serviceStub = (Stub) rallyService;
serviceStub.setUsername("[email protected]");
serviceStub.setPassword("secret");
serviceStub.setMaintainSession(true);
Workspace workspace = new Workspace();
workspace.setRef("https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1011574887");
String queryString = "(FormattedID = \"US2736\")";
String order = "FormattedID desc";
String artifactType = "HierarchicalRequirement";
long start = 1;
long pageSize = 20;
boolean fetchFullObjects = true;
QueryResult queryResult = rallyService.query(workspace, artifactType, queryString, order, fetchFullObjects, start, pageSize);
System.out.println("Query returned: " + queryResult.getTotalResultCount() + " objects.");
System.out.println("Query returned: " + queryResult.getTotalResultCount() + " objects.");
DomainObject[] queryResults = queryResult.getResults();
for (int i=0; i < queryResults.length; i++) {
DomainObject rallyObject = (DomainObject) queryResults[i];
System.out.println(" result[" + i + "] = " + rallyObject);
System.out.println(" ref = " + rallyObject.getClass());
HierarchicalRequirement myStory = (HierarchicalRequirement) rallyObject;
System.out.println(" Story Name: " + myStory.getName());
System.out.println(" Story ScheduleState: " +myStory.getScheduleState());
myStory.setScheduleState("In-Progress");
myStory.setDescription("my description &()#*%");
OperationResult operationResult = rallyService.update(myStory);
System.out.println(" Story State after update = " + myStory.getScheduleState());
System.out.println(" Story Description after update = " + myStory.getDescription());
}
}
}