Hi Kevin.
We are using the Cloverleaf web services to pass documents (using MTOM), we strip out the document when we receive the message and grab it again when we send the message out.
In HL7, the document could be stripped out of the HL7 field and the field replaced with a unique ID by the receiving application. If this is completed in a TCL module, then the message is a string and there are no field size issues.
When the message is sent out, the last action (pre-write?) could grab it and put it back again.
You may need to add some housekeeping for the file clean-up.
read_file and write_file are useful for this and the uuid module can provide unique ids.