Flashcards in Web Services Deck (18):
What are two ways to use web services?
- Using library APIs
- Server side URL based requests
How does using APIs to use web servers work?
via objects and method calls e.g Geocoder
How does using URL based requests to use web servers work?
via curl e.g sunrise/sunset and google places
What do we need to know to use an API?
- inclusion links or scripts
- available objects
- available methods
- useage requirements
What do we need to know to use URL based web services?
- base URL
- request options
- return formats
- returned data structure
What are two web service protocols?
What is the web service protocol SOAP?
- messages and responses
WSDL used to publish service information
What is the web service protocol REST?
Representational State Transfer
- Based around the concept of verb/noun requests
- relies on standard HTTP messages
- follows the RESTful approach
What are CRUD operations?
Which CRUD operations are idempotent and which are safe?
Create - Idempotent
Read - Safe
Update - Idempotent
Delete - Idempotent
What is meant by idempotent?
has the same effect however many times it is performed on the same resource
What is meant by safe?
leaves the original resource unchanged
What is meant by RESTful requests are stateless?
There is no dependence on any previous request
What is meant by RESTful URLs?
- URL rewriting
- We provide a RESTful URL to users of our webservice
- we use URL rewriting to convery the incoming URL to the actual url required for the server side script with respective paramters
rewrite http://webapp.cms.waikato.ac.nz/333lib/rent al/vehicles/AAA111.json to a RESTful URL
http://webapp.cms.waikato.ac.nz/333lib/rent al/php/vehicleindex.php? operation=getVehicleInfo& id=AAA111
How does URL rewriting work?
- We create an .htaccess file to define the rewrite rules
- The rewrite base identifies all urls to be rewritten
- the rules use regular expressions to identify which parts of the url to rewrite
- the rules describe how the maintaining part of the url is to be rewritten
- options such as QSA allow us to handle parameters to requests
What is MVC?
Model View Controller
Model - data
View - User interface
Controller - links the model to the view