Synchronize databases via Webservice C # asp

0

I have databases on both the server and the client and would like changes made to one to be sent to the other through a Webservice. For example a new row is added to a table on the server then this new insert is sent to Webservice, which should replicate this action to the client database. Would that be possible?

NOTE: I can not use a database on the server, it must be a WebService.

    
asked by anonymous 18.12.2014 / 18:59

1 answer

3

I think you need to be very careful about the architecture. A lot is possible, but not everything is feasible or interesting for you.

Feasibility

How much information will you send to an external system? If the volume is large, sometimes it is not feasible to format everything with XML. This is why there is replication of databases, computers in protected networks, etc. You may find that the volume is small, but you need to be careful. Small operations are not always easy to replicate. It is easy to send new lines into a data table. But if you have a balance table of customer accounts, updated every day, you'll have to send the whole table every day.

Architecture

You also need to think about architecture. Send data does not mean that you need to be active. You can be a passive integrator.

For example, you can have tables that register who are the customers who can get your information with a token / security key. From X to X time the client accesses a webservice in your application with this token and your application notifies you if you have data to integrate.

From there you create control tables, for each client, which was the last integrated record etc. And then you send a set of records since the last time he asked. You can also ask him to send the last code that he was able to do the inserts successfully (a date for example). But then you need to put fields all over the bank (of the tables you want to integrate) with update dates to ensure you always send everything right.

Even so, always paginate. Do not let too much information accumulate.

Passive mode advantages:

  • You create a protocol for your data. If an outside company you want to access, you will not run the risk of each publishing a webservice with a slightly different name, one in java another in C #, with some integration issues that you will be responsible in dealing with. If they need access, they access and that's it.

  • If there are constant failures in communication, the client may be directly responsible for its implementation, even if the fault is client-side. When you guarantee that you can deliver the data and can recover by showing the customer, you will hardly have to have many headaches every time you drop integration

Information

Your webservice always exposes data. If you want to actively send something, you need the client to expose a webservice to you. There he needs to implement the insertion routines at his base. The same goes for passive mode. You can send information whenever he asks for it, but he will always be responsible for storing it.

Tip

If you are creating the client and server, use passive mode whenever possible. But first of all, consider very well the possibility of database replication by the bank when the volume is high.

    
19.12.2014 / 04:08