Package org.fao.geonet.utils

Examples of org.fao.geonet.utils.XmlRequest


        List<Element> list = par.getChildren();

    if (list.size() == 0)
      throw new MissingParameterEx("<request>", par);

    XmlRequest req = context.getBean(GeonetHttpRequestFactory.class).createXmlRequest(new URL(url));

    //--- do we need to authenticate?

    if (username != null)
      authenticate(req, username, password, type);

    Lib.net.setupProxy(context, req);

    if (list.size() == 1) {
      params = list.get(0);
      req.setRequest(params);
    } else {
      for (int i = 0; i < list.size();i++) {
        Element elem = list.get(i);
        req.addParam(elem.getName(), elem.getText());
      }
    }

    Element result = req.execute();
    return result;
  }
View Full Code Here


  private Element getMdFormats(String url, ServiceContext context) throws Exception
  {
    ListMetadataFormatsRequest req = new ListMetadataFormatsRequest(context.getBean(GeonetHttpRequestFactory.class));
    req.setSchemaPath(oaiSchema);

        XmlRequest t = req.getTransport();
    t.setUrl(new URL(url));
    Lib.net.setupProxy(context, t);
    ListMetadataFormatsResponse res = req.execute();

    //--- build response
View Full Code Here

    try
    {
      ListSetsRequest req = new ListSetsRequest(context.getBean(GeonetHttpRequestFactory.class));
      req.setSchemaPath(oaiSchema);
            XmlRequest t = req.getTransport();
      t.setUrl(new URL(url));
      Lib.net.setupProxy(context, t);
      ListSetsResponse res = req.execute();

      //--- build response
View Full Code Here

      }
    }

    // -- get the schema zip archive from the net
    if (url != null) {
      XmlRequest strReq = context.getBean(GeonetHttpRequestFactory.class).createXmlRequest(url);
      zipArchive = File.createTempFile("schema",".zip");
      deleteTempZip = true;

      // FIXME: add proxy credentials etc to strReq
      strReq.executeLarge(zipArchive);


    } else {
      zipArchive = new File(fname);
    }
View Full Code Here

  private int setRemoteRating(ServiceContext context, GeonetParams params, String uuid, int rating) throws Exception
  {
        if(context.isDebugEnabled()) context.debug("Rating remote metadata with uuid:"+ uuid);

    XmlRequest req = context.getBean(GeonetHttpRequestFactory.class).createXmlRequest(new URL(params.host));

    Lib.net.setupProxy(context, req);

    req.setAddress(params.getServletPath() +"/srv/en/"+ Geonet.Service.XML_METADATA_RATE);
    req.clearParams();
    req.addParam("uuid",   uuid);
    req.addParam("rating", rating);

    Element response = req.execute();

    if (!response.getName().equals(Params.RATING))
      throw new BadServerResponseEx(response);

    return Integer.parseInt(response.getText());
View Full Code Here

TOP

Related Classes of org.fao.geonet.utils.XmlRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.