Hi Christian,
Thank you for your ideas - lots for me to consider.
increase the memory that’s assigned to the JVM.
I’ve currently assigned it 4GB and the file that’s failing is 350MB so I don’t think that’s going to be an easy fix.
You could try to interpret the incoming POST data with XQuery, but then you might also struggle with memory constraints.
What’s puzzling me is that the ‘upload’ part works - the data gets added to the variables and the RESTXQ function is called.
The following does NOT cause a memory issue:
declare %rest:POST("{$data}") %rest:path("/test2.htm”) %rest:form-param("zip", "{$files}") function _:test($data,$files) { file:write-binary(“the path”,$data) };
But the file I get isn’t valid.
The following DOES cause the issue with larger files:
declare %rest:POST("{$data}") %rest:path("/test2.htm”) %rest:form-param("zip", "{$files}") function _:test($data,$files) { file:write-binary(“the path”,$files(map:keys($files)[1])) };
But the file I get is valid.
Perhaps the issue isn’t anything to do with RESTXQ and is a limitation on the size of xs:base64Binary from a map that can be written to a file?
You could try to interpret the incoming POST data with XQuery
I was trying to read the source code to understand what processes happen to convert the POST data to a map.
I don’t understand what format or encoding the $data variable has that makes the file different to the one I get from $files.
Because if I can get $data -> run decoding -> save to file that would work perfectly for me.
I shall keep looking but any pointers in the right direction are much appreciated.
Thank you for your continued help.
Regards, James