Using the JIRA Soap interface from Ruby
There’s is surprisingly little documentation about calling into the JIRA bug tracking system from Ruby using the JIRA Soap interface.
I had to jump through quite a few hoops to make this work. Here’s what I did, to try to spare you the same pain. (There are a few missing details that I’ll reconstruct via more Google searches if anyone is really interested.)
1. I used the wsdl2rb tool to generate a Ruby wrapper interface based on the wsdl file from Ruby. Ruby ships with the soap4r, the soap interface, but it doesn’t actually ship with the batch file wrapper, so I had to download that separately. (URL findable via Google.)
2. There was a bug in soap4r that prevented it from handling the WSDL file correctly, so I had to install a patch to fix that bug.
3. There are few if any examples of using the complex types in the SOAP interface from Ruby. Python seems to automatically convert simple hash tables to structured types, but Ruby’s SOAP interface will give a type error unless you use the appropriate class wrappers. Almost through trial and error, I worked out the following, which does work.
#!/usr/bin/env ruby
require 'defaultDriver.rb'
obj = JiraSoapService.new()
token = obj.login("test", "test")
field = RemoteFieldValue.new('summary',
['[Updated] Issue updated with Ruby'])
obj.updateIssue token, 'JOB-6562', [field]
4. Unfortunately, I found Atlassian’s developer forums and documentation a little hard to search and navigate, at least for answering this question. I’m posting it to this blog rather than the forums because I have greater confidence that someone one will be able to find it.
Now that it’s finally working, I’m pretty excited about the ability to script and automate JIRA from external tools.
4 Comments so far
Leave a comment
Hi Phil,
This is _exactly_ what I’m looking for. I’m just starting out with Ruby on Rails, would you mind giving me a bit more info on:
1. Where you found the batch file (I not sure what I would even search for)
2. Which patch?
3. Any other gotchas I shoudl know about?
Thanks!
By Craig on 12.21.05 1:45 pm
I am travelling internationally tomorrow but will try to dig this up before I go.
By philbo on 12.21.05 2:42 pm
Great! Much appreciated!
By Craig on 12.21.05 2:51 pm
Check out JiraRuby, which is described here here. This has a working SOAP driver you can download.
By philbo on 01.12.06 9:16 am
Leave a comment