Add Client with import xml file by command

Hi everyone, I am having problem in adding client by importing xml metadata file.
Here is the shellscript code:

REAML_NAME=“myrealm”
KEYCLOAK_URL=“http://localhost:8080
ADMIN_USERNAME=“admin”
ADMIN_PASSWORD=“password”

no.1 get access token and build header Authorization bearer

TOKEN_URL=“${KEYCLOAK_URL}/realms/master/protocol/openid-connect/token”
AUTH=“Authorization: bearer $(curl -k -d client_id=admin-cli -d username=${ADMIN_USERNAME} -d password=${ADMIN_PASSWORD} -d grant_type=password ${TOKEN_URL} | sed -n 's| .“access_token”:“([^”])”.*|\1|p’)"

no.2 converter metadata xml to json

CONVERTER_URL=“${KEYCLOAK_URL}/admin/realms/${REAML_NAME}/client-description-converter”
SAML_XML=$(cat /tmp/sp.xml)
CLIENT_JSON=$(curl -k -vX POST ${CONVERTER_URL} -H “${AUTH}” -H “Content-Type: application/json” -d “${SAML_XML}”)

no.3 add client with json of no.2

CLIENTS_URL=“${KEYCLOAK_URL}/admin/realms/${REAML_NAME}/clients”
curl -X POST -H “${AUTH}” -H “Content-Type: application/json” ${CLIENTS_URL} -d ${CLIENT_JSON}

Step no.2 converter encountered an error:
400 Bad Request

{“error”:“Unsupported format”}

If in step no.2, enter the contents of the metadata xml file directly into the curl command as shown below:

CLIENT_JSON=$(curl -k -vX POST ${CONVERTER_URL} -H “${AUTH}” -H “Content-Type: application/json” -d ‘<?xml version="1.0" encoding="utf-8 "?>…’)

Then get the success result of CLIENT_JSON as below:

{“clientId”:“urn:federation:MicrosoftOnline”,“redirectUris”:[“https://login.microsoftonline.com/login.srf","https://login.microsoftonline.com/login.srf”] ,“protocol”:“saml”,“attributes”:{“saml.assertion.signature”:“true”,“saml.signing.certificate”:“…”,“saml.signature.algorithm”:"RSA_SHA256 ",“saml_single_logout_service_url_post”:“https://login.microsoftonline.com/login.srf",“saml.client.signature”:“true”,“saml.authnstatement”:“true”,“saml_assertion_consumer_url_post”:"https ://login.microsoftonline.com/login.srf”,“saml_name_id_format”:“email”,“saml.server.signature”:“true”,“saml.server.signature.keyinfo.ext”:“false”} ,“fullScopeAllowed”:true,“protocolMappers”:}

The problem here is the requirement to use the metadata xml file to add clients.
Thanks for your help!


UPDATE:
I have investigated that the cause is invalid format of the xml file, just the correct xml format will convert successfully.
Thank you so much!