Designer 10.7 | webMethods Service Development Help | Appendix | Usage Notes on REST | Configuring a REST Resource Using the Legacy Approach | Setting Up a REST Application on Integration Server | Services for REST Resources Configured Using the Legacy Approach
 
Services for REST Resources Configured Using the Legacy Approach
When you build a REST application on your Integration Server by configuring resources using the legacy approach, you must include services that correspond to the HTTP methods you want to provide for each resource. These services must be named as follows:
Service
Description
_get
Performs the GET method.
_put
Performs the PUT method.
_post
Performs the POST method.
_patch
Performs the PATCH method.
_delete
Performs the DELETE method.
These services reside in folders on your Integration Server in a directory structure that is specific to your application. For example, the discussion application described in Configuring a REST Resource Using the Legacy Approach might have the following structure as viewed from Software AG Designer:
In addition to the _get, _put, _post, _patch, and _delete services, you can also place a special service named _default in one or more of the application folders. Integration Server executes this service if a REST request specifies an HTTP method that is not represented by a service in the folder. For example, suppose the folder contains the _get, _put, and _post services, but no _patch or _delete service. If the client issues a DELETE request, Integration Server will execute the _default service, and pass “DELETE” to it in the $httpMethod variable.
If a request specifies an HTTP request method that is not represented by a service in the folder and there is no _default service in the folder, the request fails with the “404 Not Found” or “405 Method Not Allowed error.” Integration Server issues 404 if the first token in the URI does not exist in the namespace, or 405 if one or more tokens in the URI identify elements in the namespace but the URI does not correctly identify a REST resource folder and a service to execute.
Example 1
A REST resource’s folder contains the _get, _post, and _default services:
If the client sends a...
Integration Server responds by...
GET request
Executing the _get service
POST request
Executing the _post service
DELETE request
Executing the _default service
Example 2
A REST resource’s folder contains the _get, _put, and _delete services:
If the client sends a...
Integration Server responds by...
GET request
Executing the _get service
PUT request
Executing the _put service
POST request
Issuing error “405 Method Not Allowed”
Additional possible uses for the _default service are:
*Direct all REST requests through common code before branching off to individual GET, PUT, POST, PATCH, or DELETE methods.
*Make PUT and POST processing the same by directing PUT and POST requests to the same code.