The Request Message’s HTTP Methods and Content-Types for REST and XML Services
When you configure the Entry Protocol step of a virtual REST or XML service, it is important to specify all the HTTP methods that are supported for the service. For example, if the virtual service is deployed to Mediator and you selected only the GET method in the virtual service's details page, then Mediator will only permit GET invocations. In this case, a POST request will be rejected with a return of statusCode 405 even if the native service happens to support POSTs.
It is important that the client's requests contain an HTTP Content-Type header. At run time, Mediator determines which message builder to use based on the message’s HTTP method and its Content-Type. (The absence of the soapAction header will indicate to Mediator 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 Content-Type... |
POST | application/xml application/json application/x-www-form- urlencoded multipart/form-data or text/xml |
PUT | application/xml application/json application/x-www-form- urlencoded multipart/form-data or text/xml |
GET | application/x-www-form-urlencoded |
DELETE | application/x-www-form-urlencoded |
Note: | Keep the following points in mind: If Mediator receives a request sent with an HTTP method that is not specified in the virtual REST service or virtual XML service definition, it will return a 405 error. If Mediator 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. |