Problems connecting to https Jira server via the Atlassian .NET SDK

Mo Müller February 8, 2012

Hello,

I'm using the Atlassian .NET SDK. On the Bitbucket site of the developer of the .NET SDK (https://bitbucket.org/farmas/atlassian.net-sdk/wiki/Home) is the following example posted which shows how to connect to a Jira server:

 // create a connection to JIRA
 var jira = new Jira("http://<your_jira_server>", "<user>", "<password>");

After connecting to Jira it should be possible to query a JIRA server using Linq syntax (also shown on https://bitbucket.org/farmas/atlassian.net-sdk/wiki/Home):

// use LINQ syntax to retrieve issues
 var issues = from i in jira.Issues
              where i.Assignee == "admin" && i.Priority == "Major"
              orderby i.Created
              select i;

Now I'm trying to get his example to work. I wanted to start with a simple Console project in VIsual Studio 2010.

My problem is that the server I want to connect to is https. So I'm using System.Security.Cryptography.X509Certificates, System.Net.Security, using System.Net and System.Security.Cryptography to use descripted userdata and passworddata:

var jira = new Jira("https://<my_jira_server>", decryptString(secJiraUser, "123"), decryptString(secJiraPassword, "123"));

But when iI execute the applikation the following error occours:

There was no endpoint listening at https://<my_Jira_server>rpc/soap/jirasoapservice-v2 that could accept the message.

I really don't know what to do anymore.

Please, has anyone an idea how to fix it.

Thanks a lot,

Mel

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Mo Müller February 19, 2012

Hi Ivar,

thank you very much for your answer and your example. I checked out if the remote API calles are enabled and they are.

So this wasn't the problem. I tried different things and in the end I solved my problem by using the following syntax:

var jira = new Jira(@"http://", "", "");

Seams like there were problems with slashes and backslashes.

Now everything is working fine ;)

Thanks a lot for helping me.

Kind regards,

Mel

Ivar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2012

Good to hear. Weird you had to use the @ in front - guess it has something to do with this article: http://blogs.msdn.com/b/csharpfaq/archive/2004/03/12/what-does-an-before-the-start-of-a-string-literal-mean.aspx. Btw - no https in your example above, but I guess that was something you just forgot.

0 votes
Ivar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 16, 2012

Hi Mel!

Sorry I haven't had the time to reply before. You might even found the solution for this issue now. Anyways - my exact code, just leaving out the url for the Jira instance, my username and password, connected to Jira and received the issues "straight out of the box" is added below (console application in .Net). FYI - we (also) access Jira (4.3.4) over SSL.The SDK assembly was added as a reference in the Visual Studio project.

Question in regards to SSL - why decrypt the username? Why using X509Certificates at all?

My comment in regards to remote API calls was on the picture below. If you do not have admin rights, talk to the Jira admin and have him/her check this out.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Atlassian.Jira;

namespace ConnectToJiraUsing.NetSDK
{
    class Program
    {
        static void Main(string[] args)
        {
            Connect c = new Connect();
            c.OpenConnection();
        }
    }

    class Connect
    {
        public void OpenConnection()
        {
            try
            {
                var jira = new Jira("url", "u", "p");

                var issues = from i in jira.Issues
                             where i.Assignee == "u"
                             orderby i.Created
                             select i;

                jira = null;
            }
            catch (Exception ex )
            {
                // For debugging purposes
                string s1 = ex.Message;
            }
        }
    }
}

0 votes
Mo Müller February 9, 2012

Hi Ivar,

thank you very much for your answer.

To your question:

1. Where you able to connect using http or is that not an option for you to test at all?

It's not an option for me because I'm working for a company and so the connection have to be a save one.

Which brings me to your second question:

2. Have you enabled the API for remote connections?

I don't know exactly which API you mean. If you mean from the jira side: I don't have admin rights to do that. And in Visual Studio I can't find these settings (Administration > Global Settings > General configuration).

To your last point:

I tried to find an answer for my question on google, but the problem is that most of the suggestions deal with webservices and it looks like this error often occours in web service solutions.

I also tried to connect to the https jira server via webservice and I don't have any problems with that. But I'm trying to find an alternative solution.

Please, if someone has experiance with a console solution or any idea how to solve my problem, it would help me a lot.

Thank you for your time,

Mel

0 votes
Ivar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 8, 2012

1. Where you able to connect using http or is that not an option for you to test at all?

2. Have you enabled the API for remote connections? (Administration > Global Settings > General configuration

3. If yes on both: http://www.google.no/search?q=There+was+no+endpoint+listening+at+https&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events