Creating a JIRA SOAP client is pretty easy and is detailed in my previous tutorial. I am going to assume that you have the client created and a sample test done to ensure you are connected to your JIRA.
Before we proceed, let us have a quick look at the createIssue method in the SOAP API . As you can see, it accepts the token and a RemoteIssue object. The latter should be populated with all the necessary things needed for you issue, at-least all the mandatory fields!
This is how we populate the RemoteIssue:
issue.setProject(PROJECT_KEY);
issue.setType(ISSUE_TYPE_ID);
issue.setSummary("Test Issue via J Tricks tutorial");
System.out.println("\tSuccessfully created issue " + createdIssue.getKey());
RemoteComponent component = new RemoteComponent();
component.setId(COMPONENT_ID);
issue.setComponents(new RemoteComponent[] { component });
// Add remote versions - Should be an array of RemoteVersion
RemoteVersion version = new RemoteVersion();
version.setId(VERSION_ID);
issue.setFixVersions(new RemoteVersion[] { version });
If you need to apply a security level for the issue, you need to use the createIssueWithSecurityLevel method where you need to pass an additional parameter for the securityLevel.
May be one thing worth mentioning here! For the status, you shouldn't directly set it. Instead use the progressWorkflowAction method whcih we can look at at a later time.
That is it! We have the code for creating an issue via SOAP using the standard JIRA fields. Custom fields are not hard but it is better to cover in a separate post. Let us just make this short and sweet ;)
Download few examples with full source below. And don't forget to post your comments/feedback!
| jira-soap-client.zip |


RSS Feed