how to generate geomesa wps request in java code?

182 Views Asked by At

If i want to invoke a geomesa wps service, i can write code like this:

HttpURLConnection conn = connfactory.openConnection();
conn.setRequestProperty("Content-Type", "text/xml");
conn.setRequestMethod("POST");
OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream());
out.write(document.asXML());
out.close();

//connect to the http service
........

this is a java program. Variable 'document' is a XML element and it is read from a XML file. if i want to generate this xml file , i must construct this file using a xml tool like dom4j. this is very complicated and time-consuming. Can i generate this xml file using a java object like "wps:datainputs"?

for example like this

wps.datainputs wps1  = new wps:datainputs();
wps.input.Identifilter = new filter();
Xml xml = wps1.toXml();

How can I implement this?
thanks very much in advance.

the xml file like the below:

<?xml version="1.0" encoding="UTF-8"?>
   <wps:Execute version="1.0.0" service="WPS"
     xmlns:wfs="http://www.opengis.net/wfs"
     xmlns:gml="http://www.opengis.net/gml"
     xmlns:xlink="http://www.w3.org/1999/xlink">
   <ows:Identifier>geomesa:Query</ows:Identifier>
   <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>filter</ows:Identifier>
      <wps:Data>
        <wps:ComplexData mineType="text/plain; subtype=cql"></wps:ComplexData>
      </wps:Data>
    </wps:Input>
   </wps:DataInputs>
   <wps:ResponseForm>
      <wps:RawDataOutput mineType="application/json">
         <ows:Identifier>result</ows:Identifier>
      </wps:RawDataOutput>
   </wps:ResponseForm>
0

There are 0 best solutions below