[Geoserver-devel] Sending POST request - geoserver 1.4

Hi,

I would like to send a GetFeature POST request using my own code.

I tried the WFS_getFeature sample as it is:

<?xml version="1.0" ?><wfs:GetFeature service="WFS" version="1.0.0"
  outputFormat="GML2"
  xmlns:topp="http://www.openplans.org/topp&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;
  xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:gml="http://www.opengis.net/gml&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.opengis.net/wfs
                      http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
  <wfs:Query typeName="topp:states">
    <ogc:Filter>
      <ogc:BBOX>
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
           <gml:coordinates>
               -73.99312376470733,40.76203427979042 -73.9239210030026,40.80129519821393
           </gml:coordinates>
        </gml:Box>
      </ogc:BBOX>
   </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

but it does not work.

If I send it to "http://localhost:8080/geoserver&quot; I get an HTML-page as result:

<html>
<head><title>GeoServer - Loading</title>
  <meta content="text/css" http-equiv="content-style-type">
  <style type="text/css">
    <!-- @import url("/geoserver/style.css"); -->
  </style>
  <link type="image/gif" href="gs.gif" rel="icon"><!-- mozilla -->
  <link href="gs.ico" rel="SHORTCUT ICON"><!-- ie -->
</head>
<body onload="javascript:window.location.replace('welcome.do')"><br><center>
<table width="60%" height="60%"><tr><td>
<center>
  <span class="project">
    <a href="http://geoserver.sourceforge.net/&quot;&gt;GeoServer&lt;/a&gt;
  </span>
  <span class="license">
    <a href="http://geoserver.sourceforge.net/documentation/developer/license.htm&quot;&gt;©&lt;/a&gt;
  </span>
  <h1>LOADING ...</h1>
<center><br>
<center><h2>Please Wait</h2><center>
<center><h2>0% Completed</h2><center>
</table></td></tr>
</center></body>
</html>

  xmlns:gml="http://www.opengis.net/gml&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.opengis.net/wfs
                      http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
  <wfs:Query typeName="topp:states">
    <ogc:Filter>
      <ogc:BBOX>
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
           <gml:coordinates>
               -73.99312376470733,40.76203427979042 -73.9239210030026,40.80129519821393
           </gml:coordinates>
        </gml:Box>
      </ogc:BBOX>
   </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

but it does not work.

If I send it to "http://localhost:8080/geoserver/wfs&quot;, I get:

<?xml version="1.0" ?>
<ServiceExceptionReport
   version="1.2.0"
   xmlns="http://www.opengis.net/ogc&quot;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation="http://www.opengis.net/ogc http://localhost:8080/geoserver/schemas//wfs/1.0.0/OGC-exception.xsd&quot;&gt;
   <ServiceException>
      Could not locate service mapping to: (wfs,null) </ServiceException>

If I send it to "http://localhost:8080/geoserver/TestWfsPost&quot;, I get:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>TestWfsPost</title>
</head>
<script language="JavaScript">
function doNothing() {
}
function sendRequest() {
  if (checkURL()==true) {
    document.frm.action = "http://localhost:8080/geoserver/TestWfsPost&quot;;
    document.frm.target = "_blank";
    document.frm.submit();
  }
}
function checkURL() {
  if (document.frm.url.value=="") {
    alert("Please give URL before you sumbit this form!");
    return false;
  } else {
    return true;
  }
}
function clearRequest() {
document.frm.body.value = "";
}
</script>
<body>
<form name="frm" action="JavaScript:doNothing()" method="POST">
<table align="center" cellspacing="2" cellpadding="2" border="0">
<tr>
<td><b>URL:</b></td>
<td><input name="url" value="http://localhost:8080/geoserver/wfs/GetFeature&quot; size="70" MAXLENGTH="100"/></td>
</tr>
<tr>
<td><b>Request:</b></td>
<td><textarea cols="60" rows="24" name="body"></textarea></td>
</tr>
</table>
<table align="center">
<tr>
<td><input type="button" value="Clear" onclick="clearRequest()"></td>
<td><input type="button" value="Submit" onclick="sendRequest()"></td>
<td></td>
</tr>
</table>
</form>
</body>
</html>

If I send it to "http://localhost:8080/geoserver/wfs/GetFeature&quot;, I get:

<?xml version="1.0" ?>
<ServiceExceptionReport
   version="1.2.0"
   xmlns="http://www.opengis.net/ogc&quot;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation="http://www.opengis.net/ogc http://localhost:8080/geoserver/schemas//wfs/1.0.0/OGC-exception.xsd&quot;&gt;
   <ServiceException>
      The typename element is mandatory if no FEATUREID is present </ServiceException>

What am I doing wrong?

Regards,
Beate
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066