search cancel

Encoding issue content-type:text/xml

book

Article ID: 243584

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

When receiving the payload with content-type:text/xml; encoding=UTF-8 I have a conversion issue for special characters.

For example when having a payload like

<?xmlversion="1.0"encoding="UTF-8"?>
<notification>
Fédéric
</notification>
 
With request.mainpart you have
<?xml version="1.0" encoding="UTF-8"?>
<notification>
Fédéric
</notification>

Is there way to have the correct payload in the request.mainpart variable? Fédéric instead of Fédéric

 

Environment

Release : 10.0

Resolution

Please try the below policy:

<?xml version="1.0" encoding="UTF-8"?>
<wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
    <wsp:All wsp:Usage="Required">
        <L7p:SetVariable>
            <L7p:Base64Expression stringValue="PD94bWx2ZXJzaW9uPSIxLjAiZW5jb2Rpbmc9IlVURi04Ij8+DQo8bm90aWZpY2F0aW9uPg0KRnLDqWTDqXJpYw0KPC9ub3RpZmljYXRpb24+"/>
            <L7p:ContentType stringValue="text/xml; charset=utf-8"/>
            <L7p:DataType variableDataType="message"/>
            <L7p:VariableToSet stringValue="msg"/>
        </L7p:SetVariable>
        <L7p:HardcodedResponse>
            <L7p:Base64ResponseBody stringValue="JHttc2cubWFpbnBhcnR9"/>
        </L7p:HardcodedResponse>
    </wsp:All>
</wsp:Policy>