ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Jaspersoft REST API calls called through GEL fail after the maintenance for Clarity SaaS in GCP in October 2021

book

Article ID: 227514

calendar_today

Updated On:

Products

Clarity PPM SaaS

Issue/Introduction

You have a process that makes REST calls to Jaspersoft.   For example:

 <!-- CREATE BASIC AUTH STRING -->
 <core:invokeStatic className="com.niku.union.utility.Base64" method="encode" var="base64">
  <core:arg type="java.lang.String" value="${username}|${org_id}:${password}"/>
 </core:invokeStatic>
 <core:set value="Basic ${base64}" var="basicAuth"/>
 <gel:log level="INFO">Basic Auth String: ${basicAuth}</gel:log>

 <!-- CREATE LOGIN URL -->
 <core:set encode="false" escapeText="false" var="js_path"><![CDATA[${report_server_url}/reportservice/rest/login?j_username=${username}%7C${org_id}&j_password=${password}]]></core:set>
 
 <gel:log level="INFO">js url: ${js_path}</gel:log>

 <!-- CATCH AUTHENTICATION ERROR -->
 <core:catch var="err">
  <!-- SET URL -->
  <core:new className="java.net.URL" var="url">
   <core:arg type="java.lang.String" value="${js_path}"/>
  </core:new>
  <!-- OPEN CONNECTION / MAKE POST CALL / PARSE COOKIES TO GET JSESSIONID -->
  <core:set value="${url.openConnection()}" var="conn"/>
  <core:expr value="${conn.setRequestMethod('POST')}"/>
  <!--core:expr value="${conn.setRequestProperty('Content-type', 'application/x-www-form-urlencoded')}"/-->
  <core:expr value="${conn.setRequestProperty('Content-length','0')}"/>
  <core:expr value="${conn.setRequestProperty('Content-type', 'application/JSON')}"/>
  <!--Respone code is the connection response-->
  <core:set value="${conn.getResponseCode()}" var="response"/>
  <core:set value="${conn.getResponseMessage()}" var="resp_msg"/>
 </core:catch>

 <core:if test="${response != 200}">
       <gel:log>Print HTTP Response message::${response}:${resp_msg}</gel:log>
    
 </core:if>
 <core:if test="${response == 200}">

 

 

....

 

When run in a Process in Clarity, the error returned is: 411 Length Required

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/411

Cause

In October 2021, Broadcom updated the technology stack we use on the Google Cloud Platform.

A new GCP Load Balancer / Firewall went into effect which blocks POST calls with an empty message body.

Environment

Release : 15.9.3

Component : CLARITY BUSINESS PROCESS MANAGEMENT

Resolution

Avoid using POST REST calls with empty message bodies.  GCP will block these.

Instead, use a GET when the message body is empty.

<!-- OPEN CONNECTION / MAKE GET CALL / PARSE COOKIES TO GET JSESSIONID -->
  <core:set value="${url.openConnection()}" var="conn"/>
  <core:expr value="${conn.setRequestMethod('GET')}"/>