[Geoserver-devel] Problems accessing Geoserver's WFS from Mapserver

Hi,
                                                                                
    I set up Geoserver's WFS server, and tested it using simple requests,
like http://localhost:8080/geoserver/wfs?request=GetFeature&typename=gisplan:acervo_espacial,
which returned to me correct GML.
                                                                                
    The second step that I tried was configuring Mapserver as a WMS
client to access some Features from Geoserver. I find out that the
POST request that Mapserver is sending to Geoserver is like this:
                                                                                
POST /geoserver/wfs HTTP/1.1
Host: localhost:8080
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Content-Type: text/xml
Content-Length: 305
                                                                                
<?xml version="1.0" ?>
<GetFeature
service="WFS"
version="1.0.0"
outputFormat="GML2">
<Query typeName="gisplan:acervo_espacial">
<Filter>
<BBOX>
<PropertyName>Geometry</PropertyName>
<Box>
<coordinates>-77.038333,-37.435044 -31.038333,8.511622</coordinates>
</Box>
</BBOX>
</Filter></Query>
</GetFeature>
                                                                                
    But, instead of returning the GML file, Geoserver is returning a
ServiceExceptionReport, like this:
                                                                                
<?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://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd&quot;&gt;
   <ServiceException
locator="org.vfny.geoserver.requests.readers.XmlRequestReader">
      XML getFeature request SAX parsing error:
org.xml.sax.SAXException: Attempted to construct illegal filter: Got
to the end state of an incomplete filter, current state is rightValue
    [JVM stack trace]
   </ServiceException>
</ServiceExceptionReport>
                                                                                
    I believe that there is something wrong with the request made by
Mapserver, but I can't figure out what.
                                                                                
    Any help would be greatly appreciated,
                                                                                
Alexandre

The problem is that you need namespaces. Actually the only namespace
you _really_ need is gml, for the box and coordinate elements, as
geotools, the library that geoserver is built on top of, looks for
those elements in the gml namespace. The specs all say that namespaces
are required. So the request should look like:

<?xml version="1.0" ?>
<GetFeature
xmlns:gml=http://www.opengis.net/gml

   service="WFS"

version="1.0.0"
outputFormat="GML2">
<Query typeName="gisplan:acervo_espacial">
<Filter>
<BBOX>
<PropertyName>Geometry</PropertyName>
<gml:Box>
<gml:coordinates>-77.038333,-37.435044

-31.038333,8.511622</gml:coordinates>

</gml:Box>
</BBOX>
</Filter></Query>
</GetFeature>

This is from memory, so the namespace may be slightly wrong, check the
filter encoding spec to confirm.

best regards,

Chris

Quoting Alexandre Florio <aflorio@anonymised.com>:

Hi,

    I set up Geoserver's WFS server, and tested it using simple
requests,
like

http://localhost:8080/geoserver/wfs?request=GetFeature&typename=gisplan:acervo_espacial,

which returned to me correct GML.

    The second step that I tried was configuring Mapserver as a WMS
client to access some Features from Geoserver. I find out that the
POST request that Mapserver is sending to Geoserver is like this:

POST /geoserver/wfs HTTP/1.1
Host: localhost:8080
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Content-Type: text/xml
Content-Length: 305

<?xml version="1.0" ?>
<GetFeature
service="WFS"
version="1.0.0"
outputFormat="GML2">
<Query typeName="gisplan:acervo_espacial">
<Filter>
<BBOX>
<PropertyName>Geometry</PropertyName>
<Box>
<coordinates>-77.038333,-37.435044 -31.038333,8.511622</coordinates>
</Box>
</BBOX>
</Filter></Query>
</GetFeature>

    But, instead of returning the GML file, Geoserver is returning a
ServiceExceptionReport, like this:

<?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://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd&quot;&gt;
   <ServiceException
locator="org.vfny.geoserver.requests.readers.XmlRequestReader">
      XML getFeature request SAX parsing error:
org.xml.sax.SAXException: Attempted to construct illegal filter: Got
to the end state of an incomplete filter, current state is rightValue
    [JVM stack trace]
   </ServiceException>
</ServiceExceptionReport>

    I believe that there is something wrong with the request made by
Mapserver, but I can't figure out what.

    Any help would be greatly appreciated,

Alexandre

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes
on
Linux.com, ITManagersJournal and NewsForge in the past few weeks?
Now,
one more big change to announce. We are now OSTG- Open Source
Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/