0

MarkLogic version - 9.0-6.2

I have a custom REST end point that accepts phone number as a parameter. My requirement is to read this input phone number from the URL, compare with a phone number in the database and return Match/NoMatch.

When I call the URL through SoapUI tool with phone number value as +1-800-723-1800, I see that soapUI tool is sending the GET request to MarkLogic as &PhoneNo=%2B1-800-723-1800. When I compare (using === in javascript) this value with the value in database, I am getting expected result.

However, when the same call is made through IIB (IBM Integration Bus), I see in MarkLogic logs that the GET request is made as &PhoneNo=+1-800-723-1800 (+ not encoded). Now this comparision result is coming as NoMatch even though I have the exact same value in the database.

Is this as issue with encoding? How can I handle encoding in MarkLogic?

Bhanu
  • 427
  • 2
  • 8

1 Answers1

0

Q: by "This value" and "exact same value in the database", what is that value exactly ?

A: Whatever tool (IIB in this case) is doing an HTTP Request and not encoding a + is either not correct, or it expected that the caller of that tool was responsible for URL encoding. Since URL encoding properly requires that each component of the URL is encoded seperately (not the whole URL itself), commonly libraries that accept full URL's will expect them to be already encoded -- as they cannot correctly encode the full URL itself.

Q: What code is giving the IIB the URL to use ? Likely that code is the code responsible for correctly encoding the URL (where the + should be percent encoded or it will be decoded as a space)

DALDEI
  • 3,722
  • 13
  • 9
  • Thanks for the quick response. The value in the database is +1-800-723-1800. When SoapUI (or any other client) sends request with encoded values (or special characters), does MarkLogic automatically decode upon the receipt of the request? – Bhanu Dec 11 '18 at 04:19