HTTP Method/Content-Type Combinations
When you configure a REST virtual service it is important to specify all the HTTP methods that are supported for the service. For example, if the REST virtual service is deployed to CloudStreams and only the GET method was selected in the REST virtual service definition, then CloudStreams will only permit GET invocations. A POST request will be rejected with a return of statusCode 405 even if the native service happens to support POSTs.
At run time, CloudStreams determines the type of a request message based on the message's HTTP method and its Content-Type. (The absence of the soapAction header will indicate to CloudStreams that the message is an XML message.)
The valid HTTP method/Content-Type combinations are as follows:
This method... | Can be included in a message of this type... |
POST | application/xml application/json application-x-www-form-urlencoded multipart/form-data |
PUT | application/xml application/json application-x-www-form-urlencoded multipart/form-data |
GET | application-x-www-form-urlencoded |
DELETE | application-x-www-form-urlencoded |
Note that:
If
CloudStreams receives a request sent with an HTTP method that is not specified in the REST virtual service definition, it will return a 405 error.
If
CloudStreams receives a request sent with a wrong Content-Type, it will return a 415 error. In addition, if the wrong Content-Type is used with a GET or DELETE, then the query parameters contained in the message (if any) will not be processed.