creating requirement in RRC using c#.net into JKE Banking(Requirements Management) - Project Area
Hi, Im new to c#.net and RRC. My aim is to create a requirement using c#.net. im using the following code:
--------------------------------------------------------------------------------------------------------
XmlDocument newdoc = new XmlDocument();
newdoc.XmlResolver = null;
newdoc.Load(@"C:\Users\anil\Desktop\new.xml");
string content=newdoc.InnerXml;
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequirementCreationFactoryresourceURI);
request.Method = "POST";
request.CookieContainer = cookies;
request.AllowAutoRedirect = false;
if (string.IsNullOrEmpty(login))
{
request.Credentials = CredentialCache.DefaultNetworkCredentials;
}
else
{
request.Credentials = new NetworkCredential(login, password);
}
byte[] byteArray = Encoding.UTF8.GetBytes(content);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
request.Headers.Set("OSLC-Core-Version", "2.0");
request.Accept = "application/rdf+xml";
documentGet.Timeout = 300000;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
--------------------------------------------------------------------------------------------------------
But im unable to create the requirement. can anyone explain where did i go wrong?
or if my entire approach is wrong can u guide me posting the code satisfying my requirement.
Note: I had tried the following content in HttpRequester (Add on for mozilla firefox) and it worked fine.
-------------------
POST https://localhost:9443/rm/requirementFactory?projectURL=https%3A%2F%2Flocalhost%3A9443%2Fjts%2Fprocess%2Fproject-areas%2F_6ddg8AOwEeKnNZwYHFq9wA
<?xml version="1.0" encoding="UTF-8"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:acp="http://jazz.net/ns/acp#" xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/" xmlns:dc="http://purl.org/dc/terms/" xmlns:nav="http://jazz.net/ns/rm/navigation#" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_rm="http://open-services.net/ns/rm#" xmlns:public_rm_10="http://www.ibm.com/xmlns/rm/public/1.0/" xmlns:rm="http://www.ibm.com/xmlns/rdm/rdf/" xmlns:rm_property="https://localhost:9443/rm/types/">
<oslc_rm:Requirement rdf:about="https://localhost:9443/rm/resources/_qDZXsAiREeKvB7mRd0vIRQ">
<nav:parent rdf:resource="https://localhost:9443/rm/folders/_6ddg8AOwEeKnNZwYHFq9wA"/>
<dc:description rdf:parseType="Literal"/>
<acp:accessControl rdf:resource="https://localhost:9443/rm/accessControl/_6ddg8AOwEeKnNZwYHFq9wA"/>
<dc:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-09-27T10:54:06.009Z</dc:modified>
<rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/>
<oslc:serviceProvider rdf:resource="https://localhost:9443/rm/discovery/_6ddg8AOwEeKnNZwYHFq9wA/services.xml"/>
<dc:creator rdf:resource="https://localhost:9443/jts/users/chalsak2"/>
<rm_property:_9SyvUQOwEeKnNZwYHFq9wA rdf:resource="https://localhost:9443/rm/types/_9ArroQOwEeKnNZwYHFq9wA#Text"/>
<oslc:instanceShape rdf:resource="https://localhost:9443/rm/types/_omyk4QOxEeKnNZwYHFq9wA"/>
<dc:contributor rdf:resource="https://localhost:9443/jts/users/chalsak2"/>
<dc:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-09-27T10:54:06.009Z</dc:created>
<dc:title rdf:parseType="Literal">New Requirement by anil</dc:title>
<dc:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">221</dc:identifier>
</oslc_rm:Requirement>
</rdf:RDF>
-------------------
nex.xml contains the above xml content [not POST <url>]
|
Accepted answer
Looks you are using the right approach. Try by changing :
request.ContentType = "application/x-www-form-urlencoded"; to request.ContentType = "application/rdf+xml"; chaluvadi sri anil kumar selected this answer as the correct answer
|
3 other answers
Hi Anil, I am New to RRC and I want to update/modify artifact So can you please tell e what will be the URL for the same. Actually i want to Update it throught REST. |
There is no additional information to create the workitem, using c# language ,
Is the above code is applicable for RTC ( rational team concert) ? or only for the RRC ?
can anyone help resolving it .
Thanks in advance
|
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.