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();