Question

I am using Microsoft Sync Framework to sync the details from the Datadictionary on android device with SQL Server. Initially get success to sync all data from sql server. But after adding some data and when clicking on the Sync button getting the following error. Can you please tell me is anybody came across this?

[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>

In the below code, i'm getting xmlHttp.status=500 when clicking on the Sync button

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());
    };
}
Was it helpful?

Solution

I have found the root cause of the problem. That is when i get the values from datadictionary storage, value has the single quotes in the values so not able to load the values in webview. Now i have replaced single quotes by \'. Now working fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top