How to fix 503 Service Unavailable error for REST Invoke API activity

How to fix 503 Service Unavailable error for REST Invoke API activity

book

Article ID: KB0077875

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks BW 6x

Description

Sometimes we may see that when we call any REST service through Invoke REST API activity then it's failing with "503 Service Unavailable" error. But If you call the same REST service through "Send HTTP request" then its working fine with same input parameters.

-----------------------------------------------
<msgCode>TIBCO-BW-PALETTE-REST-2000028</msgCode>
  <statusLine>
    <httpVersion/>
    <statusCode>503</statusCode>
    <reasonPhrase>Service Unavailable</reasonPhrase>
  </statusLine>
  <httpMessage>
---------------------------------------------------

Issue/Introduction

How to fix 503 Service Unavailable error for REST Invoke API activity

Environment

All

Resolution

The reason for this is difference in Send HTTP Request (where it worked without this header) and REST Invoke:

In Send HTTP Request we are sending "host" as "<HostName>". But in REST Invoke we are sending the "host" as "<HostName>:<Port>"(one with port number).
The external REST Server (which we are trying to access using REST Invoke activity) doesn't seem to like the "Port" in the "host" and reject it with 503 error.
If we override the default "host" in REST Invoke with dynamic header then issue would be resolved.

Solution:

In REST Invoke define another dynamic header "host" and specify its value as "<HostName>" (One without port, see attached REST_Invoke_Header.png)