0

我正在使用 Microsoft Sync Framework 将 Android 设备上的 Datadictionary 中的详细信息与 SQL Server 同步。最初从 sql server 同步所有数据成功。但是在添加一些数据并单击“同步”按钮后,出现以下错误。你能告诉我有人遇到过这个吗?

[Sync Error]:Error occurs during sync. Please check logs below.
[Upload Change Response Error]: 500 Response: <ServiceError xmlns="http://schemas.datacontract.org/2004/07/Microsoft.Synchronization.Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ErrorDescription>System.InvalidOperationException&#xD; serverBlob is empty&#xD; at Microsoft.Synchronization.Services.SqlProvider.SqlSyncProviderService.ApplyChanges(Byte[] serverBlob, List`1 entities)&#xD; at Microsoft.Synchronization.Services.UploadChangesRequestProcessor.ProcessRequest(Request incomingRequest)&#xD; at Microsoft.Synchronization.Services.SyncService`1.ProcessRequestForMessage(Stream messageBody)&#xD; &#xD; &#xD; </ErrorDescription></ServiceError>

在下面的代码中,我在单击 Sync 按钮时得到 xmlHttp.status=500

this.sendRequest = function (serviceUri, successCallback, errorCallback, dir) {

        TraceObj("[" + dir + " Request]:", serviceUri, this.dataObject());
        // Construct HTTP POST request
        var xmlHttp = new XMLHttpRequest();
        xmlHttp.open("POST", serviceUri);
        xmlHttp.setRequestHeader("Accept", "application/json");
        xmlHttp.setRequestHeader("Content-Type", "application/json");
        // Handle success & error response from server and then callback
        xmlHttp.onreadystatechange = function () {
            if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                    var res = new SyncFormatter();
                    if (res.parse(xmlHttp.responseText)) {
                        TraceObj("[" + dir + " Response]:", serviceUri, res.dataObject());
                        alert("[" + dir + " Response]:", serviceUri, res.dataObject());
                        successCallback(res);
                        return;
                    }
                }
                TraceMsg("[" + dir + " Response Error]: ", xmlHttp.status + " Response: " + xmlHttp.responseText);
                errorCallback(xmlHttp.responseText);
            }
        };
        xmlHttp.send(this.toString());
    };
}
4

1 回答 1

0

我找到了问题的根本原因。那是当我从数据字典存储中获取值时,value has the single quotes in the values so not able to load the values in webview. Now i have replaced single quotes by \'. 现在工作正常

于 2013-04-16T11:42:59.860 回答