Using OSLC and REST problems
RESPONSE:
Status Code: 400 BAD REQUEST.
PAGE:
You have followed a direct link to content hosted in a Jazz server. This page has been presented to ensure that a malicious website cannot use cleverly crafted content to circumvent security. If you would like to access the content, please use the link below.
Download content
The link is the one i am following form my application.
Any ideas? I just need to get the information in a txt file...
4 answers
I have this problem as well and setting the request header's type and accept values did not make a difference. I tried:
(The following pseudo-code is in VB.Net syntax)
dim Http as MSXML2.XMLHTTP
... Stuff up here...
Http.setRequestHeader("Content-Type", "application/xml")
Http.setRequestHeader("Accept", "text/xml")
Http.send(jazzUserid & "&" & JazzPassword)
This generates status 400 "Bad Request".
Note that this worked in RTC 4.0.1 and stopped working when we upgraded to 4.0.5.
I was having the same issue above (a POST or GET on the authentication URL from VBA was dying from 400 errors, even though the exact same code works from Perl/cuRL.)
The solution (at least for me) was that you have to set the User-Agent from your response header in VBA like so:
Set http = CreateObject("Msxml2.ServerXMLHTTP.6.0")
....
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
http.setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
http.setRequestHeader "User-Agent", "MS Internet Explorer"
Whatever user-agent value is being sent from VBA's COM interface class is considered invalid by RTC, no idea why and RTC offers not useful hint in the return headers (or it could be I'm not understanding them.)
Making this change allows me to successfully POST a login, get my JSESSIONID, and continue making calls on this object just fine.
By the way, the other COM interface works as well: Set http = CreateObject("MSXML2.XMLHTTP")
For simplicity, especially if you're making a light amount of REST calls, this is probably fine as it piggybacks from IE and uses the old UrlMon interface according to Microsoft. However, if you need fine-grain control over cookies you probably will want to go with the other interface in my code snippet above.
Keep in mind that enabling TLS 1.2 for these COM interfaces is a huge pain too, in the case that your organization may restrict SSLv2/v3/TLS1.0/TLS1.1 and requires TLS 1.2, as for Windows 7 users you will actually need to make registry edits defined here: https://support.quovadisglobal.com/kb/a433/how-to-enable-tls-1_2-on-windows-server-2008-r2.aspx
Comments
Mike Shkolnik
Oct 23 '13, 4:52 p.m.Were you able to resolve this? I am having the same problem trying to get photos of users through the API.
example:
https://SERVER:PORT/jazz/resource/content/_Gut94H7ZEeKejIlVdm5llw.jpg
Unfortunately, trying to get to the photo results in the message you posted.