Nowadays, Atlassian products become more and more popular. Different companies and teams start using Jira and Confluence for project management. It would be good to have an ability to communicate with these services from .NET. As you probably know, Jira and Confluence are pure Java applications. Both applications provide SOAP and REST services. REST is a new target for Atlassian, they focused on it and do not touch SOAP anymore. So SOAP services live with all their bugs inside and even deprecated in JIRA 6.0.
It is a bit strange for me. I can understand REST benefits, but it is step backward for developers’ convenience. Each programming language should maintain a client library. Any change in REST API can break all client tools. REST produces a lot of headache for service users. IMHO, REST should be done in OData manner to simplify life for API users. But it is out of topic a bit.
I have tried to use Jira and Confluence web services some time ago, it was harder and more limited then existing SOAP ones. I have not checked the latest ones, you can try if you wish: Confluence REST API documentation and JIRA REST API Tutorials. As I know, there is no mature client libraries for .NET.
I have already tried to get to work F# WSDL Type Provider and Confluence SOAP service. But it does not work, because a Confluence SOAP endpoint is not compatible with WCF. There is a known bug “Creating Service Reference from JIRA WSDL in Visual Studio 2010 generates all methods void“, that would not be fixed.
Workaround for C# guys
The workaround is to create a Web Reference vs Service Reference. Details you can find on StackOverflow: “Web Reference vs. Service Reference“. But I want to repeat these steps here:
- Click on ‘Add Service Reference’.
- Click on ‘Advanced’ button.
- Click on ‘Add Web Reference’ button.
- Paste an URL to the WSDL of Confluence SOAP service and click on the ‘Go to …’. (https://developer.atlassian.com/rpc/soap-axis/confluenceservice-v2?WSDL)
- Click on ‘Add reference’ button.
- Repeat same steps for Jira SOAP service. (https://jira.atlassian.com/rpc/soap/jirasoapservice-v2?WSDL)
- That is all you need to start working with Jira and Confluence. As a result, you should see two web references in your project.
Workaround for F# guys
The easiest way to do it from F# is to build proxy library in C# and reference it from F#. I have already done it and if you wish you can download it from GitHub. There is one issue in such solution – function’s parameters named in not readable way like arg0, arg1 and so on. To understand what actually you should pass to the service you need to check actual parameter names in documentation: JiraSoapService and ConfluenceSoapService.
Confluence sample script:
#r @"..\Altassian.Proxy\bin\Release\Altassian.Proxy.dll" open Altassian.Proxy.com.atlassian.confluence let service = new ConfluenceSoapServiceService(Url = @"https://SERVER_NAME/rpc/soap-axis/confluenceservice-v2?WSDL") let token = service.login("LOGIN","PASSWORD") service.getSpaces(token) |> Seq.iter (fun x-> printfn "%s" x.name ) service.Dispose()
Jira sample script:
#r @"..\Altassian.Proxy\bin\Release\Altassian.Proxy.dll" open Altassian.Proxy.com.atlassian.jira let service = new JiraSoapServiceService(Url = @"https://SERVER_NAME/rpc/soap/jirasoapservice-v2?wsdl") let token = service.login("LOGIN","PASSWORD") service.getIssuesFromJqlSearch(token, "status = open", 10) |> Seq.iter (fun x-> printfn "%s" x.summary ) service.Dispose()