IBM DataPower Operations Dashboard v1.0.21.x

Local WSDL Validation and Promotion User Scripts

The DevOps Services Portal's Validate/Promote Local WSDL actions require two python scripts to run.

The first script analyzes the WSDL and retrieves all the referenced XSD, so DPOD can download them from the DataPower.
The second script analyzes the original WSDL and XSD files retrieved by the first script, and replaces all schema references in the new WSDL/XSD files that were uploaded by the user.
(Later on, DPOD will upload the new files to the DataPower)


You may download and customize the sample scripts from https://bitbucket.org/montier/servicesportalscripts/src
If you wish to develop your own scripts, or customize the sample scripts, please follow the following guidelines.


Run Python -V from ssh to determine the Python version that comes with your DPOD installation.

Folder Structure

Each validate/promote execution receives a unique UUID - you can view the UUID in the DevOps Action Executions Status Page
Before each execution of Local WSDL validation/promotion, DPOD creates a folder that will hold all files for this execution.
The default folder path (basePath) is /app/tmp/servicesportal/wsdl/<uuid>
All execution files and folders older than 7 days will be automatically deleted by DPOD

Analyze Script


General Flow

  1. DPOD will first call the analyze script with the current base WSDL as an input
  2. The script will return all the XSD files referenced by the WSDL.
    If the WSDL doesn't reference any other schema files - the script will signal that no files are required and the flow will end.
  3. DPOD will download the requested XSD files.
  4. DPOD will run the script again to analyze the base WSDL and the downloaded XSD files and determine if more files should be downloaded.
    if more files are required - go to step 3 again.
    Otherwise - the flow ends.

Input

DPOD will pass the following data to the script

under basePath/input.props - input parameters passed from DPOD to the script (see below)
under basePath/original/* - in the first execution - the folder will contain the base WSDL of the service, in subsequent calls - the base WSDL of the service and any other XSD files that the previous script executions requested DPOD to download
under basePath/logs/* - backup of previous runs input.props files and any logs written by previous scripts

The input.props file passed from DPOD contains the following parameters:

call_timestamp - The timestamp when the script was called
calling_user_name - the DPOD user name that requested the validate/promote action
device_name - The service's device name
domain_name - the service's domain name
invoke_type - "UI" or "REST"
iteration - the iteration number - how many times the script was called before, the first iteration is 1.
log_files_path - the path where the script should write its logs if required
original_files_path - the path that contains the original WSDL/XSD files downloaded by DPOD
original_start_wsdl_dp_path - the DataPower's path of the current service WSDL
original_start_wsdl_name - the name that DPOD used to store the file containing the current service WSDL - the name may not be identical to the DataPower name, a number will be appended to it to avoid duplicate file names 
request_uuid - the UUID of the execution
requested_operation - "validate" or "promote"
script_name - the script that was executed
service_name - the service name
total_original_schema_files - how many XSD files were downloaded in previous iterations (0 for the first call)

Example:

call_timestamp=1509552002476
calling_user_name=admin
device_name=idg76_2
domain_name=BankF_Domain
invoke_type=UI
iteration=1
log_files_path=/app/tmp/servicesportal/wsdl/9216E7A6-1408-494C-A580-A7F1A2B7BFEA/logs/
original_files_path=/app/tmp/servicesportal/wsdl/9216E7A6-1408-494C-A580-A7F1A2B7BFEA/original/
original_start_wsdl_dp_path=local:///AddCardToAccount_WHSW.wsdl
original_start_wsdl_name=AddCardToAccount_WHSW.wsdl-1
request_uuid=9216E7A6-1408-494C-A580-A7F1A2B7BFEA
requested_operation=promote
script_name=/app/custom/scripts/Download_wsdl_artifacts.py
service_name=AddCardToAccount_WHSW.WSP
total_original_schema_files=0

Output

DPOD expects the following completion code and output file :

Completion Code
0 - Success, the script terminated sucessfully, all WSDL and XSD files searched and DPOD doesn't need to download any more files
1 - Success, the scripts requests that DPOD will download files from the DataPower and will call it again.
99 - Error occured

Completion File
The script is required to write a file named completion-<iteration>.props to the basePath  (the <iteration> is passed in the input.props file)
The file contents should include:

completion_code - the completion code (0 / 1 / 99) 
error_message  - error message if any, if there is no error message, leave the value empty
source_requesting_file.X - the full DataPower path and name of the file (WSDL or XSD) that included/imported the file to download (multiple entries)
file_to_download.X - the full DataPower path and name of the file (WSDL or XSD) that DPOD needs to download to the basePath/original folder (multiple entries)


Example:

completion_code=1
error_message=
source_requesting_file.0=local:///GPCalendarXML.svc.wsdl-1
file_to_download.0=local:///testService/GPCalendarXML.svc_wsdl0.wsdl
source_requesting_file.1=local:///GPCalendarXML.xsd-1
file_to_download.1=local:///testService/GPCalendarXML.xsd

Replace References Script

General Flow

  1. DPOD will execute the script only once
  2. The script will change the new WSDL/XSD files that were uploaded by the user and replace all the references they contain to other XSD files

Input

under basePath/input.props - input parameters passed from DPOD to the script (see below).
under basePath/original/* - the original service files, downloaded previously by DPOD when executing the analyze script.
under basePath/logs/* - backup of previous runs' input.props files and any logs written by previous scripts.
under basePath/new/* - the new WSDL/XSD files the user uploaded.
under basePath/altered/* - an empty folder where the script should write the result WSDL/XSD files

The input.props file passed from DPOD contains the following parameters:

altered_files_path - where the script should write the final WSDL/XSD files with their references changes
call_timestamp - The timestamp when the script was called
calling_user_name - the DPOD user name that requested the validate/promote action
device_name - The service's device name
domain_name - the service's domain name
invoke_type - "UI" or "REST"
iteration - the iteration number - how many times the user scripts were called before (including the analyze script calls)
log_files_path - the path where the script should write its logs if required
new_files_path - the path where DPOD stored the new WSDL/XSD files that were uploaded by the user
new_schema_file.X.name - the name of the XSD file that was uploaded by the user (multiple entries)
new_start_wsdl_name - the name of the WSDL that was uploaded by the user
original_files_path - the path that contains the original WSDL/XSD files downloaded by DPOD
original_schema_file.X.dp_path - the datapower path of the current service XSD file (multiple entries)
original_schema_file.X.name - the name that DPOD used to store the file containing the current service XSD - the name may not be identical to the datapower name, a number will be appended to it to avoid duplicate file names 
original_start_wsdl_dp_path - the datapower path of the current service WSDL
original_start_wsdl_name - the name that DPOD used to store the file containing the current service WSDL - the name may not be identical to the datapower name, a number will be appended to it to avoid duplicate file names 
request_uuid - the UUID of the execution
requested_operation - "validate" or "promote"
script_name - the script that was executed
service_name - the service name
total_new_schema_files - how many new XSD files were uploaded by the user
total_original_schema_files - how many XSD files were downloaded in previous iterations


Example:

altered_files_path=/app/tmp/servicesportal/wsdl/39D54577-8D82-41BF-B497-81ACC068544C/altered/
call_timestamp=1508850533400
calling_user_name=admin
device_name=idg76_2
domain_name=DMZ
invoke_type=UI
iteration=4
log_files_path=/app/tmp/servicesportal/wsdl/39D54577-8D82-41BF-B497-81ACC068544C/logs/
new_files_path=/app/tmp/servicesportal/wsdl/39D54577-8D82-41BF-B497-81ACC068544C/new/
new_schema_file.0.name=GPCalendarXML.svc_wsdl0.wsdl
new_schema_file.1.name=GPCalendarXML.svc_xsd0.xsd
new_schema_file.2.name=GPCalendarXML.svc_xsd1.xsd
new_schema_file.3.name=GPCalendarXML.svc_xsd2.xsd
new_schema_file.4.name=GPCalendarXML.svc_xsd3.xsd
new_start_wsdl_name=GPCalendarXML.svc.wsdl
original_files_path=/app/tmp/servicesportal/wsdl/39D54577-8D82-41BF-B497-81ACC068544C/original/
original_schema_file.0.dp_path=local:///myService/GPCalendarXML.svc_wsdl0.wsdl
original_schema_file.0.name=GPCalendarXML.svc_wsdl0.wsdl-2
original_schema_file.1.dp_path=local:///myService/GPCalendarXML.svc_xsd0.xsd
original_schema_file.1.name=GPCalendarXML.svc_xsd0.xsd-3
original_schema_file.2.dp_path=local:///myService/GPCalendarXML.svc_xsd1.xsd
original_schema_file.2.name=GPCalendarXML.svc_xsd1.xsd-4
original_schema_file.3.dp_path=local:///myService/GPCalendarXML.svc_xsd2.xsd
original_schema_file.3.name=GPCalendarXML.svc_xsd2.xsd-5
original_schema_file.4.dp_path=local:///myService/GPCalendarXML.svc_xsd3.xsd
original_schema_file.4.name=GPCalendarXML.svc_xsd3.xsd-6
original_start_wsdl_dp_path=local:///myService/GPCalendarXML.svc.wsdl
original_start_wsdl_name=GPCalendarXML.svc.wsdl-1
request_uuid=39D54577-8D82-41BF-B497-81ACC068544C
requested_operation=promote
script_name=/app/custom/scripts/Replace_wsdl_references.py
service_name=assaflocal
total_new_schema_files=5
total_original_schema_files=5

Output

DPOD expects the following completion code and output file :

Completion Code
0 - Success, the script terminated succesfully, and wrote the altered files to the basePath/altered folder
99 - Error occured

Completion File
The script is required to create a file named completion-<iteration>.props to the basePath  (the <iteration> is passed in the input.props file)
The file contents should include:

completion_code - the completion code (0  / 99) 
error_message  - error message if any, if there is no error message, leave the value empty
altered_wsdl_file.name - the local file name of the altered WSDL file
altered_wsdl_file.dp_path - the path+file name on the DataPower, DPOD will upload the file to this destination and will create any required directories.
altered_schema_file.X.name - the local file name of the altered XSD file (multiple entries)
altered_schema_file.X.dp_path - the path+file name on the DataPower, DPOD will upload the file to this destination and create any required directories. (multiple entries)


Example:

completion_code=0
error_message=
altered_wsdl_file.name=testWSDL.wsdl
altered_wsdl_file.dp_path=local:///817_testWSDL.wsdl
altered_schema_file.0.name=Service.asmx.xsd1.xsd
altered_schema_file.0.dp_path=local:///266_Service.asmx.xsd1.xsd

Copyright © 2015 MonTier Software (2015) Ltd.