[OpenLayers-Users] WFS-T update problem with namespaces

2StepForward kwegezeder at web.de
Thu Jun 5 05:34:01 EDT 2008


Hi List,

and thanks for answers on my questions. I agree with you, that it's realy
hard to deal with XML....
I have yesterday tried to write a work around for that namespace problem
like this:

Defines in my OL-code:

var wfs4 = new OpenLayers.Layer.WFS(
                "Info", "http://server/geoserver/wfs?", {
typename:'WFS:info', geometry_column:'the_geom'},
                {
                   maxResolution:'auto',
                   typename:'WFS:info',
                   featureNS:'http://www.own-namespace.de/wfs'  -> my own ns
of GeoServer for xml-schema 
                   featurePrefix:'WFS',                                       
-> additionaly definition of the prefix
                });


Changes in WFS-Layer.js by commit function:

if(!this.writer) {
...........................................
}
options.layerName = this.typename;   -> new
options.featureNS = this.featureNS;   -> new
options.featurePrefix = this.featurePrefix; -> new


Changes in WFS-Format.js by update function:

if(!feature.fid) {......}
updateNode.setAttribute("xmlns:"+this.featurePrefix, this.featureNS); -> new
updateNode.setAttribute("typename", this.layerName);

I now, it doesn't lock nice, but it works....... 
It will be good, if anyone write if it's a good way to change it like I have
above wrote it.

Thanks Klaus


Tim Schaub-3 wrote:
> 
> Hey-
> 
> 2StepForward wrote:
>> Hello List,
>> 
>> if have read many posts about WFS-T transaction and update/delete
>> features,
>> but can't solve my problem.
>> If i try the transaction_update demo request in GeoServer demo with some
>> manipulations to my featuretype, everything works fine.
>> 
>> Like this:
>> 
>> <wfs:Transaction service="WFS" version="1.0.0"
>>   xmlns:WFS="http://www.own-namespace.de/wfs"      -> this is the import
>> of
>> my own namespace from GS
>>   xmlns:ogc="http://www.opengis.net/ogc"
>>   xmlns:wfs="http://www.opengis.net/wfs">
>>   xmlns:gml="http://www.opengis.net/gml"
>>   <wfs:Update typeName="WFS:info">
>>     <wfs:Property>
>>       <wfs:Name>the_geom</wfs:Name>
>>       <wfs:Value>
>>       <gml:Point srsName="EPSG:23032">
>>       <gml:coordinates decimal="." cs="," ts="
>> ">662043.2646366811,5798981.532771344</gml:coordinates>
>>       </gml:Point>
>>       </wfs:Value>
>>     </wfs:Property>
>>     <ogc:Filter>
>>       <ogc:FeatureId fid="info.1"/>
>>     </ogc:Filter>
>>   </wfs:Update>
>> </wfs:Transaction>
>> 
>> But if I take a commit of my WFS layer and that feature type, than i can
>> sniff these xml transaction code:
>> 
>> <wfs:Transaction version="1.0.0" service="WFS"
>> xmlns:wfs="http://www.opengis.net/wfs">
>>  <wfs:Update typeName="WFS:em">
>>   <wfs:Property>
>>    <wfs:Name>the_geom</wfs:Name>
>>    <wfs:Value>
>>     <gml:Point xmlns:gml="http://www.opengis.net/gml"
>> srsName="EPSG:23032">
>>     <gml:coordinates decimal="." cs="," ts="
>> ">662043.2646366811,5798981.532771344</gml:coordinates>
>>     </gml:Point>
>>    </wfs:Value>
>>   </wfs:Property>
>>    <ogc:Filter>
>>      <ogc:FeatureId fid="info.1"/>
>>    </ogc:Filter>
>>  </wfs:Update>
>> </wfs:Transaction>
>> 
>> and i get, I think this might be right, a error window which said "WFS is
>> not bind to a namespace".
>> If I think right, it meens the WFS namespace prefix of my featuretype
>> which
>> should bind to the:
>> 
>> xmlns:WFS="http://www.own-namespace.de/wfs"
>> 
>> namespace definition. But there isn't any definition of my own in GS
>> defined
>> namespace.
>> 
> 
> Yes, you are hitting a known bug with the WFS stuff in OpenLayers.  This 
> particular problem will be solved with the new WFS protocol (which will 
> write out the xmlns attribute for the feature type namespace alias).
> 
>> Where I can set a option in the WFS Layer, who bind this prefix to the
>> namespace in the request?
>> Or is any logic, where I understand this model of xml request wrong?
>> I have tried to set the featureNS to my own namespace, but this option I
>> think has no effect, isn't it?
>> The solved problem with the layerName in WFS-Format-JS, which is set to
>> the
>> featuretype.
>> 
>> Has anyone a idea, I'm shortly befor to hit my head on the wall....
> 
> So, with apologies for the frustration, you'll have to wait a while 
> before the WFS/GML facelift makes it in to the trunk.
> 
> Tim
> 
>> 
>> Thanks Klaus 
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/WFS-T-update-problem-with-namespaces-tp17647200p17665915.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list