Weird character from request

Hello!

I have this issue when the request I am extracting contains a weird character like this below:

            <person>
                <id>213989-1267HAGH1</id>
                <email>test.123@newtype.au</email>
                <mobile>0029291123</mobile>
            </person>

I have a Message Validation policy before the variable extraction step, but the request still gets processed even if it contains unexpected characters.

I'm extracting all the objects within the "person" field. Is there a way to clean the data and remove these strange characters before it's sent to the backend for processing?



Thanks!

Solved Solved
2 3 92
1 ACCEPTED SOLUTION

&#x0002; is "Start of Text" .  It looks misplaced in that data field.  That seems like it would be due to a problem on the client side. rather than just configuring apigee to "remove" characters that look odd, it may be better to 

  • pass it through. It's not "illegal", it's just unusual.
  • reject it. Tell the client "your data looks invalid".  

I would be uncomfortable building API Proxies in Apigee that just modify data in payloads, for aesthetic reasons, without understanding why that data is the way it is.  

My advice is; Talk to the devs of the client app.

View solution in original post

3 REPLIES 3

What's weird about the XML?  I don't see any strange characters.

XML often is encoded with UTF-8, which means it can contain any unicode character. Is that what you mean by "weird"?  It's not illegal.

You mentioned messagevalidation, but you didn't provide details.  Are you using an XSD?  a WSDL?  something else?  Why do you expect the validation step to fail? 

Hello @dchiesa1

Thanks for checking! After further investigation, we've identified this character causing the issue:

 

            <person>
                <id>213989&#x0002;-1267HAGH1</id>
                <email>test.123@newtype.au</email>
                <mobile>0029291123</mobile>
            </person>

 

The &#x0002; character appears in the id element. This character isn't expected and might be causing the XSD validation to fail.

We're unsure how the client is sending the request, but ideally, we'd like to remove this character before sending it to the backend for processing.

&#x0002; is "Start of Text" .  It looks misplaced in that data field.  That seems like it would be due to a problem on the client side. rather than just configuring apigee to "remove" characters that look odd, it may be better to 

  • pass it through. It's not "illegal", it's just unusual.
  • reject it. Tell the client "your data looks invalid".  

I would be uncomfortable building API Proxies in Apigee that just modify data in payloads, for aesthetic reasons, without understanding why that data is the way it is.  

My advice is; Talk to the devs of the client app.