I got it working by setting the 'metadataUrl' type to 'TC211' in geoserver
e.g. GetCapabilities response looks like this:
<Layer queryable="1" opaque="0">
<OnlineResource xlink:type="simple" xlink:href="https://...
That seems like a pretty clear error message "java.lang.OutOfMemoryError: Java heap space" - you have run out of memory for the JVM heap.
You will need to allocate more memory to the JVM using -Xmx6g or any other amount you care to use. See also the GeoNetWork manual discussion.
You'd need two calls, one to the CSW-T service to create the metadata record and other to store the JSON file in the filestore using the GeoNetwork API:
You can check the parameters here https://vanilla.geocat.net/geonetwork/doc/api/index.html#/records/putResourceFromFile
Using the config UI is the right way of setting the proxy in GeoNetwork. Setting it through JVM command line options also should work. If it isn't working I'd suggest you to open a bug report in GeoNetwork Github describing the problem so the developers can fix it.
Typically you would use the CSW GetRecords operation, which allows to to filter on location, properties, and sorting/paging. You can find numerous examples (for any CSW) from the pycsw tests.
In addition, checkout the sample pycsw viewer for an example application. Be sure to view the HTML source and enable to web console to see client/server ...