It's all about the answers!

Ask a question

Creating a ticket via POST using OSLC v2 using C# web api


Peter Taylor (111) | asked Aug 30 '15, 12:27 p.m.
Hi everyone,

I've got a little problem trying to create a new ticket in RTC.  I'm using forms authentication using an implementation shown here: https://nkumar83.wordpress.com/2013/06/13/consuming-rtc-rational-team-concert-oslc-apis-using-c-post-1-authentication/

Up until now I've only had to use the GET and PUT methods for my calls to RTC, which have worked fine.  I'm now trying to send a POST request to have a new ticket created.  My code can successfully iterate the root services doc and work it's way through to find the creation factory URL for a ticket, in this case I'm working with unclassified tickets.  The URL that my code has picked out is 100% the correct path as I've tested manually via Firefox using RESTClient.  In fact, using the RESTClient I can create a ticket manually.

I'm using the HttpWebRequest method in my code to build up a request for the RTC server.  However when I make the call the RTC server is sending back a list of tickets.  I can reproduce this behaviour manually if I set the RESTClient to use GET instead of POST against the creation factory URL.

It's as though the RTC server for whatever reason wants to send data back for a GET request rather than process as a POST.

I'm at a loss as to why this is happening. 

Project details:
ASP.NET C# Web Api
OSLC v2
Setting headers for accept and content type as: application/rdf+xml

Any advice or pointers would be appreciated as I'm completely stuck.

Thanks.

One answer



permanent link
Donald Nong (14.5k414) | answered Aug 30 '15, 10:09 p.m.
Take a look at this article instead.
https://jazz.net/library/article/1001

If you are still having the problem, post the link of your POST operation, and the response header/body of the operation.

Comments
Peter Taylor commented Aug 31 '15, 6:06 a.m. | edited Aug 31 '15, 9:41 a.m.

Hi Donald,

Thanks for replying.  Here is the info you requested, hopefully it will shed some light?



Header content for POST request:

     Content-Type: application/rdf+xml
     Accept: application/rdf+xml
     OSLC-Core-Version: 2.0
     Host: {hosthere}:{porthere}
     Cookie: JSESSIONID={valuehere}; JazzFormAuth=Form; JSESSIONIDSSO={valuehere}

Method: POST
Protocol version: 1.1

Request URI: https://{serverpath}:{portvalue}/jazz/oslc/contexts/{valueobmitted}/workitems/TypeID.UnclassifiedTicket}

UserAgent: null

==================

Response headers:

OSLC-Core-Version: 2.0
Vary: Accept, OSLC-Core-Version
Transfer-Encoding: chunked
Cache-Control: private, max-age=0, must-revalidate
Content-Type: application/rdf+xml;charset=UTF-8
Date: Mon, 31 Aug 2015 09:49:48 GMT
Expires: Mon, 31 Aug 2015 09:49:48 GMT
ETag: "{valueremoved}"
Server: Apache-Coyote/1.1

Response URI: https://{serverpath}:{port}/jazz/oslc/contexts/{valueobmitted}/workitems/TypeID.UnclassifiedTicket?oslc.pageSize=50&_resultToken={valueobmitted}&_startIndex=0


Method: GET
Protocol version: 1.1
StatusCode: OK
StatusDescription: OK

The body is just a list of unclassified tickets which you can get by doing a GET operation against the requested URI in the original POST request.


Peter Taylor commented Aug 31 '15, 6:08 a.m.

Just to confirm I removed/obmitted some of the values to remove any sensitive info. :o)


Donald Nong commented Sep 03 '15, 8:52 p.m.

I re-read your original post and and realized that you had already done the verification on the POST URL and contents, so there should be no doubt on the RTC server side. I wonder whether it is an issue related to ASP.NET Web API, similar to this one?
http://stackoverflow.com/questions/10984040/post-parameter-is-always-null

Your answer


Register or 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.