Always Getting an HTML in Response from RTC
It seems like the RTC server doesn't like my url request. After the /ccm/ part, I can essentially write whatever I want and get the same result. So I'm guessing something about what I've got is wrong. Following the answer from my previous [post][1], I'm pretty sure I have the right link from the "services" file in the <oslc_cm:simpleQuery><dc:title>Change request queries</dc:title> tag. So I'm not sure if there's something else it doesn't like? It no longer fails authentication and I'm now using form-based rather than basic, so I don't think it's authentication-related. Any ideas?
Accepted answer
I can't say enough about Postman to figure this all out. Thanks, @Ralph Schoon for that tip! Apart from that, my issues were many. The HTML was definitely indicating a problem with authentication.
This is what I've come to understand.
The comment "// * Still says AuthRequired here for some reason *" is telling of the fact that authorization is indeed not occurring. The header value for "X-com-ibm-team-repository-web-auth-msg" will indeed be null when it is officially no longer required.
It is failing because:
- The _formPost itself needs basic authentication to post the form values
- The CookieContainer is null. Creating a new CookieContainer allows for the authentication to proceed.
- The "authenticated/j_security_check" is not correct. It should simply be "j_security_check".
- When requesting the data a second time after authenticating, a new request must be created and using the CookieContainer from the original.
Comments
One other answer
- Use GET not POST
- Use Postman until you understand what you are doing See https://rsjazz.wordpress.com/2019/05/13/using-a-rest-client-to-authenticate-to-elm-clm-applications/
-
JSON is not necessarily supported for everything.