It's all about the answers!

Ask a question

Using curl to get data from jts and ccm instances on different machines


Daniel Toczala (1113) | asked Oct 08 '15, 12:47 p.m.
I am using curl to pull a query from RTC in CSV format.  Here is my code (machine names, user names and passwords are changed):
curl -k -c cookies.txt "https://jts.somewhere.com:9443/jts/authenticated/identity" >nul
curl -k -L -b cookies.txt -c cookies.txt -d j_username=tox -d j_password=toxpassword https://jts.somewhere.com:9443/jts/authenticated/j_security_check >nul
curl -k -L -b cookies.txt -H "Accept: application/xml" "https://ccm.somewhere.com:9943/ccm/resource/itemOid/com.ibm.team.workitem.query.QueryDescriptor/_DVimIGxdEeW_Q6qMmbYYrg?_mediaType=text/csv" 
Now the first two curl commands successfully execute, they are hitting the JTS that is on one machine (jts.somewhere.com), and I am able to log in.  The last command doesn't work though, I keep getting an error that states:
SRVE0255E: A WebGroup/Virtual Host to handle /ccm/resource/itemOid/com.ibm.team.workitem.query.QueryDescriptor/_DVimIGxdEeW_Q6qMmbYYrg has not been defined.
Now I pulled the query descriptor from an interactive web session, so I am pretty sure that it is correct.  I think that I have to do something funny with the curl command, but I am not sure what.  I got similar errors when I tried to do the login via curl pointing at the CCM machine (ccm.somewhere.com).

Does anyone have an example of some curl code that hits one machine (JTS) to login/authenticate, and another (CCM) to access something?

Comments
sam detweiler commented Oct 08 '15, 5:16 p.m.

can u look at cookies.txt  mine shows entries for /jts

3 answers



permanent link
sam detweiler (12.5k6189201) | answered Oct 08 '15, 2:24 p.m.
edited Oct 09 '15, 7:53 a.m.
those were the exact commands I used to get the results (fixed to auth to CCM instead of JTS)
set COOKIES=.\cookies.txt

set USER=sam
set PASSWORD=password
set HOST=https://localhost:9445
set QUERY_UUID=_GjVlsE-mEeSfnK2WDtTMxQ


curl -k -c %cookies% "%host%/ccm/authenticated/identity" >nul

curl -k -L -b %COOKIES% -c %COOKIES% -d j_username=%USER% -d j_password=%PASSWORD% %host%/ccm/authenticated/j_security_check >nul

curl -k -L -b %COOKIES% -H "Accept: application/xml" "%host%/ccm/resource/itemOid/com.ibm.team.workitem.query.QueryDescriptor/%QUERY_UUID%?_mediaType=text/csv"

and returns this  (against my 5.0 server)

C:\Users\sam\temp>curl -k -L -b .\cookies.txt -H "Accept: application/xml" "https://localhost:9445/ccm/resource/itemOid/com.ibm.team.workitem.query.QueryDescriptor/_GjVlsE-mEeSfnK2WDtTMxQ?_mediaType=text/csv"
 ■" A p p r o v a l s "          " s a v e i t e m "     " I d "
 " "     " "     " 8 "
 " "     " "     " 9 "
 " "     " "     " 1 0 "
 " "     " "     " 1 1 "
 " "     " "     " 1 2 "
 " "     " "     " 1 3 "
 " a   t e s t   a p p r o v a l :   P e n d i n g   ( 1   o f   1 ) "   " 1 3 :   D e f i n e   p e r m i s s i o n s "         " 1 4 "
 " A p p r o v a l :   A p p r o v e d   ( 1   o f   1 ) "       " "     " 1 5 "


note that both my jts and ccm components are on the same machine.  are yours really on two different machines?


permanent link
Donald Nong (14.4k314) | answered Oct 08 '15, 11:10 p.m.
edited Oct 08 '15, 11:11 p.m.
I don't think the SRVE0255E is caused by the separation of JTS and CCM - most likely you pointed the URL to a wrong server. Is the port number really 9943, not 9443? If you have not logged in before, you should get a login page in the response, not an SRVE0255E error. To make sure you have the right URL, use the method mentioned in the below post.
https://jazz.net/forum/questions/131393/how-to-display-a-formatted-query-result-in-a-rtc-dashboard-external-content-widget

Both CCM and QM provide the /<app>/authenticated/identity and /<app>/authenticated/j_security_check services same as JTS, so you can use /ccm/authenticated/identity and /ccm/authenticated/j_security_check for the first two requests. I have verified this in an environment where JTS and CCM are deployed in two separate WAS profiles and the reverse proxy was stopped at the time of testing - yes CCM can run without JTS.

If JTS and CCM are on different application servers and you use JTS for authentication, you will not get an authenticated session on the third request - you will always get a new and unauthenticated session since it's the first time you access CCM, judging by cookies.

Comments
sam detweiler commented Oct 09 '15, 7:51 a.m. | edited Oct 09 '15, 7:53 a.m.

I had never tried auth to ccm only. it worked.  fixed my prior answer

thanks Donald


permanent link
Daniel Toczala (1113) | answered Nov 03 '15, 2:50 p.m.
Guys,

 I finally got it to work.  it wasn't the port number (we are actually using 9943), but it was the resource path.  I was using /ccm/resource, while our installation uses /jazz/resource.  I noticed this while checking the port numbers.  hanks for your help.

Your answer


Register or to post your answer.