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?

4

1 回答 1

0

问:通过“这个值”和“数据库中的完全相同的值”,那个值到底是什么?

答:无论工具(在本例中为 IIB)正在执行 HTTP 请求并且未对 + 进行编码,要么不正确,要么期望该工具的调用者负责 URL 编码。由于正确的 URL 编码要求 URL 的每个组件都单独编码(而不是整个 URL 本身),通常接受完整 URL 的库会期望它们已经编码——因为它们不能正确编码完整的 URL 本身。

问:什么代码为 IIB 提供了要使用的 URL?很可能该代码是负责正确编码 URL 的代码(其中 + 应该是百分比编码,否则它将被解码为空格)

于 2018-12-11T03:54:04.803 回答