Enabling web services support

Back to: Reference | Web Services


In order to handle HTTP web service requests, your application must enable two facilities: the HTTPServer facility and either the JSONWs facility or the XMLWs facility in one of its configuration files.

{
  "Facilities": {
    "HTTPServer": true,
    "JSONWs": true
  }
}

or

{
  "Facilities": {
    "HTTPServer": true,
    "XMLWs": true
  }
}

Granitic will then automatically detect any components that implement httpendpoint.Provider and route HTTP requests to them according to their URI and HTTP method.

In practise, you will generally define components of type handler.WsHandler which implements httpendpoint.Provider. Custom implementations of httpendpoint.Provider are covered in handlers and endpoints

Granitic’s web service implementation is designed to minimise the amount of boilerplate code you need to write to handle common parts of the web service request processing lifecycle (URI matching, parsing, validation etc). Instead it provides a well defined set of processing phases and components which you can customise or replace.


Next: Processing phases

Prev: Web service principles