Home » Visual Studio

How to sync data with web services??

Can someone please give me a link to an example or tutorial on how to use a web service to push data from a SQL Server database to a SQL Server Compact 3.5 database that is on a Pocket PC device?


1 Answer Found



I am using Javascript to call the UpdateListItems() webservice through SOAP to add an entry to a list then I am using the GetListItems() webservice to query the number of items in that list.

I am successful in adding an new entry in the list, but when I query the GetListItems(), it does not return the number of entries (items) in the list unless it was entered via the SharePoint GUI, not the UpdateListItems() routine I have written.

I will add the source code for your reference and help.:

var response;

function SOAPUtilForHitCount(data,action,listName,listPath)
this.data = data;
this.listName = listName;
this.listPath = listPath;

this.SOAPHeader =  function()
var stack = [];
stack.push("<?xml version='1.0' encoding='utf-8'?>");
stack.push("<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>");
return (stack.join(""));

this.SOAPBody =  function()
var stack = [];

stack.push("<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>");
stack.push("<listName>" + this.listName + "</listName><query><Query xmlns=''><Where><Eq><FieldRef Name='URL' />");
stack.push("<Value Type='Text'>" + this.listPath + "</Value></Eq></Where></Query></query>");
stack.push("<queryOptions><QueryOptions xmlns=''>");


else if(action=="update")
stack.push("<UpdateListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>");
stack.push("<listName>" + this.listName + "</listName>");
stack.push('<updates><Batch OnError="Continue" xmlns="">');
stack.push('<Method ID="1" Cmd="New">');

for(var i in data)
stack.push('<Field Name="' + i + '"><![CDATA[' + data[i] + ']]></Field>');



this.SOAPFooter = function()
return ("</soap:Envelope>");

this.getSOAPEnv = function()
var env = this.SOAPHeader() + this.SOAPBody() + this.SOAPFooter();
return env;

var data =

function sendSOAPEnv(url,callback,postData,action) {
var req = getXMLHTTP();
if (!req) return;
var method = (postData) ? "POST" : "GET";

req.setRequestHeader("SOAPAction", action);

if (postData)
req.setRequestHeader("Content-type","text/xml; charset=utf-8");
req.onreadystatechange = function () {

if (req.readyState != 4) return;
if (req.status != 200 && req.status != 304) {
alert('HTTP error ' + req.status);

if (req.readyState == 4) return;
alert("Done sent request");

function getXMLHTTP() {

return new ActiveXObject("Microsoft.XMLHTTP");

function callback(req)
        response = req.responseXML.xml;

//you can toggle between count and update
//var task = "count";
var task = "update";

//you can toggle between the GetListItems and UpdateListItems web services
//var webServicePath = "http://schemas.microsoft.com/sharepoint/soap/GetListItems";
var webServicePath = "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems";

var list = "HitCounter"; //put your list name here
var listpath = "/<your folders>/Lists/HitCounter/AllItems.aspx"; //your list path
var BaseUrl = L_Menu_BaseUrl + '/_vti_bin/';

var action = new SOAPUtilForHitCount(data,task,list,listpath);
sendSOAPEnv(BaseUrl + "lists.asmx",callback,action.getSOAPEnv(),webServicePath);

var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");

function loadXML(xml)

function verify()
       if(xmlDoc.readyState!=4)return false;              

function getHitCount(el)

//comment the below alert if your are using the UpdateListItems web service.
//alert("Hit Count is " + getHitCount('rs:data'));



i got requirement to sync both database and a folder(with sub-folders) with remote server through web service.
(sql server 2000 on both client [Windos XP] & remote server[Windows Server 2k3])

i have go through "Synchronizing Databases" & "Synchronizing Files" section of the documentation, and try it out in the same machine, and everything is fine.

now i want to create one asp.net web service run on remote server and try to sync through that web service. i have no clue how to achieve it.

anyone can send me some sample code which include server part and client part?



I have a ASP.NET web service that I use to consume a stored procedure. The SP changes CRM data. When I call this service from an external asp.net web application I get valid responses. When I call the service from the onChange event, I always get empty strings as reponses. I need to evaluate the result in the event to do other actions. What can I do? below is the code I am using to call the service. The call does not fail... Just does not give me what I need. the alert in the last line is always empty. If I get it into an xml instead of text, I cannot do DOM stuff on it.

Please help.

var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    var uri = "http://localhost:8088/service.asmx";

    var query1 = "<?xml version='1.0' encoding='UTF-8'?>";
    query1 += "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
    query1 += "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"";
    query1 += "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
    query1 += "<soap:Body>";
    query1 += "CallCRMStoredProc xmlns=\"http://asd.org/\"";
    query1 += "<paramString>";
    query1 += "<SPName>p_MoveContactProfile</SPName>";
    query1 += "<SPParams>uniqueidentifier:";
    query1 += crmForm.ObjectId;
    query1 += ":@ContactId,nvarchar:";

    var query2 = ":@TargetData</SPParams>";
    query2 += "</paramString>";
    query2 += "</CallCRMStoredProc>";
    query2 += "/soap:Body";
    query2 += "</soap:Envelope>";

    var query = query1 + "check" + query2;

            xmlhttp.open("POST", uri, false);
            xmlhttp.setRequestHeader("Content-Type", "text/xml");
            xmlhttp.setRequestHeader("SOAPAction", "http://asd.org/CallCRMStoredProc");

            var rx = xmlhttp.responseText;
            alert ("Custom Call to check CRM failed!!");



In my application, I need to make web service calls for each user action. Some calls may take as much as one minute to return.

Currently, I am making asynchronous calls to the web service. However, my design would be much simplified if I use synchronous call in a background thread.

I would appreciate your help in understanding the cons of the second approach.

Thank you in advance for your help.





I am developing a wpf application on which data is consumed through a web service develop by java team, and java code will run on Linux Box.

Can we use the Sync Framework in this scenario?

If yes, what will be the Cost.?




I have a North Central US Account which I used as a HUB and a Southeast Asia account which I used as a member. I cannot initiate synchronization from the hub. Only two controls are active, Add New and Dashboard. All others lead to no where. Is there a demo available where this is shown to work. May be there is something I am missing.



In order to circumvent the version mismatch problem the following two tests were carried out. From these observations I conclude there is a problem with this web interface.

1. I create a new table and populated it with some data and tried to synchronize. I got the same mismatched version error as before. So creating a new table will not help.

2. I used the Copy database function (released in SU4) and created a copy of the Bluesky and named it different. I also deleted the Bluesky database from North Central US. The SQL Azure labs portal does not reflect these change s. It still shows the database 'Bluesky' although it has been deleted. I think there should have been a provision of specifying the database in the member list. Right now it is only "Bluesky' (which has been removed).


I confirmed that item 2 was because of browser cache. I opened a new screen and the problem disappeared.


I am looking at this simple scenario:

I have my data in North Central US which I have designated as the HUB. The data is in a table in the only user database on this server.

I have providisoned a SQL Azure server in Southeast Asia where I have created a User database which is empty.

I synchronize and the table gets replicated to the database in the Southeast Asia DC.

I make conflicting changes to the tabels at the two data centers.

I start synchronization again. Should I expect changes made to the North Central US database table to win?

I am using sync services 2.0 and needed to ignore the data trigger provisioning when applying a scope and create the update/insert/delete data triggers myself so I could set SET NOROWCOUNT ON on these triggers.  The sync provider that I am using is a SqlSyncProvider.

I have about 35 tables that we are tracking in this scope, and now I'm getting poor performance within my application upon updates and inserts etc.  Namely, this is due to these data triggers.

Are there any posts about tweaking and enhancing the performance of the data triggers? 

I have searched the internet for asynchronous triggers with sql server, and most posts say in order to implement this functionality you should use a service broker.   This page has an example:


Has anyone needed to implement this functionality in order to improve their performance?   Thanks in advance for your feedback.


I am trying to use external web service in my sharepoint.

i am using dataview webpart in sharepoint designer to enter WSDL but it needs username and password to acces that wsdl.

please let me know how to pass user name and password in this case?

is there any thing i have to do in web.config file of that web app.


Appreciate your help!!!!!!







our enviornment is setup as follows:

OS: Win 2008 R2

Tools: VS 2010, Sharepoint Designer 2010, SQL SERVER 2008

1) I developed a custome Web Part in VS 2010 with html table in a usercontrol.ascx, I then deployed this UserControl.ascx to the server.

 2) in the share point designer I created the SOAP Service Connection. by going to, Data Sources > SOAP Service Connection enter the URL for the Web Service to create the service.

3) I then created a aspx page, and added a web part zone and in it I have added the custom web part I created.

4) I can see the Web Service in the "Data Source Details" pane in the sharepoint 2010 designer

What we want to achive is to be able to do is without writing code connect the web service to the custom web part.

I am unable to get the data from the web service into the custom web part I have added.

any help in this matter will be greatly appreciated.

and many thanks in advance.

Kind Regards :)




I am looking for an example on "Data View Web Part" in WSS 2010 to read and write data from a web service that I have written and then update the database.

or if you have a any better way of doing this function of reading and writing data to and from "Data View Web Part" in WSS 2010.

Thanks heapes in advance.

Kind Regards, 



I followed this video : http://download.microsoft.com/download/6/7/3/6730f0e7-a649-4656-96ab-150c7501a583/IntroToSyncServicesADODetNet_HighQuality.wmv. 

One thing that is weird for me and I can't really understand is this scenario:

- I'm using bidirectional synchronization

- In my project I synchronize data when project in in debug mode i can see that rows are updated to remote database

- then i clean solution (database is one more time copied to bin folder)

- run again

- and I synchronize data and sync statistics shows that there is no data to synchronize...

- but I don't have data uploaded to remote server previously in my local store.... 


How to resolve this issue?


I would be really bad if someone install my application on different machine and then he can't synchronize data previously uploaded.

Any ideas?...



Daniel Skowronski


I am having a problem that could be very common. I use ADO.NET sync services to sync a SQL CE 3.5 database with a large SQL 2005 database.

Due to the large amount of data exchanged I get OutOfMemory exception. So I started looking for a way to use batching. I think if the server would send for example 1000 rows at one time there will be no problems. But I still didn't find a way to implement this. There are some articles on how to implement batching with CHANGE TRAKING, but I can't use SQL2008 yet.

Are there any working examples for ADO.NET sync services without change tracking?



I think, everybody know when changed Sync Service URL on server, client will throw exception until you clear all client isolate storage.

Do you think, this is a big trouble, because some time you have change service URL and all client can not run your app, until they clear isolate storage.

Do you have any ideal to solve this proplem.

Thank you.


I am new to the world of Sql server programming. I am starting a project and will use SQL Server 2008 express as the backend at a remote site and SQL Server 2008 as the central data collection point. In recent articles for SQL server 2008 the programmer used merge replication and not the MS Sync framework. For collect of data is merge replication a better option than MS Sync framework.

Please humor me while I am on this learning curve and thanks for you help.



Are there any tools/process available to convert a .net webservice to j2ee web service.

One of my project requires this migration.

would be easy if there are any opensource or Java/Sun supported tools available for this task.

Please let me know of any resources.



I am trying to prove I can use SSIS to connect to a web service.  The WS I am trying to connect to was developed by a vendor and covered by a NDA, but I was able to reproduce the issue with a public WS.

Here are the steps to reproduce the issue:

In the Web Services Connection Manager, I entered http://office.microsoft.com/Research/Providers/MoneyCentral.asmx?wsdl in the URL window.  I am able to successfully "test" the connection I pasted the above link into IE and saved the resulting XML as a .wsdl file on my local machine.  In the Web Services Task Editor, General Tab, I specify the path to the .wsdl file and click on "Download WSDL" button.  No Issues When I click on "Input" and select "MoneyCentralRemote" from the drop-down for Service, I receive an error message saying "This version of the Web Services Description Language (WSDL) is not supported"

So the questions are:

Did I perform the above steps correctly? What WSDL versions are supported in SSIS? How can I tell what WSDL version was used to create the .wsdl I am trying to access? If the WSDL is an unsupported version, is there a work-around to fix the issue?

We have a process that loads multiple dll assemblies each of which contains multiple service interfaces hosted by one or more actual services.  Some of our components need to be able to call other services internally.  Of course I do not want the overhead of marshalling / opening a channel / etc.

Since services can be singletons or created each time, I am trying to find a way to get the service or interface through the wcf architecture that handles this.

Does anyone know of a way?



When i am using an SSIS web service task, is it possible to get all the methods information to different tables.


Else if the above case is not possible, can i use multiple web service tasks with same http connection(.wsdl file) to access the web service for each method and then load the info to a table.(if i can do this, is there any performance issue)




<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure