Interaction call returning 0 propositions when maxCount attribute is set to 0008 or more then that in the SOAP payload

Description

Interaction call payload:

soapenv:Envelope xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:urn=“urn:nms:interaction”
soapenv:Header/
soapenv:Body
urn:Propose
urn:sessiontoken/
!–Recipient Id
urn:targetIdrandom/urn:targetId–
!-Account Id-
urn:targetIdrandom/urn:targetId
!–Contact Id
urn:targetIdrandom/urn:targetId–
urn:maxCount00008/urn:maxCount
urn:uuid/
urn:nlid/
urn:noProp/
urn:categories/urn:categories
urn:themes/
urn:context
!-You may enter ANY elements at this point-
context
interaction onCallOfferFlg=“Y” orgName=“to be filled”/
/context
/urn:context
/urn:Propose
/soapenv:Body
/soapenv:Envelope

Endpoint:
https://Server URL/interaction/liveRcp/offer

In the above payload, the urn:maxCount00008/urn:maxCount tag takes numeric value. If we use a trailing 0, it works fine till 0007 eg. (0000,0001,0002…0007)

But if we use 0008 and above, it returns 0 propositions.

Resolution

On checking the Interaction.js library, we see that the parseInt() function is used to parse the maxCount value to Integer. This parseInt() function returns a decimal value by default.

*var iAskedPropositionCount = parseInt(soapMethod.::maxCount.toString());<b>

On doing some research, I found that this JS function inherits a property from C and C++ that if you pass a value in parseInt() which starts with 0, it uses base 8 to return the value. Since base 8 does not accept numeral greater than 7, when we pass 0008 or more, it converts it into 0 or NaN hence no proposition is returned.

if in maxCount, we pass 8 instead of 0008, we get proposition in the response to the SOAP call.

If we modify the interaction.js library and use:

*var iAskedPropositionCount = parseInt(soapMethod.::maxCount.toString(),10);</b>

it works for all numbers.

On this page