In fact, JIRA enables remote access through both SOAP and XML-RPC. SOAP is recommended because it covers more operations!
So how does it all fit together? What are the simple steps to create a SOAP client.
1. Download the latest demo SOAP client distribution from the Atlassian public repository. This contains a Maven 2 project configured to use Apache Axis, and a sample Java SOAP client which creates test issues in http://jira.atlassian.com. You can alternatively download the source code at the end of the tutorial!
2. Modify the 'jira.soapclient.jiraurl' property in your pom.xml to point to your JIRA instance. By default it points to http://jira.atlassian.com
3. You can find the wsdl file under the /src/main/wsdl location. If it is not there or if you want to download the wsdl afresh, run the following command.
mvn -Pfetch-wsdl -Djira.soapclient.jiraurl=http://{your_jira_instance}/
4. Now we have the wsdl ready and it is time to create the client jar. Run the following command to generate the sources from the wsdl and to create the SOAP client.
mvn -Pbuildclient
Let us now look at writing our SOAP program. We are trying the simplest approach , i.e to create the an Eclipse project by running the following.
mvn eclipse:eclipse
From now on, it is just another webservice invocation! The first step in writing the SOAP client is to get the SOAP service locator. Once you have the locator, get the SOAP service instance from the same by passing a new URL (of your JIRA instance).
jiraSoapServiceLocator = new JiraSoapServiceServiceLocator();
jiraSoapService = jiraSoapServiceLocator.getJirasoapserviceV2(new URL(your_url));
String token = getJiraSoapService().login(your_username, your_password);
Let us just try getting an issue using the key and print its key and id to prove that this stuff works!
RemoteIssue issue = jiraSoapService.getIssue(authToken, ISSUE_KEY);
System.out.println("Retrieved Issue:"+issue.getKey()+" with Id:"+issue.getId());

jira-soap-client.zip |