[GeoNetwork-devel] Metadata insert using Java

Hi,

I am a newbie to Geonetwork. I tried following 2 approaches to insert metadata into GeoNetwork catalog. Nothing worked for me.

Approach 1:

I wrote Java code that uses HTTP Post menthod to login & to insert metadata into Geonetwork server. But the response code that I get back is 302 (redirection) and not 200 as expected.

Please wait…

Patientez s’il vous plaît…

Bitte warten…

Un momento per favore…

Approach 2:

I tried to use ‘geonetwork-manager’ but again I am not able to login or insert metadata.
https://code.google.com/p/geonetwork-manager/

‘Insert a Metadata’ example in the link does not work as it fails with the error message 'could not log in"

Please let me know what am I doing wrong.

Note: I am testing GeoNetwork as user admin

Divya C
www.dealbitte.com

Maybe this thread could help
http://osgeo-org.1560.x6.nabble.com/Need-Help-to-Use-Login-Service-Via-Java-in-GN2-10-td5066025.html

Francois

···

2013/11/8 divzee Chandrashakher <divzeeblog@anonymised.com>

Hi,

I am a newbie to Geonetwork. I tried following 2 approaches to insert metadata into GeoNetwork catalog. Nothing worked for me.

Approach 1:

I wrote Java code that uses HTTP Post menthod to login & to insert metadata into Geonetwork server. But the response code that I get back is 302 (redirection) and not 200 as expected.

Please wait…

Patientez s’il vous plaît…

Bitte warten…

Un momento per favore…

Approach 2:

I tried to use ‘geonetwork-manager’ but again I am not able to login or insert metadata.
https://code.google.com/p/geonetwork-manager/

‘Insert a Metadata’ example in the link does not work as it fails with the error message 'could not log in"

Please let me know what am I doing wrong.

Note: I am testing GeoNetwork as user admin

Divya C
www.dealbitte.com


November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&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

Hi,

Thank for the quick responses.
I am using GeoNetwork version 2.10.1 (installed on windows using geonetwork-install-2.10.1-0.exe)

  1. I am fine with not using ‘geonetwork-manager’ as it may be not compatible with GeoNetwork that I use.
    TransactionTest.java in attachment is the code that I wrote to login into GeoNetwork (which did not work).

  2. Based on comment from Francois, I tested TestGNLogin and I am able to login successfully. This means I need to store cookies to insert metadata. Isn’t?

The task I am trying to get done (logging into GeoNetwork and inserting Metadata, programmatically via Java) is not unique and I do not need to re-invent the wheel. While searching for an existing solution, I ended up with ‘geonetwork-manager’ but it is obsolete.

regards

(attachments)

TransactionTest.java (1.43 KB)
TestGNLogin.java (5.08 KB)

···

On Fri, Nov 8, 2013 at 3:38 PM, Francois Prunayre <fx.prunayre@anonymised.com> wrote:

Maybe this thread could help
http://osgeo-org.1560.x6.nabble.com/Need-Help-to-Use-Login-Service-Via-Java-in-GN2-10-td5066025.html

Francois


Divya C
www.dealbitte.com
Ideas for smart shopping

2013/11/8 divzee Chandrashakher <divzeeblog@anonymised.com>

Hi,

I am a newbie to Geonetwork. I tried following 2 approaches to insert metadata into GeoNetwork catalog. Nothing worked for me.

Approach 1:

I wrote Java code that uses HTTP Post menthod to login & to insert metadata into Geonetwork server. But the response code that I get back is 302 (redirection) and not 200 as expected.

Please wait…

Patientez s’il vous plaît…

Bitte warten…

Un momento per favore…

Approach 2:

I tried to use ‘geonetwork-manager’ but again I am not able to login or insert metadata.
https://code.google.com/p/geonetwork-manager/

‘Insert a Metadata’ example in the link does not work as it fails with the error message 'could not log in"

Please let me know what am I doing wrong.

Note: I am testing GeoNetwork as user admin

Divya C
www.dealbitte.com


November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&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

On Fri, Nov 8, 2013 at 4:33 PM, divzee Chandrashakher
<divzeeblog@anonymised.com>wrote:

Hi,

Thank for the quick responses.
I am using GeoNetwork version 2.10.1 (installed on windows
using geonetwork-install-2.10.1-0.exe)

1. I am fine with not using 'geonetwork-manager' as it may be not
compatible with GeoNetwork that I use.
TransactionTest.java in attachment is the code that I wrote to login into
GeoNetwork (which did not work).

2. Based on comment from Francois, I tested TestGNLogin and I am able to
login successfully. This means I need to store cookies to insert metadata.
Isn't?

You can use cookies or send basic authentication on the headers on each
request you make. It depends on what http client you are using.

The task I am trying to get done (logging into GeoNetwork and inserting
Metadata, programmatically via Java) is not unique and I do not need to
re-invent the wheel. While searching for an existing solution, I ended up
with 'geonetwork-manager' but it is obsolete.

regards

On Fri, Nov 8, 2013 at 3:38 PM, Francois Prunayre <fx.prunayre@anonymised.com>wrote:

Maybe this thread could help

http://osgeo-org.1560.x6.nabble.com/Need-Help-to-Use-Login-Service-Via-Java-in-GN2-10-td5066025.html

Francois

2013/11/8 divzee Chandrashakher <divzeeblog@anonymised.com>

Hi,

I am a newbie to Geonetwork. I tried following 2 approaches to insert
metadata into GeoNetwork catalog. Nothing worked for me.

*Approach 1:*

I wrote Java code that uses HTTP Post menthod to login & to insert
metadata into Geonetwork server. But the response code that I get back is
302 (redirection) and not 200 as expected.

*<html response>*

  Please wait...

  Patientez s'il vous plaît...

  Bitte warten...

  Un momento per favore...
*Approach 2:*

I tried to use 'geonetwork-manager' but again I am not able to login or
insert metadata.
https://code.google.com/p/geonetwork-manager/

'Insert a Metadata' example in the link does not work as it fails with
the error message 'could not log in"

Please let me know what am I doing wrong.

Note: I am testing GeoNetwork as user admin

--
Divya C
www.dealbitte.com

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models.
Explore
techniques for threading, error checking, porting, and tuning. Get the
most
from the latest Intel processors and coprocessors. See abstracts and
register

http://pubads.g.doubleclick.net/gampad/clk?id=60136231&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

--
Divya C
www.dealbitte.com
*Ideas for smart shopping*