Microsoft Dynamics NAV SOAP Web サービスからデータをロードする必要があるアプリに取り組んでいます。ブラウザ(IE9またはChrome v 26.0 ...)でコードを実行すると、コードは本来の動作をします。しかし、Android エミュレーターまたは実際のデバイス (htc センセーション) でコードをテストすると、ajax 呼び出しが失敗し、XMLHttpRequest エラー 0 が発生します。
ただし、Android システムでの基本認証なしで、さまざまな Web サービスからデータをロードすることもできました。
私のホワイトリスト (res/xml/config.xml にあります) は次のようになります。
<access origin="*" />
<plugins>
... // all other possible plugins
<plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
</plugins>
そしてここにコード:
function readTimeRecords(callback) {
var wsUrl = 'http://.../WS/CRONUS%20AG/Page/Time_Recording';
var soapMessage = '<?xml version="1.0" encoding="utf-8"?>' +
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' +
'<soap:Body>' +
'<ReadMultiple xmlns="urn:microsoft-dynamics-schemas/page/time_recording" >' +
'<filter>' +
'<Field>No</Field>' +
'</filter>' +
'<bookmarkKey />' +
'<setSize>' +
'5' +
'</setSize>' +
'</ReadMultiple>' +
'</soap:Body> ' +
'</soap:Envelope>';
// enable cross site requests in IE
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
$.ajax({
url : wsUrl,
type : "POST",
dataType : "text",
data : soapMessage,
processData : false,
contentType : "text/xml",
password : "passwd",
username : "domain\\user",
beforeSend : function(xhr) {
xhr.setRequestHeader('SOAPAction', 'urn:microsoft-dynamics-schemas/page/time_recording');
},
success : function(msg) {
...
callback(record);
},
error : onError
})
}
function onError(XMLHttpRequest, textStatus, errorThrown) {
debugger;
console.log("error: " + textStatus + ", errorThrown: " + errorThrown);
// i just get the message error: error:
}
誰かがその問題を解決する方法を知っていますか?
使用したセットアップ: jquery.mobile-1.3.0 jquery-19.1 cordova-2.5