Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Webservices architecture with datasets/re-use connections

Webservices architecture with datasets/re-use connections

Scheduled Pinned Locked Moved ASP.NET
questionjavadatabasexmlarchitecture
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JoostV
    wrote on last edited by
    #1

    Hi all, Just have a interesting question (I personal think). I want to use a webservice as a simple message system. The webservice has a method that returns a string (the message). The data is stored in an xml file and will act as a kind of database (DataSet). There won't be al lot of messages in the dataset, but clients (think a couple of thousand) will do a request to the webservice every 30 min each. What about the architecture? There are two ideas I have: 1) Simple, but effective???: Create a webmethod, for each request read the dataset from file and find out if there are messages. 2) Advanced, but more effective?? Put the DataSet in the internal memory of the webserver and re-fill the dataset if the xml datafile changes (with a fileSystemWatcher). It makes clear that the first idea creates allot of I/O. What do you all think? What is the best method. And how can i make idea 2 to work? How do i put the dataset into the internal memory? Is there a method like init() or destroy() with webservices (like java servlets these methods are being used if the servlet starts up and shuts down) Like to hear your idea's!! With kind regards, Joost (the Netherlands)

    M 1 Reply Last reply
    0
    • J JoostV

      Hi all, Just have a interesting question (I personal think). I want to use a webservice as a simple message system. The webservice has a method that returns a string (the message). The data is stored in an xml file and will act as a kind of database (DataSet). There won't be al lot of messages in the dataset, but clients (think a couple of thousand) will do a request to the webservice every 30 min each. What about the architecture? There are two ideas I have: 1) Simple, but effective???: Create a webmethod, for each request read the dataset from file and find out if there are messages. 2) Advanced, but more effective?? Put the DataSet in the internal memory of the webserver and re-fill the dataset if the xml datafile changes (with a fileSystemWatcher). It makes clear that the first idea creates allot of I/O. What do you all think? What is the best method. And how can i make idea 2 to work? How do i put the dataset into the internal memory? Is there a method like init() or destroy() with webservices (like java servlets these methods are being used if the servlet starts up and shuts down) Like to hear your idea's!! With kind regards, Joost (the Netherlands)

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, I would go for the second option. As you may know that in XML Web Services you can access the common objects like Application, Session ... as you would with an ASP.NET application, so in this case to implement the second option I would choose the Cache object to store data which can be accessible to all users. The reason I choose the Cache object is that we can avoid accessing IO multiple times and quickly retrieve data. More importantly, the Cache object provides you with an option of adding an item to the Cache with a dependency. There are several dependencies available, and the file dependency is selected here. So when the data is added to the Cache, you can also define a dependency of the item on the external xml file. If the xml file is updated, the item will be removed from the Cache ,then you simply refresh the Cache item with the updated data. You can initialize the Cache item in the Application_Start event of the Global.asax file, and tear it down in the Application_End event if you want. For more information, you can see Caching Application Data[^] Another way is to use the FileSystemWatcher as you suggested to watch the xml file, and you can save data in the Application or Cache objects. When the changes in the xml file are found, you can provide some code to invoke a method (or a web method) to refresh data in memory.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups