Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 16, 2012 08:28 AM by Steven Cheng - MSFT
Apr 14, 2012 07:15 AM|LINK
Hi, I am new to webservices. I am accessing a webservice which delivers an xml document. From this xml document, I have to feed my relational database. Is it a good idea to save the xml document to a physical location when ever we access the service ? Or
Fetch the data to feed database from the xml document in the code itself. we access that webserivce once a day but it has a lot of data.
Please comment on this.
Apr 15, 2012 08:20 PM|LINK
Apr 16, 2012 08:28 AM|LINK
For your scenario, you will call the webservice to get the certain XML format data and then use the XML data to perform some local relational database updating(insert or modify), correct?
If the xml data is not quite large and the XML processing and inserting code logic is not very complicated, I would recommend you directly use some .NET XML processing API such as LINQ to XML to parse the XML and do the local DB manipulation.
If the data is quite large and the further processing agaisnt XML data(and relational db) might cause lots of time, I agree that you might need to store the data to local file and process it offline later. And for offline processing, you can consider creating
a separate console application which simply take the XML file path(you saved locally) as parameter and use it to parse data and update the relational database. Here you can use either LINQ to XML or traditional XML reader based on your requirements. And the
entire workflow will be something like:
1. Your main client app calls webservice and get the XML format data
2. Your main client app save the XML response data into a local file
3. Your main client app start a new process (a console) and pass the xml file as parameter
4. The console app(in separate process) load the local xml file(with the file path supplied in parameter) and do update on relational db
#LINQ to XML