You can easily develop your own custom function. Here's an example of a custom function which checks that the number is valid.

/// Functions to use in rule definitions.
Class Custom.Functions Extends Ens.Rule.FunctionSet
{

/// Returns 1 if a string is a number, 0 otherwise
ClassMethod IsValidNumber(string As %String) As %Boolean [ CodeMode = expression, Final ]
{
$ISVALIDNUM(string)
}

}

Looks like there's a character stream somewhere. You should always use binary streams to upload binary data such as images, PDFs and so on.

First of all you need to understand where the problem is: on sending or on receiving.

To do that upload PDF using your BO and download it from AWS website manually (using your browser). If you can open downloaded file, then it means that your upload code is correct and the problem is with download code. If you can't open the file it means that you need to check upload code.

Redefine HTTP adapter like this:

Class Production.Adapter.HTTPOutboundAdapter Extends EnsLib.HTTP.OutboundAdapter
{

Method PostURL(pURL As %String, Output pHttpResponse As %Net.HttpResponse, pFormVarNames As %String, pData...) As %Status [ CodeMode = expression ]
{
..SendFormDataArray(.pHttpResponse, "POST", ..GetRequest(), .pFormVarNames, .pData, pURL)
}

ClassMethod GetRequest() As %Net.HttpRequest
{
    set request = ##class(%Net.HttpRequest).%New()
    set request.ContentType  =  "application/pdf"
    quit request
}

}

And use it instead of default adapter.

For better performance it would be better to reuse the request.

Alternatively, you can call SendFormDataArray adapter method directly and it accepts request object.

Please share the code from

%0AmBx1^%sqlcq.PRD.2249

To do that open %sqlcq.PRD.2249  routine (int routine, afaik mac routine wouldn't have this )

If you can't find routines check that system saves sources for cached queries. If it doesn't set the setting to save routines, purge this query and run it again. After that you should be able to see the source.

Also can you determine which part of SQL causes this error?