[GeoNetwork-users] 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/Create-Groups-Using-XML-Service-tp5089629.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hello I got this working

I used the Service group.update instead of xml.group.create.update and also
removed the id node from the request XML to create a new group and it
worked. Thanks.

Udhaya

On Mon, Nov 18, 2013 at 5:57 PM, udhaya <udhay.forum@anonymised.com> wrote:

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/Create-Groups-Using-XML-Service-tp5089629.html
Sent from the GeoNetwork users 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.clktrk
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork