Technical Articles
SAP Web Dispatcher and wildcard (asterisk)
Hello colleagues.
You may face with a task when you need to add all particular url prefixes to SAP WD profile (wdisp with SRCURL parameter).
SAP documentation describes SRCURL like “SRCURL=/sap/;/myapp/ means: Requests whose URL starts with “/sap/” or “/myapp/” are forwarded to this system.” and doesn’t give information about possibility to use wildcard (asterisk).
First of all you need to catch all url prefixes. The log files (access_0_log-<date>) contain information about all url prefixes which are used via SAP WD. The powershell script below will help you to find all GET request and write it to a separate file. After that you may delete identical rows via Notepad++ (Edit -> Line Operations -> Remove Duplicate Lines) and find unique url prefixes.
Powershell script:
# - START - Param
$location = "C:\Users\zaytsev.ayu\Desktop\wd\Log\"; #folder with logs
$name_result_file = "!result_get_70_file.txt"; # name of folder
$result_file = $location + $name_result_file; # saving point
# - END - Param
$array_dir_name = Get-ChildItem -Path $location -Force -ErrorAction SilentlyContinue | Select-Object Name;
$n = 0; #starting point
Write-Output ($array_dir_name.Count); #count of files in $location
while ($n -lt $array_dir_name.Count)
{
$current_file = $location + $($array_dir_name[$n].Name);
Write-Output ($current_file);
if( Test-Path -Path $current_file -PathType Leaf -ErrorAction SilentlyContinue ) {
$lines = Get-Content $current_file;
foreach ( $line in $lines ) {
if ( $line -match "GET (?<content>.*) HTTP/1.1" ) { #regular expression for matching needed content from row
#Write-Output ($matches['content']);
Add-Content -Path $result_file -Value $matches['content'];
}
}
}
$n++;
#if ($n -eq 100) {
# break; #stopping point
#}
}
For example:
Found url prefixes | Possible final mask for SRCURL |
/com.sap.portal.ivs.iviewservice/ /com.sap.portal.layouts.framework/ /com.sap.portal.navigation.afp.dtn/ /com.sap.portal.navigation.afp.dynamicnavigation/ /com.sap.portal.navigation.afp.layout/ /com.sap.portal.navigation.afp.masthead/ |
/com.sap.portal* |
And as result you can add the final mask (url prefix) to SAP WD profile file:
wdisp/system_1 = SID=<SID>, MSHOST=<FQDN Message service (MS)>, MSPORT=<port of MS>, SRCURL=/com.sap.portal;/irj/
It means that “/<url_prefix>;” works like “/<url_prefix>*;“