It's all about the answers!

Ask a question

Server stopps responding after PUT request

Jorge Zingg (213) | asked Jan 17 '19, 3:32 a.m.

 I am trying to update some test case data programmatically via PUT request. On the first request, everything works fine. After that, the next PUT request just times out, the RQM server seems to stop responding to any requests, also GET or POST requests fail with timeout.

Is this a known issue, or should i do some kind of logout after a PUT request or something similar? If I wait a while and login-logout to RQM interactively a couple of times, it works again, but again only once.

Accepted answer

permanent link
Jorge Zingg (213) | answered Jan 17 '19, 8:48 a.m.

 Somehow I had commented out my "response.close()" during login. So for the server I was initiating a session again and again, so the sessions were locking out each other.

Now I'm taking extra care to really close the requests and all is working fine...

Ralph Schoon selected this answer as the correct answer

3 other answers

permanent link
Ralph Schoon (62.9k33645) | answered Jan 17 '19, 5:47 a.m.

 There is pretty much no usable information in this post. See How should I ask a question in the Forum if I want to receive useful answers?

Since the Web UI uses PUT all the time, I would assume it is your client and its usage that creates the lock up. Since you omitted providing any insight in how the PUT is done, I'd suggest you search in a forum related to your method doing the PUT. 

If, after your PUT, communication with the server is no longer possible using a Browser, your PUT kills the server which should not happen. The server log could be a place to start.

permanent link
Paul Slauenwhite (8.4k12) | answered Jan 17 '19, 6:19 a.m.

As Ralph mentioned, it's difficult to provide assistance with no details (including the REST API you are using).  I would suggest it's your HTTP client since this is not an expected behaviour.

Ralph Schoon commented Jan 17 '19, 6:28 a.m.

It could be something basic as a missing consumeContent() on the Apchae httpClient instance. 

permanent link
Jorge Zingg (213) | answered Jan 17 '19, 7:48 a.m.

 Thanks for the answers, I'll try to be more specific:

What I am trying to do is update the description of many test cases in RQM programmatically. So I GET the test case, do some minor changes in the XML I received from the GET request and PUT back the whole XML to RQM.

I am trying to connect via c# programmatically to our companies RQM server. My c# application does an authentication somthing like this:

request2 = (HttpWebRequest)WebRequest.Create(_rqmSrvr + "/jts/authenticated/j_security_check?j_username="+ username + "&j_password="+ password);

Then I get a response with the authentication cookie and store that for later use. This works fine. The next thing I do in my code is a GET request, something like:

XDocument testcase = RQMGetRequest(_rqm_srvr+"/qm/service/")

The method uses the cookie internally and puts it in the CookieContainer of the GET request.

This also works fine.
I then modify the description of the test case, and send it back with something like:

RQMPutRequest(_rqm_srvr+"/qm/service/", myModifiedXml)

Where I also provide the cookie container internally in that method.

The PUT method internally looks like this:

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(prefix + querySuffix);
            request.CookieContainer = _rqmSessionCookieContainer;
            request.Method = "PUT";
            request.Accept = "application/xml";
            request.ContentType = "text/xml; encoding='utf-8'";
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes(xdoc.ToString());
            request.ContentLength = bytes.Length;
            Stream requestStream = request.GetRequestStream();
            requestStream.Write(bytes, 0, bytes.Length);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

I am just trying out things at the moment, so I do the whole procedure every time new: 
- Login to the server
- Get the cookie
- Do the GET request for a single (sample) test case
- Do the PUT request
First time: all ok, second dime: Timeout

Maybe there is there some kind of disposal of the session that I should do, before starting the second time? 

I have no access (or I don't know how to access) the RQM server logs, unfortunately...

Thanks for the advice again, I hope this makes a bit clearer what I want to do...

Ralph Schoon commented Jan 17 '19, 8:02 a.m.

I am not a RQM API expert, however:

  • The API you use does not seem to be a supported API. 
  • I would have expected an OSLC API. An OSLC header is missing.
  • "/qm/service/" is not an URI I would consider to find in the OSLC discovery documents or service providers

Jorge Zingg commented Jan 17 '19, 8:47 a.m.

 Hi Ralph, 

Thanks again... I thought OSLC and REST were supported? 
Anyway, as usual the problem was on the other side of the keyboard (see my own answer below).

I will look into this, maybe it's better to use the OSLC approach if classical REST is really not supported. 

Ralph Schoon commented Jan 17 '19, 9:16 a.m.

OSLC is supported but "/qm/service/" does not look like an OSLC URI and OSLC would require an OSLC header as well.

So you are NOT using an OSLC API as far as I can tell. Probably an internal API. Not totally sure though. 

Your answer

Register or to post your answer.