Let's assume the decoded string is stored in a variable decoded_string
:
import base64
# Sample Base64 encoded string (this should be your actual SOAP response)
encoded_string = "U29tZSBlbmNvZGVkIGJpbmFyeSBzdHJpbmc="
# Step 1: Decode the Base64 string
decoded_bytes = base64.b64decode(encoded_string)
decoded_string = decoded_bytes.decode('utf-8')
# Step 2: Remove unwanted characters (assuming we need only digits)
cleaned_string = ''.join(filter(str.isdigit, decoded_string))
# Step 3: Convert the cleaned string to an integer
try:
row_count = int(cleaned_string)
print("Row count:", row_count)
except ValueError:
print("Error: The cleaned string cannot be converted to an integer.")
In ADF, the process is similar but might involve using Data Flow or expressions directly in the pipeline. It would be best if you used the base64ToString()
function, the Base64 will decode the response and then clean the string using replace()
and trim()
functions to remove unwanted characters and convert it to integer using int()
.
{
"name": "DecodedRowCount",
"value": "@int(replace(trim(base64ToString(activity('YourActivityName').output.response)), ' ', ''))"
}