Setting Content-Type for Error Response

Using TIBCO API Exchange Gateway, you can set the Content-Type for the error message.

When the error response is returned for any incoming request from TIBCO API Exchange Gateway, the content-type of the error response is set as follows:

  • The Content-Type can be set based on the Accept Header of the incoming request.
  • If the HTTP header of the incoming request message contains the Accept Header, TIBCO API Exchange Gateway sets the content type of the error response to the content type specified in the Accept Header of the request message.
  • If the HTTP header of the incoming request message does not contain the Accept Header, TIBCO API Exchange Gateway sets the content type of the error response using the tibco.clientVar.ASG/Response/DefaultContentType property. The property is set in the ASG_CONFIG_HOME/asg.properties file. See tibco.clientVar.ASG/Response/DefaultContentType.
Note: If the tibco.clientVar.ASG/Response/DefaultContentType property is not set, TIBCO API Exchange Gateway sets the Content-Type of the error response message to application/json.

To set the Content-Type for the error response from TIBCO API Exchange Gateway for any incoming request, follow these steps:

    Procedure
  1. Navigate to the ASG_CONFIG_HOME directory.
  2. Edit the asg.properties file in a text editor.
  3. Set the following property :

    tibco.clientVar.ASG/Response/DefaultContentType

    For example, you can set the property to application/xml as follows:

    tibco.clientVar.ASG/Response/DefaultContentType=application/xml
    Note:
    • If the tibco.clientVar.ASG/Response/DefaultContentType property is set to application/XML or text/XML, the error response is returned in XML format to the requester.
    • If the tibco.clientVar.ASG/Response/DefaultContentType property is set to application/JSON, the error response is returned in JSON format to the requester.