Hi Udhaya,
you are performing a basic authentication, but GeoNetwork uses a POST with
credentials to perform an authentication step, then it receives a session
cookie and with that you will be able to perform "protected" operations.
Doc about login service is here[1].
You may find it useful to give a look to the library geonetwork-manager[2],
which uses the apache commons httpclient at its base.
Please note in the examples[3] that before performing any admin operation you
need to call the login method.
Cheers,
Emanuele
[1] http://geonetwork-
opensource.org/manuals/trunk/eng/developer/xml_services/login_xml_services.html#login-
services
[2] https://github.com/geosolutions-it/geonetwork-manager
[3] https://github.com/geosolutions-it/geonetwork-manager/wiki/Examples
Alle 13:30:53 di Monday 18 November 2013, udhaya ha scritto:
Hello,
I am trying to use XML service xml.group.create.update to create a new
group in GN 2.10.2 version. I am using the administrator profile to create
the group and I get 403 Forbidden Issue as response.
The Sample code that I use is given below. Inspite of using admin profile I
get this. Can any one help me on this? Thanks.
PostMethod post = new PostMethod();
String user = "admin" + ":" + "admin";
byte encoding = Base64.encodeBase64(user.getBytes());
post.setRequestHeader(new Header("Authorization", "Basic " + new
String(encoding)));
post.setDoAuthentication( true );
URI uri = new
URI("http://localhost:8081/geonetwork/srv/eng/xml.group.create.update",fals
e); post.setURI(uri);
String createGroupsXML = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><request><id>10</id><name>test
group</name><description>test Demo
group</description>group@anonymised.com</request>";
post.setRequestEntity(new
StringRequestEntity(createGroupsXML,"application/xml", "UTF8"));
HttpClient httpClient = new HttpClient();
httpClient.executeMethod(post);
strAllUsersXML = post.getResponseBodyAsString();
Regards
Udhaya
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/403-frobidden-Error-When-Create-Groups
-Using-XML-Service-tp5089631.html Sent from the GeoNetwork developer
mailing list archive at Nabble.com.
---------------------------------------------------------------------------
--- DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free
app hosting. Or install the open source package on any LAMP server. Sign
up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktr
k _______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork
--
Ing. Emanuele Tajariol
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 380 2116282
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------