2

I'm adding a layer to an OpenLayers Map which includes data from GeoServer retrieved using WFS. The layer is created like following:

var saveStrategy = new OpenLayers.Strategy.Save();
var wfs = new OpenLayers.Layer.Vector("Editable Features", {
    strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
    projection: new OpenLayers.Projection("EPSG:26713"),
    protocol: new OpenLayers.Protocol.WFS({
        version: "1.1.0",
        url: "http://localhost/geodemo/geoserver/wfs",
        featureType: "LayerName",
        srsName: "EPSG:26713",
            featureNS: "http://www.openplans.org/MyNS",
        geometryName: "the_geom",
                            })
}); 

When sending WFS messages to GeoServer, the server could send errors (formatated as XML). How it is possible to be aware from these errors?

Thanks.

0
1

I can regist in events from Save Strategy:

http://dev.openlayers.org/apidocs/files/OpenLayers/Strategy/Save-js.html

saveStrategy.events.register("fail", saveStrategy, function () {
    alert('fail');
});

saveStrategy.events.register("success", saveStrategy, function () {
    alert('success');
});

Thanks.

0

In firefox, you can add the firebug plugin to inspect the incoming and outgoing request..

In chrome, you can use inspect element (you will have to enable Log XMLHttpRequests from settings)

2
  • Yes, but i need to handle this errors to show them as a message to final user...
    – Zé Carlos
    Aug 27 '13 at 17:55
  • OpenLayers.Request which performs the ajax requests supports success and failure mode for request.
    – neogeomat
    Aug 27 '13 at 18:01
0

Check for ExceptionReport in the XML response.

http://www.ogcnetwork.net/node/198

1
  • please do not use short link only answers. explanation of what the link fixes and why it is an answer are required.
    – Brad Nesom
    Apr 27 '15 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.