REStful web service
REStful web service
A RESTful web service is created using the New Web Service Wizard, and currently only supports URL encoded parameters. This web service type is using the HTTP protocol and can be secured with SSL. The parameters are sent either in the request URL as e.g. http://url/path?p1=abc&p2=def or in the request body for larger data, using the HTTP methods GET, POST, PUT or DELETE.
Using the database analogy, the methods corresponds as Get = select/read, Post = update, Put = insert/create and Delete = delete.
The RESTful web services properties for a request are:
- URI
Defines the web service URI including protocol, port specification (if required), but without the query (or parameters) part that starts with a question mark (?). - Method
Select the HTTP method to use, i.e. one of GET, POST, PUT or DELETE. - Override method
Specifies the method that overrides the request. Certain services (e.g. Google) uses a POST method overridden by a GET. In this case, specify GET as the overriding method. This technique is sometimes required to provide additional data that can be limited with e.g. the GET request. - Encoding
Specifies the encoding for the parameters, default is UTF-8. - Read timeout
Sets the maximum read timeout in milliseconds for the socket connection and is used to control the response time. The default value is 20000, i.e. 20 seconds. If a reply is not received within this time, the web service request fails with a timeout. - NameSpace
Sets the namespace to use for the input parameters. All input parameters must be located in this namespace (but the input and output namespaces can be different). - Class
Used for advanced processing, building and/or manipulation of the request. The class must implement the interface iizix.ws.api.IRESTfulRequestProcessor. It has a single method that is called prior to formatting the web service request, enabling e.g. fetching a Token that is used in the request to identify the requestor. See the JavaDoc of the interface for more information.
Creating a request
A free and public web service that gets the geolocation of an IP address is used in this chapter (see http://www.hostip.info/use.html for more information).
Fill in the request parameters as shown below:

In this case, the JSON reply format is chosen due to get_json.php
(the path defines JSON for this service). The VirtualSpace “start” is also connected to the request.