I have a desktop program in c# .Net that performs certain tasks throughout the day and write information to files. I'd like to make a program that will post the content of the files to my drupal site as posts. Would it be easier to directly access the server's database and add entries?

Where do I start?

Thanks

Comments

yelvington’s picture

neokrish’s picture

I am interested in developing a desktop app for drupal and am interested in knowing other possible ways this can be achieved. Some of my questions are:

1. Is it not that using service module for communicating with a desktop app will load all the other modules' functions which might not be needed as such? If I understand correctly, even if you are using service module and only using a part of the drupal functionality in your desktop app like just adding a content, the drupal website will go through the normall bootstrap process loading all functions into memory.

2. Is it not a good idea to talk to the database directly from desktop app so that there is no php needed?

ZDavid’s picture

neokrish, I'm thinking that accessing the database directly is the best idea, I just don't know everything that is modified when adding a piece of content. Do you know where all that is located?

nevets’s picture

If there is an API to do what you want (yes in the case of adding content) it is better to use the API. It saves you the trouble of knowing all the details of what tables are suppose to be written and it is more portable between major releases of Drupal. Also as a general rule you can not access the database remotely (most hosting companies do not allow this) so unless you desktop app and Drupal are on the same box (in which case why use an app) services would be a better approach.

ZDavid’s picture

I figured that it would be better overall for securities purposes to use an API and it might be a large pain in the butt to figure out how to modify every table entry (debugging that could be a headache).

My company does allow remote database access.

I don't know where to start with the services API and using it with .Net. any pointers? I'm your typical end-user noob, trying to branch out into more programming.

neokrish’s picture

nevets, how about using php as a bridge between the desktop app and the database? I dont mean a drupal module when I say php because that will bootstrap the entire drupal system which I think is not necessary. Say for example, if a drupal site has more than 50+ modules, it would be too much an unnecessary load for the desktop app to do the entire bootstrap just to do some basic select, insert/update, delete query in a few tables. But I also understand that using drupal api is going to make the life lot easier because of table prefixing, joins etc....

so my idea is to

write a custom php code (not a drupal module), which will just call and possibly cache only hook_nodeapi functions of all avaialble modules and the custom php code should be able to process whatever is happening inside _nodeapi. I am not sure if this sounds any good but am very keen to listen to drupal experts opinion on this.

nevets’s picture

hooks, including hook_nodeapi generally rely on bootstrap having been run. For example it establishes the database connection. In this case hook_nodeapi is not sufficient. There is also the node module code and for extended types CCK. And if using a custom type from a module you need that code. The reality is you would be building a fragile system that is likely to break on the next major upgrade of Drupal.

ZDavid’s picture

How does drupal set up the sql database?

ZDavid’s picture

Alright so I can use XML-RPC .NET calls with the Services API?