Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

how to stop encoding of XML characters in httpparams

sudheera
New Contributor
New Contributor

Hi,

we have to send xmlmessage in httpparams for REST application.

we are getting the xmlmessage in arstasks.comments and sending in httpparams like below.

json:

{
"accountIdPath": "accountName",
"call": [
{
"name": "Access-Role",
"connection": "userAuth",
"url": "https://host/deleteEntitlements",
"httpMethod": "DELETEWITHBODY",
"httpParams":"{\"sso\":\"${user.username}\",\"appName\":\"A 2.0\",\"firstName\":\"${user.firstname}\",\"lastName\":\"${user.lastname}\",\"email\":\"${user.email}\",\"xmlMessage\": \"<Roles>${arsTasks.comments}</Roles>\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-type": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
403,
500
]
}
}
]
}

arsTasks.comments getting form enhanced query execution like below:

<Role><AppRole>TreasuryApprover</AppRole><Site>All</Site></Role><Role><AppRole>Requestor</AppRole><Site>Gas Power HQ non project related TFIs</Site></Role>

but in logs, when calling the webservice saviynt is encoding the xml tags like below, and target API is not accepting the format: < to &lt; and >&gt;

quartzScheduler_Worker-10-qr5gw-DEBUG-Calling Webservice Url - https://qa-aloc.example.com/aloc-services/deleteEntitlements with httpParams - [sso:123456789, appName:ALOC 2.0, TestFirstName, TestLastName:Test012, email:test.email@domain.com, xmlMessage:<Roles>&lt;Role&gt;&lt;AppRole&gt;TreasuryApprover&lt;/AppRole&gt;&lt;Site&gt;All&lt;/Site&gt;&lt;/Role&gt;&lt;Role&gt;&lt;AppRole&gt;Requestor&lt;/AppRole&gt;&lt;Site&gt;Gas Power HQ non project related TFIs&lt;/Site&gt;&lt;/Role&gt;</Roles>]

 

How to stop this special char encoding in xmlmessage when calling webservise?

[This post has been edited by a Moderator to remove sensitive information.]

2 REPLIES 2

NM
Honored Contributor III
Honored Contributor III

@sudheera change content type to text/xml

Instead of below

Content-type": "application/json"


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

rushikeshvartak
All-Star
All-Star

 

{
  "accountIdPath": "accountName",
  "call": [
    {
      "name": "Access-Role",
      "connection": "userAuth",
      "url": "https://host/deleteEntitlements",
      "httpMethod": "DELETEWITHBODY",
      "httpParams": "{\"sso\":\"${user.username}\",\"appName\":\"A 2.0\",\"firstName\":\"${user.firstname}\",\"lastName\":\"${user.lastname}\",\"email\":\"${user.email}\",\"xmlMessage\": \"<Roles>${org.apache.commons.lang.StringEscapeUtils.escapeJava(arsTasks.comments)}</Roles>\"}",
      "httpHeaders": {
        "Authorization": "${access_token}",
        "Content-type": "application/json"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
          200
        ]
      },
      "unsuccessResponses": {
        "statusCode": [
          400,
          403,
          500
        ]
      }
    }
  ]
}

 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.