Unable to initialize JazzRootServicesHelper class with webContextUrl for RM and OSLC constants from OSLC4Net

I am trying get the service provider catalog from RM root services with the help of JazzRootServicesHelper class from OSLC4Net library.

When I tried to initialize the JazzRootServicesHelper with below code:

//Step 1
JazzRootServicesHelper helper = new JazzRootServicesHelper(webContextUrl, OSLCConstants.OSLC_RM_V2);

//STEP 2: Create a new Form Auth client with the supplied user/password
JazzFormAuthClient client = helper.InitFormClient(user, passwd);

//STEP 3: Login in to Jazz Server
if (client.FormLogin() == HttpStatusCode.OK)
	Console.WriteLine("Jazz client login sucessfully ");

	//STEP 4: Get the URL of the OSLC RM catalog
	String catalogUrl = helper.GetCatalogUrl();

	//STEP 5: Find the OSLC Service Provider for the project area we want to work with
	String serviceProviderUrl = client.LookupServiceProviderUrl(catalogUrl, projectArea);

At Step 1 below Exception occur :

Message "OSLCC003: An error occurred processing the root services document. Server location: https://servername.com:9443/rm/." string
StackTrace = " at OSLC4Net.Client.Oslc.Jazz.JazzRootServicesHelper.ProcessRootServices() in C:\New folder\OSLC4Net_SDK\OSLC4Net.Client\Oslc\Jazz\JazzRootServicesHelper.cs:line 194\r\n at OSLC4Net.Client.Oslc.Jazz.JazzRootServicesHelper…ctor(String url, String…

From JazzRootServicesHelper class throwing exception :

StackTrace = " at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)\r\n at System.Threading.Tasks.Task1.get_Result()\r\n at OSLC4Net.Clien…

Basically it’s breaking while get resource from rootServiceClient

try {
	OslcClient rootServicesClient = new OslcClient();
	HttpResponseMessage response = rootServicesClient.GetResource(rootServicesUrl, OSLCConstants.CT_RDF);
	Stream stream = response.Content.ReadAsStreamAsync().Result;
	IGraph rdfGraph = new Graph();
	IRdfReader parser = new RdfXmlParser();
	StreamReader streamReader = new StreamReader(stream);

	using(streamReader) {
		parser.Load(rdfGraph, streamReader);

		//get the catalog URL
		this.catalogUrl = GetRootServicesProperty(rdfGraph, this.catalogNamespace, this.catalogProperty);

		//get the OAuth URLs
		this.requestTokenUrl = GetRootServicesProperty(rdfGraph, JFS_NAMESPACE, JazzRootServicesConstants.OAUTH_REQUEST_TOKEN_URL);
		this.authorizationTokenUrl = GetRootServicesProperty(rdfGraph, JFS_NAMESPACE, JazzRootServicesConstants.OAUTH_USER_AUTH_URL);
		this.accessTokenUrl = GetRootServicesProperty(rdfGraph, JFS_NAMESPACE, JazzRootServicesConstants.OAUTH_ACCESS_TOKEN_URL);
		try { // Following field is optional, try to get it, if not found ignore exception because it will use the default
			this.authorizationRealm = GetRootServicesProperty(rdfGraph, JFS_NAMESPACE, JazzRootServicesConstants.OAUTH_REALM_NAME);
		} catch(ResourceNotFoundException e) {
			// Ignore
} catch(Exception e) {
	throw new RootServicesException(this.baseUrl, e);

Hi @spatil64,

First of all, welcome to the forum!

OSLC4Net has not been maintained for many years now (I think 8-10 years is more precise). I moved it from CodePlex which was shut down many years ago and put it on GitHub - OSLC/oslc4net but there have been no releases since. We are looking for enough community demand to start looking into it. At this point, I can only recommend you dig into the problems yourself and contribute back suggested fixes.

Regarding your problem, https://JazzRootServicesHelper.cs#L170 seems like a good place to start with a breakpoint. I also see exceptions with async there, and there is only one async call in that method at JazzRootServicesHelper.cs#L171. This makes me think that you are not even getting HTTP response properly even before you get a chance to parse it. I would strongly suggest something like https://mitmproxy.org/ or https://goreplay.org/ to check what goes on on the wire.

If you can, I strongly recommend to use Lyo OSLC Client in Java, which is the only supported OSLC client we know of in 2021.

Best regards,

Hi Andrew,

Thanks for your quick help.
Will check and let you know .


1 Like