SAP Knowledge Base Article - Public

3450553 - URL Redirection in Cloud Integration fails.

Symptom

URL redirection fails in Cloud Integration with 302 and 405 error codes.

Environment

  • Cloud Integration
  • SAP Integration Suite

Reproducing the Issue

When trying to invoke URL of target system, iFlow fails with the following redirection errors:


org.apache.camel.component.ahc.AhcOperationFailedException: HTTP operation failed invoking https:XXXXXXXXXX with statusCode: 302, redirectLocation: https://XXXXXXXXXXXX

After exception handling for sending the request to the redirect path the error is : org.apache.camel.component.ahc.AhcOperationFailedException: HTTP operation failed invoking https://XXXXXXXXXX with statusCode: 405

Cause

The second request failed with 405 error below. The allow header shows the methods supported by the target which are GET or HEAD. HTTP receiver adapter 'Method' is set to POST. 

HTTPResponseHeaders = Allow: GET, HEAD
Cache-Control: no-cache, private
Connection: keep-alive
Content-Length: 1009
Content-Type: text/html; charset=UTF-8
Date: Thu, 07 Mar 2024 07:44:18 GMT
Expires: -1
Pragma: no-cache
Server: nginx/1.22.1
X-Powered-By: PHP/8.1.26
     HTTPStatusCode      = 405
     ModelStepId         = MessageFlow_35
     ResponseBody        = <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="robots" content="noindex,nofollow,noarchive" />
    <title>An Error Occurred: Method Not Allowed</title>

Resolution

There are two options available:

  1. As in this case POST is not supported, change parameter 'Method' in the HTTP receiver adapter 'Connection Details' to either GET or HEAD.
  2. CPI does not support redirect via Http Receiver adapter. You can implement this using groovy script where you can handle the error response from the target system then read the Location header and reconnect to the new URL using the value from the Location header. Refer to blog HTTP redirections in CPI. Please contact the target system service provider and ask them to provide the new URL. One can also get the new URL from the Location headers when the target returns HTTP status 302. 

See Also

Blog: HTTP redirections in CPI

KBA 3315254: Inbound Calls to Cloud Integration Tenant Return a 301 or 302 Response

KBA 3147074 'statusCode: 307, redirectLocation' error in Cloud Integration

SAP Help: HTTP Receiver Adapter

Keywords

"statusCode: 405"; "statusCode: 302"; "org.apache.camel.component.ahc.AhcOperationFailedException: HTTP operation failed invoking"; "redirectLocation"; "405"; "302"; "CPI redirection" , KBA , LOD-HCI-PI-CON-HTP , HTTP Adapter , Problem

Product

SAP SuccessFactors HXM Core 2311