Skip to Content
0
Jun 12, 2020 at 05:31 AM

Redirecting URL's Containing /sap/opu/Odata/ to Gateway server via SAP WEB DISPATCHER Not Working

1747 Views Last edit Jun 15, 2020 at 04:17 PM 2 rev

hi Team,

We are currently working on sap ep 7.5 version. We have developed a UI5 app , deployed in sap portal. The UI5 app consumes a Odata URL. We are consuming this Odata URL by making an jquery ajax call shown below in Code 2.

Since we have development server / quality server & production server & corresponding Gateway servers respectively. When the app has to be moved to from Development Portal to Quailty Portal , we have to change the gateway server URL to incorporate the quality gate way server host name and port in the URL.

In Order to avoid changing the Odata URLs to incorporate corresponding host and port, we thought of using relative path of the URL and configure sap web dispatcher , so that web dispatcher redirects the URL to corresponding gateway system. The webdispatcher configuration is shown in Code 1.

Below are modifications done in the action file of webdispatcher.

Code 1. SAP WEBDISPATCHER

#--------REDIRECTURLS------------------------------
RegIRedirectUrl /sap/opu/odata/(.*) http://cvcm****rg01.***corp.***universe.com:8000/
#-----------------------------------------------

But Http request is not modified , we are getting 404 Error because the ajax call using relative url path is pointing to the same server as as shown below.

On making ajax jquery call to the relative path of the odataURL i.e. the call is made to my Development Portal Server , as shown below.

"http://development_portal_server_host:50000/sap/opu/odata/sap/Z**S_SPA_RELEASED_PO_LIST_SRV/PO_LISTSet/?$filter=PLoginid eq 'M19800' and POpt eq 'A'"; 

COMPLETE ODATA URL

http://cvcm****rg01.***corp.***universe.com:8000/sap/opu/odata/sap/Z**S_SPA_RELEASED_PO_LIST_SRV/PO_LISTSet/?$filter=PLoginid eq 'M19800' and POpt eq 'A'

RELATIVE ODATA URL

/sap/opu/odata/sap/Z**S_SPA_RELEASED_PO_LIST_SRV/PO_LISTSet/?$filter=PLoginid eq 'M19800' and POpt eq 'A'

This ajax call leads to 404 Error.

Code 2 : AJAX Call from UI5 Controller

var complete_Url = "http://cvcm****rg01.***corp.***universe.com:8000/sap/opu/odata/sap/Z**S_SPA_RELEASED_PO_LIST_SRV/PO_LISTSet/?$filter=PLoginid eq 'M19800' and POpt eq 'A'";

var relative_url = "/sap/opu/odata/sap/Z**S_SPA_RELEASED_PO_LIST_SRV/PO_LISTSet/?$filter=PLoginid eq 'M19800' and POpt eq 'A'";
var invoiceModel = null;
var l_MatList_input_injsonformat = "";
var aData = jQuery.ajax({
type : "GET",					        
url : relative_url ,	 							        
jsonpCallback : 'getJSON',
data:l_MatList_input_injsonformat,
dataType : "json",
beforeSend:  function(jqXHR, settings) {
},
error: function (xhr, ajaxOptions, thrownError) 
{
console.log(xhr.status);
console.log(xhr.responseText);
},
async: true, 
success : function(data,textStatus, jqXHR) 
{
console.log(data);
var POLISTMODEL = new sap.ui.model.json.JSONModel();
POLISTMODEL.setData(data);
g_var_HomeViewPointer.getView().setModel(POLISTMODEL,"POLISTMODEL");
}
});

Kindly help and do the needful.

Regards

Govardan