Error during QM Test Case update REST API call
I've wrote a simple C# program to test QM update using OSLC4NET API and RQMFormSample.cs from the OSLC4NET site; the program reads an existing test case and updates the title, but when the UpdateResources is performed, the server returns the following error:
017-12-10 12:42:36,717 [Default Executor-thread-529 @@ 12:42 mondainiriccardo <No User Agent@127.0.0.1> /qm/oslc_qm/contexts/_ltAEkNnmEeehlbPFkEJIaQ/resources/com.ibm.rqm.planning.VersionedTestCase/_a9lTEtprEee3d-SLPPxrUQ] ERROR com.ibm.rqm.oslc.serv
ce - OslcUtils:logMessage AQXCM5011E A server error occurred while running the HTTP operation, PUT, at this URL: https://localhost:9443/qm/oslc_qm/contexts/_ltAEkNnmEeehlbPFkEJIaQ/resources/com.ibm.rqm.planning.VersionedTes
Case/_a9lTEtprEee3d-SLPPxrUQ?oslc.properties=dcterms:title. The response code is 500.
om.ibm.team.repository.common.TeamRepositoryException: false^^http://www.w3.org/2001/XMLSchema#string is not a Boolean
This is my sample code:
using System;
using OSLC4Net.Client.Oslc;
using OSLC4Net.Client.Oslc.Resources;
using System.Net.Http;
using OSLC4Net.Core.Model;
using System.Windows.Forms;
namespace RQMInterface
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
CommonFunctions common = CommonFunctions.Instance;
private void button1_Click(object sender, EventArgs e)
{
String catalogUrl = common.helper.GetCatalogUrl();
TestCase testcase;
common.serviceProviderUrl = common.client.LookupServiceProviderUrl(catalogUrl, "Tes Test Interno");
String urlTestCase = common.serviceProviderUrl.Substring(0, common.serviceProviderUrl.LastIndexOf("/"));
String queryCapability = common.client.LookupQueryCapability(common.serviceProviderUrl, OSLCConstants.OSLC_QM_V2, OSLCConstants.QM_TEST_CASE_QUERY);
OslcQueryParameters queryParams = new OslcQueryParameters();
queryParams.SetWhere("oslc:shortId=\"" + txtCase.Text + "\"");
OslcQuery query = new OslcQuery(common.client, queryCapability, queryParams);
OslcQueryResult result = query.Submit();
HttpResponseMessage response = null;
String[] lista = result.GetMembersUrls();
testcase = common.client.GetResource(lista[0], OslcMediaType.APPLICATION_RDF_XML).Content.ReadAsAsync<TestCase>(common.client.GetFormatters()).Result;
testcase.SetTitle(testcase.GetTitle() + " (updated)");
String updateUrl = testcase.GetAbout() + "?oslc.properties=dcterms:title";
response = common.client.UpdateResource(updateUrl, testcase, OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_RDF_XML);
response.ConsumeContent();
}
}
}
Accepted answer
I tried the test the same functionalities using Java OSLC LYO and the testcase update is performed correctly.
So, the problem is associated with a bug on OSLC4NET version.
Comments
I would suggest using a HTTP client (e.g. Poster or Advanced REST Client) to try/test your OSLC QM API request to rule out your code/OSLC4NET. If the root cause is not clear, start troubleshooting (see https://jazz.net/wiki/bin/view/Main/RqmOslcQmV2Api#Troubleshooting).
I changed the summary and the tagging to make clear what the question is really about.