Setting Content-Type for Error Response

Using TIBCO API Exchange Gateway, you can set the Content-Type for the error message if the Content-Type is not set in the HTTP header of the incoming request.

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:

  • If the HTTP header of the incoming request message contains the Content-Type, TIBCO API Exchange Gateway sets the content type of the error response to the content type of the request message.
  • If the HTTP header of the incoming request message does not contain the Content-Type, 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.