Issue with Base64String longer than 65535 in a server module
Posted: Wed Feb 12, 2025 11:14 pm
We have a server module ( JSON restful call ) to accept shipment data which includes PDF packing slip encoded in Base64String. We have no issues with PDFs which are less than 64Kb but where PDFs are greater than 64Kb, the statement high-lighted in bold/red fails:
We have verified that #iOperationRequest.ContentJsonIn.PackingSlip contains the complete base64 string data and not truncated in anyway.
How do we handle this situation? Thanks in advance.
===========================================================================================
Define_Com Class(#XPRIM_Binary) Name(#HashBytes)
#ToDocumentPath := '/SOP/'
#ToDocumentPath := #ToDocumentPath.Trim + #TBINVP + #SHIPMENTID.AsDisplayString( NumString_L ) + '.PDF' +#iOperationRequest.ContentJsonIn.PackingSlipFormat
#ToDocumentPathSave_PackingSlip := #ToDocumentPath.Trim
#HashBytes.FromBase64String String(#iOperationRequest.ContentJsonIn.PackingSlip) ErrorInfo(#ErrorInfo)
* Log Errors if can not convert from base64 string
If (*Not #ErrorInfo.OK)
#MESSAGE := " Error - Step 1 - Unable to convert from base64 string"
Return
Endif
#HashBytes.AsFile Path(#ToDocumentPath.Trim) ErrorInfo(#ErrorInfo)
* Log Errors if can not access the To directory
If (*Not #ErrorInfo.OK)
#MESSAGE := " Error - Step 2 - Unable to generate Packing Slip in SOP folder"
Return
Endif
=========================================================================================
API Definition :
We have verified that #iOperationRequest.ContentJsonIn.PackingSlip contains the complete base64 string data and not truncated in anyway.
How do we handle this situation? Thanks in advance.
===========================================================================================
Define_Com Class(#XPRIM_Binary) Name(#HashBytes)
#ToDocumentPath := '/SOP/'
#ToDocumentPath := #ToDocumentPath.Trim + #TBINVP + #SHIPMENTID.AsDisplayString( NumString_L ) + '.PDF' +#iOperationRequest.ContentJsonIn.PackingSlipFormat
#ToDocumentPathSave_PackingSlip := #ToDocumentPath.Trim
#HashBytes.FromBase64String String(#iOperationRequest.ContentJsonIn.PackingSlip) ErrorInfo(#ErrorInfo)
* Log Errors if can not convert from base64 string
If (*Not #ErrorInfo.OK)
#MESSAGE := " Error - Step 1 - Unable to convert from base64 string"
Return
Endif
#HashBytes.AsFile Path(#ToDocumentPath.Trim) ErrorInfo(#ErrorInfo)
* Log Errors if can not access the To directory
If (*Not #ErrorInfo.OK)
#MESSAGE := " Error - Step 2 - Unable to generate Packing Slip in SOP folder"
Return
Endif
=========================================================================================
API Definition :