[GeoNetwork-devel] 403 frobidden Error When Create Groups Using XML Service

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",false\);
        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.

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&quot;,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

--

Our support, Your Success!
Visit http://opensdi.geo-solutions.it for more information.

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

-------------------------------------------------------

Hi

From GeoNetwork 2.10 is possible to use Basic Authentication, and the old services described in http://geonetwork-opensource.org/manuals/trunk/eng/developer/xml_services/login_xml_services.html#login- services are not longer available.

Unfortunately the manual is not updated, will check to fix it.

The error should be caused by other reason I think.

Regards,
Jose García

···

On Tue, Nov 19, 2013 at 1:25 PM, Emanuele Tajariol <etj@anonymised.com> wrote:

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\"?>10test
grouptest Demo
groupgroup@anonymised.com88…”;
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

Our support, Your Success!
Visit http://opensdi.geo-solutions.it for more information.

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



Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk


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


GeoCat Bridge for ArcGIS allows instant publishing of data and metadata on GeoServer and GeoNetwork. Visit http://geocat.net for details.


Jose García
GeoCat bv
Veenderweg 13
6721 WD Bennekom
The Netherlands
http://GeoCat.net