我嘗試使用phonegap打包我的sencha-touch應用程序時遇到問題。一切工作正常,除了訪問電話中的WFS。 (和瀏覽器運行應用程序沒有問題,WFS訪問是OK)phonegap WFS代理問題
我的phonegap版本是2.9;插入式版本是2.13
在這裏我介紹我的簡單代碼。您還可以檢查以下站點中的示例代碼:http://openlayers.org/dev/examples/wfs-filter.html
var rootUrl = window.location.protocol +「//」+ window.location.host +'/'; var map;
function init() {
map = new OpenLayers.Map({
div: "map",
layers: [
new OpenLayers.Layer.WMS(
"Natural Earth",
"http://demo.opengeo.org/geoserver/wms",
{ layers: "topp:naturalearth" }
),
new OpenLayers.Layer.Vector("WFS", {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
url: rootUrl + 'proxy.py?url=http://demo.opengeo.org/geoserver/wfs',
featureType: "tasmania_roads",
featureNS: "http://www.openplans.org/topp"
}),
styleMap: new OpenLayers.StyleMap({
strokeWidth: 3,
strokeColor: "#333333"
}),
})
],
center: new OpenLayers.LonLat(146.7, -41.8),
zoom: 6
});
}
在phonegap中,訪問WMS沒有問題,但是當我嘗試使用WFS時,它永遠不會工作。
與我之前展示的鏈接相比,地圖上顯示的道路是通過WFS獲取的。在我的phonegap應用程序中,道路將不會顯示。
我想知道它是WFS問題還是電話問題。有些東西阻止了我在phonegap應用程序中訪問WFS。
請給我一些建議和提示,夥計們!我會非常感激。
function getLayerList() {
$.ajax({ url: rootUrl + 'proxy.py?url=http://192.168.0.23/LBEService/Service1.svc/GetEventList',
//async: false,
data: JSON.stringify({}),
type: "POST",
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (result) {
console.log(result);
$("#demo").html(result[0].event_NAME);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
}).done(function() {
});
}
謝謝您的回覆。在xml文件夾下的config.xml文件中,我可以找到這個「」,這意味着所有的域都可以訪問,但是phonegap仍然會忽略我對WFS的訪問。你能否提供更多的提示,我真的很感激。 –
Will
另外,當我禁止訪問phonegap中的所有域時,WMS將變得無法訪問,這意味着「」確實有效。 –
Will
您是否嘗試過通過safari移除檢查員或提琴手或其他東西來查看請求?看看他們是否真的擺脫了phonegap,他們看起來像什麼。 – Scott