Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I tried to make a transaction data using WFS protocol with the save strategy and when I click on the save button and fetch with firebug I figure out that the POST method didn't receive any response from geoserver the error is : " Failed to load resource: the server responded with a status of 504 (Gateway Time-out) "

here is my code :

OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

 //set up the modification tools
 var DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
 initialize: function(layer, options) {
 OpenLayers.Control.prototype.initialize.apply(this, [options]);
 this.layer = layer;
 this.handler = new OpenLayers.Handler.Feature(
 this, layer, {click: this.clickFeature}
 );
 },
 clickFeature: function(feature) {
 // if feature doesn't have a fid, destroy it
 if(feature.fid == undefined) {
 this.layer.destroyFeatures([feature]);
 } else {
 feature.state = OpenLayers.State.DELETE;
 this.layer.events.triggerEvent("afterfeaturemodified", 
 {feature: feature});
 feature.renderIntent = "select";
 this.layer.drawFeature(feature);
 }
 },
 setMap: function(map) {
 this.handler.setMap(map);
 OpenLayers.Control.prototype.setMap.apply(this, arguments);
 },
 CLASS_NAME: "OpenLayers.Control.DeleteFeature"
 });

 function showMsg(szMessage) {
 document.getElementById("nodelist").innerHTML = szMessage;
 setTimeout(
 "document.getElementById('nodelist').innerHTML = ''",2000);
 }

 function showSuccessMsg(){
 showMsg("Transaction successfully completed");
 };

 function showFailureMsg(){
 showMsg("An error occured while operating the transaction");
 };


 function init() {
 //set up a save strategy
 var saveStrategy = new OpenLayers.Strategy.Save({auto:true});
 saveStrategy.events.register("success", '', showSuccessMsg);
 saveStrategy.events.register("failure", '', showFailureMsg);

 //set up projections
 // World Geodetic System 1984 projection
 var WGS84 = new OpenLayers.Projection("EPSG:4326");    
 // WGS84 Google Mercator projection
 var WGS84_google_mercator = new OpenLayers.Projection("EPSG:900913");    

 //Initialize the map
 //creates a new openlayers map in the <div> html element with id="map"
 var map = new OpenLayers.Map ("map", {    
 controls:[
 //allows the user pan ability
 new OpenLayers.Control.Navigation(),
 //displays the pan/zoom tools                    
 new OpenLayers.Control.PanZoom(),
 //displays a layer switcher
 new OpenLayers.Control.LayerSwitcher(),    
 //displays the mouse position's coordinates in a 
 //<div> html element with id="coordinates"
 new OpenLayers.Control.MousePosition(
 {div:document.getElementById("coordinates")})    
 ],
 //projection: WGS84_google_mercator,
 displayProjection: WGS84
 } );

 // map extent
 var mapextent = new OpenLayers.Bounds(-123.17341, 49.24343, -123.06183, 49.29899);
layer = new OpenLayers.Layer.WMS(
                "States WMS/WFS",
                "http://localhost:8080/geoserver/ows",
                {layers: 'cite:matable', format: 'image/gif'}
            );

 //wfs-t editable overlay
 var wfs_layer = new OpenLayers.Layer.Vector("Editable Features", {
 strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
 //projection: new OpenLayers.Projection("EPSG:26910"),
 protocol: new OpenLayers.Protocol.WFS({
 version: "1.1.0",
 // loading data through localhost url path
 url: "http://localhost:8080/geoserver/wfs",
 featureNS :  "http://www.opengeospatial.net/cite",
 // layer name
 featureType: "matable",
 // geometry column name
 geometryName: "shape",
 schema: "http://localhost:8080/geoserver/wfs/DescribeFeatureType?version=1.0.0&typename=cite:matable"
 })
 });

 map.addLayers([layer, wfs_layer]);
 map.zoomToExtent(mapextent);

 // add the custom editing toolbar
 var panel = new OpenLayers.Control.Panel(
 {'displayClass': 'customEditingToolbar'}
 );

 var navigate = new OpenLayers.Control.Navigation({
 title: "Pan Map"
 });

 var draw = new OpenLayers.Control.DrawFeature(
 wfs_layer, OpenLayers.Handler.Polygon,
 {
 title: "Draw Feature",
 displayClass: "olControlDrawFeaturePolygon",
 multi: true
 }
 );

 var edit = new OpenLayers.Control.ModifyFeature(wfs_layer, {
 title: "Modify Feature",
 displayClass: "olControlModifyFeature"
 });

 var del = new DeleteFeature(wfs_layer, {title: "Delete Feature"});

 var save = new OpenLayers.Control.Button({
 title: "Save Changes",
 trigger: function() {
 if(edit.feature) {
 edit.selectControl.unselectAll();
 }
 saveStrategy.save();
  alert('saved');
 },
 displayClass: "olControlSaveFeatures"
 });

 panel.addControls([navigate, save, del, edit, draw]);
 panel.defaultControl = navigate;
 map.addControl(panel);
 }

I'm confused... I can't figure out where is the problem and what shall I do to fix it need your help guys ..

share|improve this question
    
have you tried it without the proxy? If not, uncomment the very first line and see what happens –  ylka Apr 17 '13 at 7:41
    
yes i did but, its not changing .. –  Аюб ибн Ясин Apr 19 '13 at 14:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.