Early in the writeup "HL7 Processor Demonstration - GlassFish ESB v2.1", at http://blogs.sun.com/javacapsfieldtech/entry/hl7_processor_demonstration_glassfish_esb, a HL7 Sender and a HL7 Receiver are constructed and exercise. While they do the exact opposite to what you say you need to do you should be able to work out how to reverse the roles. Later in the writeup a HL7 BC->BPEL->... solution is developed. It receives the HL7 v2 Delimited messages and transforms them for a custom XML-based format. This should give you enough to start with.