[OpenLayers-Users] Requesting Complex Types from WFS

Eduardo Ramos eduardo.j.ramos at novabase.pt
Tue Jul 20 11:57:28 EDT 2010


Hello all

I was hoping that you could shed some light over this issue: my WFS has the
folowing capabilities:

<?xml version="1.0" encoding="utf-8"?>
<WFS_Capabilities xmlns:ogc="http://www.opengis.net/ogc" 
                  xmlns:miwfs="http://www.mapinfo.com/wfs" 
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                  xsi:schemaLocation="http://www.opengis.net/wfs
http://localhost/WFS/GetFeature.ashx?service=MXP-WFS&amp;request=GetSchema&amp;schema=urn%3aopengis%3awfs%3a1.0.0%3aWFS-capabilities" 
                  version="1.0.0" 
                  updateSequence="0" 
                  xmlns="http://www.opengis.net/wfs">
  <Service>
    <Name>Sample WFS Server</Name>
    <Title>Sample WFS Server</Title>
    <OnlineResource>http://localhost/WFS/GetFeature.ashx</OnlineResource>
  </Service>
  <Capability>
    <Request>
      <GetCapabilities>
        <DCPType>
          <HTTP>
            <Get onlineResource="http://localhost/WFS/GetFeature.ashx" />
            <Post onlineResource="http://localhost/WFS/GetFeature.ashx" />
          </HTTP>
        </DCPType>
      </GetCapabilities>
      <DescribeFeatureType>
        <SchemaDescriptionLanguage>
          <XMLSCHEMA />
        </SchemaDescriptionLanguage>
        <DCPType>
          <HTTP>
            <Get onlineResource="http://localhost/WFS/GetFeature.ashx" />
            <Post onlineResource="http://localhost/WFS/GetFeature.ashx" />
          </HTTP>
        </DCPType>
      </DescribeFeatureType>
      <GetFeature>
        <ResultFormat>
          <GML2 />
          <GML3 xmlns="http://www.mapinfo.com/mxp/wfs" />
        </ResultFormat>
        <DCPType>
          <HTTP>
            <Get onlineResource="http://localhost/WFS/GetFeature.ashx" />
            <Post onlineResource="http://localhost/WFS/GetFeature.ashx" />
          </HTTP>
        </DCPType>
      </GetFeature>
    </Request>
  </Capability>
  <FeatureTypeList>
    <Operations>
      <Query />
    </Operations>
    <FeatureType>
      <Name>miwfs:LayerConcelhos</Name>
      <Title>LayerConcelhos</Title>
      <Abstract>Abstract for LayerConcelhos</Abstract>
      <Keywords>Keywords for LayerConcelhos</Keywords>
      <SRS>epsg:4326</SRS>
      <LatLongBoundingBox minx="-9.517034" miny="36.961718" maxx="-6.189968"
maxy="42.15434" />
    </FeatureType>
  </FeatureTypeList>
  <ogc:Filter_Capabilities>
    <ogc:Spatial_Capabilities>
      <ogc:Spatial_Operators>
        <ogc:BBOX />
        <ogc:Equals />
        <ogc:Disjoint />
        <ogc:Intersect />
        <ogc:Within />
        <ogc:Contains />
      </ogc:Spatial_Operators>
    </ogc:Spatial_Capabilities>
    <ogc:Scalar_Capabilities>
      <ogc:Logical_Operators />
      <ogc:Comparison_Operators>
        <ogc:Simple_Comparisons />
        <ogc:NullCheck />
      </ogc:Comparison_Operators>
      <ogc:Arithmetic_Operators>
        <ogc:Simple_Arithmetic />
      </ogc:Arithmetic_Operators>
    </ogc:Scalar_Capabilities>
  </ogc:Filter_Capabilities>
</WFS_Capabilities>

and the only layer has the following types:

<?xml version="1.0" encoding="utf-8"?>
<schema targetNamespace="http://www.mapinfo.com/wfs" 
        xmlns:miwfs="http://www.mapinfo.com/wfs" 
        xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        xmlns:gml="http://www.opengis.net/gml" 
        elementFormDefault="qualified" 
        xmlns="http://www.w3.org/2001/XMLSchema">
  <xs:import namespace="http://www.opengis.net/wfs" 
            
schemaLocation="http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd" />
  <xs:element name="LayerConcelhos" 
              type="miwfs:LayerConcelhos_Type" 
              substitutionGroup="gml:_Feature" />
  <xs:complexType name="LayerConcelhos_Type">
    <xs:complexContent>
      <xs:extension base="gml:AbstractFeatureType">
        <xs:sequence>
          <xs:element name="VL_GMTR" minOccurs="0" maxOccurs="1">
            <xs:complexType>
              <xs:sequence>
                <xs:element ref="gml:_Geometry" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element name="ROWID" nillable="true" type="xs:string"
minOccurs="0" maxOccurs="1" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</schema>

My request code is:

var wfsProtocol = new OpenLayers.Protocol.WFS({
                url: "http://localhost/WFS/GetFeature.ashx",
                version: "1.0.0",
                srsName: "EPSG:4326", 
                featureType: "LayerConcelhos",
                featureNS: "http://www.mapinfo.com/wfs",
                featurePrefix: "miwfs",
                geometryName: "VL_GMTR",
                schema:
"http://localhost/WFS/GetFeature.ashx?service=WFS&version=1.0.0&request=DescribeFeatureType&typename=miwfs:LayerConcelhos",
                readFormat: new OpenLayers.Format.GML.v3()
           });

var layer = new OpenLayers.Layer.Vector("Concelhos",{
                strategies: [new OpenLayers.Strategy.BBOX()],
                projection: new OpenLayers.Projection("EPSG:4326"),
                protocol: wfsProtocol
            });

map.addLayer(layer);
layer.refresh({ force: true });

The response of the request is:

<?xml version="1.0" encoding="utf-8"?>
<ServiceExceptionReport
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                        xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wms/1.1.1/OGC-exception.xsd" 
                        version="1.2.0" 
                        xmlns="http://www.opengis.net/ogc">
  <ServiceException code="-1">Missing namespace prefix for PropertyName
VL_GMTR</ServiceException>
</ServiceExceptionReport>

I'm starting to believe that this error has something to do with the fact
that VL_GMTR is a complex type.

Can you help me, please?

Edu


-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Requesting-Complex-Types-from-WFS-tp5317231p5317231.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list