Hello,
We have an external application which lists metadata as hyper links and when the user clicks a metadata link it should open the geonetwork metadata edit page
I tried a sample code to test this approach and always get You may not have the privileges to do this operation.ServiceNotAllowedEx : Service not allowed.
I am passing the admin/admin as default username and password to the below code.
//Geonetwork Login code
……
Cookie loginCookie = httpClient.getState().getCookies()[0];
String cookieName = loginCookie.getName();
String cookieValue = loginCookie.getValue();
System.out.println("cookieName : "+cookieName);
System.out.println("cookieValue : "+cookieValue);
// encode user name and password
// set default authenticator
//javax.servlet.http.Cookie gnCookie = new javax.servlet.http.Cookie(cookieName, cookieValue);
response.addHeader(“Accept”, “text/plain,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”);
response.addHeader(“Content-Type”, “application/x-www-form-urlencoded”);
response.addHeader(“Connection”, “Keep-Alive”);
response.addHeader(“Keep-Alive”, “300”);
response.addHeader(“Cookie”, cookieValue);
//response.addCookie(gnCookie);
response.sendRedirect(“http://localhost:8081/geonetwork/srv/en/metadata.edit?id=1”);
For example after Login the following is printed
cookieName : JSESSIONID
cookieValue : 88F9E1ECB7F6BAADC6CF429DCE01A9EF
and when the http://localhost:8081/geonetwork/srv/en/metadata.edit?id=1 is been called I note a different session Id printed in Jeeves Log. Why is that the session id being passed being not considered?
Any inputs on this will be really helpful.
Geonetwork Log
2012-01-30 16:16:31,202 INFO [jeeves.request] - ==========================================================
2012-01-30 16:16:31,202 INFO [jeeves.request] - HTML Request (from 127.0.0.1) : /geonetwork/srv/en/xml.user.login
2012-01-30 16:16:31,202 DEBUG [jeeves.request] - Method : POST
2012-01-30 16:16:31,202 DEBUG [jeeves.request] - Content type : application/xml; charset=UTF8
2012-01-30 16:16:31,202 DEBUG [jeeves.request] - Accept : null
2012-01-30 16:16:31,374 DEBUG [jeeves.request] - Session id is 88F9E1ECB7F6BAADC6CF429DCE01A9EF
2012-01-30 16:16:31,374 DEBUG [jeeves.request] - Session created for client : 127.0.0.1
2012-01-30 16:16:31,390 INFO [jeeves.service] - Dispatching : xml.user.login
2012-01-30 16:16:31,390 DEBUG [jeeves.service] - → parameters are :
admin
admin
2012-01-30 16:16:31,421 INFO [jeeves.webapp.xml.user.login] - User ‘admin’ logged in using an old scrambled password.
2012-01-30 16:16:31,421 INFO [jeeves.webapp.xml.user.login] - User ‘admin’ logged in as ‘Administrator’
2012-01-30 16:16:31,421 INFO [jeeves.service] - → dispatching to output for : xml.user.login
2012-01-30 16:16:31,421 INFO [jeeves.service] - → writing xml for : xml.user.login
2012-01-30 16:16:31,421 DEBUG [jeeves.service] - Service xml is :
2012-01-30 16:16:31,421 INFO [jeeves.service] - → output ended for : xml.user.login
2012-01-30 16:16:31,421 INFO [jeeves.service] - → dispatch ended for : xml.user.login
cookieName : JSESSIONID
cookieValue : 88F9E1ECB7F6BAADC6CF429DCE01A9EF
2012-01-30 16:16:31,468 INFO [jeeves.request] - ==========================================================
2012-01-30 16:16:31,468 INFO [jeeves.request] - HTML Request (from 127.0.0.1) : /geonetwork/srv/en/metadata.edit
2012-01-30 16:16:31,468 DEBUG [jeeves.request] - Method : GET
2012-01-30 16:16:31,468 DEBUG [jeeves.request] - Content type : null
2012-01-30 16:16:31,468 DEBUG [jeeves.request] - Accept : text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
2012-01-30 16:16:31,484 DEBUG [jeeves.request] - Session id is 423DFC79E1A4B490D571CFD13BD245C1
2012-01-30 16:16:31,484 DEBUG [jeeves.request] - Session created for client : 127.0.0.1
2012-01-30 16:16:31,515 INFO [jeeves.service] - Dispatching : metadata.edit
2012-01-30 16:16:31,515 DEBUG [jeeves.service] - → parameters are :
1
2012-01-30 16:16:31,515 ERROR [jeeves.service] - Service not allowed : metadata.edit
2012-01-30 16:16:31,515 DEBUG [jeeves.service] - Raised exception while executing service
Service not allowed
ServiceNotAllowedEx
Regards
Kumaran