HTTP Post request to Web Map Service...
Hi,
I'm trying to create a basic application which sends an xml-encoded GetCapabilities request to a Web Map Service. However, no WMS's will accept my xml. I don't know if this is a problem with my Java or my XML.
Could anyone tell me if I'm doing the HTTP Post wrong, or if my xml is wrong?
Thanks
Java code:
BufferedReader f =new BufferedReader(new FileReader("getCapabilities.xml"));
String l;
String body ="";
while((l = f.readLine()) !=null)
{
body = body + l;
}
System.out.println(body);
URL url =new URL("http://167.21.84.15/wmsconnector/com.esri.wms.Esrimap/DE_aerial02");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setDoInput(true);
PrintWriter writer =new PrintWriter(connection.getOutputStream());
writer.write(body);
writer.close();
InputStream in = connection.getInputStream();
BufferedReader b =new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = b.readLine()) !=null)
{
System.out.println(line);
}
XML request:
<wms:GetCapabilities service="WMS" version="1.0.0"
xmlns="http://www.opengis.net/wms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wms/1.0.0/WMS-basic.xsd">
</wms:GetCapabilities>

