Yeah. Works now by changing the URL. As the browser automatically handles the redirection, it was’t a problem.
Thank you.
···
On Wed, Nov 13, 2013 at 10:19 AM, Jose Garcia <jose.garcia@anonymised.com> wrote:
Hi Divya
Change the url to: http://localhost:8080/geonetwork/srv/eng/xml.group.list , that should fix the issue.
Regards,
Jose García
–
Divya C
www.dealbitte.com
Ideas for smart shopping
On Wed, Nov 13, 2013 at 10:11 AM, divzee Chandrashakher <divzeeblog@anonymised.com> wrote:
Hi,
I am trying out the examples listed under ‘Java development with XML services’ at
http://geonetwork-opensource.org/manuals/2.10.2/eng/developer/xml_services/java_xml_services.htmlWhen I execute the following Java code, I get HTTP response as 301 (moved permanently) but when I use the browser to access the URL http://localhost:8080/geonetwork/srv/en/xml.group.list , I get a proper XML response (Console output below confirms this).
Please let me know what is missing in Java part to get the response status code as 200?
Java Code (same as listed under ‘Java development with XML services’ )
public class GetGroupsClient {
public static void main(String args) {
// Create request xml**
Element request = new Element(“request”);
// Create PostMethod specifying service url**
String serviceUrl = “http://localhost:8080/geonetwork/srv/en/xml.group.list”;
PostMethod post = new PostMethod(serviceUrl);try {
String postData = Xml.getString(new Document(request));// Set post data, mime-type and encoding**
post.setRequestEntity(new StringRequestEntity(postData,
“application/xml”, “UTF8”));// Send request**
HttpClient httpclient = new HttpClient();
int result = httpclient.executeMethod(post);// Display status code**
System.out.println("Response status code: " + result);// Display response**
System.out.println("Response body: ");
System.out.println(post.getResponseBodyAsString());} catch (Exception ex) {
ex.printStackTrace();} finally {
// Release current connection to the connection pool
// once you are done**
post.releaseConnection();
}
}
}Geonetwork console output when using browser to access the URL http://localhost:8080/geonetwork/srv/en/xml.group.list
2013-11-13 09:53:56,827 INFO [jeeves.request] - ===============================
===========================
2013-11-13 09:53:56,828 INFO [jeeves.request] - HTML Request (from 127.0.0.1) :
/geonetwork/srv/eng/xml.group.list
2013-11-13 09:53:56,950 INFO [jeeves.service] - Dispatching : xml.group.list
2013-11-13 09:53:56,954 INFO [jeeves.service] - → dispatching to output for
: xml.group.list
2013-11-13 09:53:56,954 INFO [jeeves.service] - → writing xml for : xml.g
roup.list
2013-11-13 09:53:56,983 INFO [jeeves.service] - → output ended for : xml.gr
oup.list
2013-11-13 09:53:56,983 INFO [jeeves.service] - → dispatch ended for : xml.gr
oup.listRegards,
Divya
www.dealbitte.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-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