Layer 7 API Management

Expand all | Collapse all

Character Decode Issue

Jump to Best Answer
  • 1.  Character Decode Issue

    Posted 04-24-2018 05:17 AM

    I'm facing kind of issue where i'm getting JSON request in which  it consist of character encoded character '&', on the gateway while converting this JSON response  to SOAP its further getting encoded to '&' and going to backend, i tried decoding the JSON request but not succeeded yet, could you please  provide any suggestions. i've kept content Type as 'application/json; charset=utf-8'.

     

    Request coming to CA gateway: {"name":"a & b"}

    after transforming from JSON to XML: <name>a &amp;amp; b</name>

     

    I've tried using decode assertion,but it's not making any difference, also i've specified content-type as 'application/json; charset=utf-8'

     

    Any suggestions are aapriciated.

    #specialcharacter Decoding



  • 2.  Re: Character Decode Issue

    Posted 04-25-2018 06:10 AM

    Looks like all transformation  assertions encodes any special characters but they are not checking whether there's already encoded character in request or not, they just encodes the special character at the very first moment it finds, is there any work around for this issue?I'm not sure but shouldn't assertion check first if the character is already encoded or not?



  • 3.  Re: Character Decode Issue
    Best Answer

     
    Posted 04-25-2018 05:34 PM

    I would just use the Evaluate Regular Expression Assertion to find and replace the &amp;amp back into a &.



  • 4.  Re: Character Decode Issue

    Posted 04-27-2018 04:56 AM

    Yes Nathan, for time being i could implement the above solution, but i'm trying to implement a generic solution which could handle all the special characters if any comes in future. anything in mind?I'm preferring use of XSLT as of now.