Do you rather need more ways of make something persistent? Then you might want to consider WebSQL:
http://docs.phonegap.com/en/3.5.0/cordova_storage_storage.md.html#Storage
But if you really need a little dummy server (Part 1 of your question), it depends on your background of experience so far. As you have installed PhoneGap, you will probably have NodeJS installed, which is meant to be a lightweight, fast and "immediate" server.
So you can save this script somewhere in your file system, say as /home/meee/dummy.js
:
var http = require('http');
http.createServer(function (req, res) {
var arguments = require('url').parse(req.url, true);
var query = arguments['query']; // JS Object with parsed GET string arguments
var command = '';
if (typeof query['command'] !== 'undefined') {
command = query['command'];
}
// Here would be the well designed command handler
var resultFromCommandHandler = "Work result for command: " + command;
var statusFromCommandHandler = "OK"; // what a liar
var response = { "status" : statusFromCommandHandler, "result" : resultFromCommandHandler };
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end( JSON.stringify(response) );
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
Then run from the command line:
node /home/meee/dummy.js
> Server running at http://127.0.0.1:1337/
Then fire up a web browser and enter this url:
http://127.0.0.1:1337/?command=getList&page=orders
The browser shows you the answer from the server. So you have the smallest thinkable server running. With some tinkering, you will get a running configuration in Eclipse to have Node running with your dummy script. I even expect that there are ready-to-use plugins for Node and Eclipse, as this software is very popular.
Now from your PhoneGap App, just try to call the URL and add something useful to the command handler, then you can easily interact between your app and a server.
Further, as I mentioned your experience, you might have a tomcat server installed, so use this. If you have a mac, there might be some Apache laying around, just try to start it. Over time, I have come to use TurnKeyLinux, which is a brilliant micro LAMP installation in a VMware/Fusion image (http://www.turnkeylinux.org/)
Concerning part 2 of your question, how to contact the server:
- AJAX is a method, not a certain concrete protocol. You use AJAX in order to get parts of your webside, which you build in your webside as soon as you got them from the server. You can do AJAX calls with any client side language.
- REST is a communication principle, where you communicate with URLs that are well defined. It belongs to the huge field of web architecture definitions like SOAP, yet it is much lighter than SOAP.
- jQuery is a library that simplifies writing great Javascript clients. It contains a useful $.ajax() method which you can use.
For now, I recommend forget about SOAP/REST etc. Just write a little HTML frame in PhoneGap with a button, and make the click Event of the button fire a certain AJAX call, implemented with JQuery. With the AJAX success event, display the result from the server in your PhoneGap app. This setup is your proof of concept, and it can easily be debugged.
After, try to define some use cases and CRUDs that are necessary for your application. From this, you will gain the commands and arguments needed, which you can implement into your dummy server.
Maybe you must do some further research to go on after this point, read some open source server application, read some definitions and concepts. Be warned that there are many pitfalls in writing web server applications, so do not make some hard deadline promises, it won't work in your first application. Also, you will have to redesign our dummy HTML framework soon in order not to get strangling spaghetti code.