Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How can I get authentication to access Doors NG with OSLC using oslc4net

Hello,

I'm trying to access resources in DOORS NG using C# and the oslc4net libraries.
I'm following the example code which is in RRCFormSample.cs.

However, even though  step 1 and 2 function without error, when I try to get the service provider catalog I get the error The remote server returned an error: (401) Unauthorized.

Could somone tell me if what I'm doing is the right way to become authorized?
By the way, if I log in with these credentials into the browser, it works fine.

Regards,

Ian     


            String webContextUrl = "https://iw.airbus.com:9443/rm/";
            String user = "jean-luc";
            String passwd = "jean-luc";
            String projectArea = "JKE Banking (Requirements Management)";

            //STEP 1: Initialize a Jazz rootservices helper and indicate we're looking for the RequirementManagement catalog
            JazzRootServicesHelper helper = new JazzRootServicesHelper(webContextUrl, OSLCConstants.OSLC_RM_V2);
            //STEP 2: Create a new Form Auth client with the supplied user/password
            //RRC is a fronting server, so need to use the initForm() signature which allows passing of an authentication URL.
            //For RRC, use the JTS for the authorization URL
            //This is a bit of a hack for readability.  It is assuming RRC is at context /rm.  Could use a regex or UriBuilder instead.
            String authUrl = webContextUrl.Replace("/rm", "/jts"); // XXX - should be ReplaceFirst(), if it existed
            JazzFormAuthClient client = helper.InitFormClient(user, passwd, authUrl);
   //STEP 3: Login in to Jazz Server
            if (client.FormLogin() == HttpStatusCode.OK)
            {
                string Choice = "https://iw.airbus.com:9443/rm/discovery/RMCatalog";
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Choice);

**AUTHENTICATION ERROR OCCURS ON NEXT LINE****
              HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                Stream stream = response.GetResponseStream();
                StreamReader reader = new StreamReader(stream);
                string data = reader.ReadToEnd();
                reader.Close();
                stream.Close();

0 votes


Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 11,089

Question asked: Oct 21 '14, 12:13 p.m.

Question was seen: 3,429 times

Last updated: Oct 21 '14, 12:13 p.m.

Confirmation Cancel Confirm