For more information on creating an HL7 proxy service, see Creating an HL7 Proxy Service.
Transferring messages from file system to file system
WSO2 ESB supports transferring messages between HL7 and the file system using the HL7 and VFS transports. To begin, ensure that you have the VFS and HL7 transports enabled by uncommenting the relevant transportReceiver and transportSender elements inside the
<ESB_HOME>/repository/conf/axis2/axis2.xml file. You must also uncomment the relevant builder/formatter pair to enable the ESB to work with the HL7 message format. For more information, see HL7 Transport and VFS Transport.
Once you have enabled the transports and started the ESB, use the following proxy service configuration to run the sample.
This sample uses the UNIX temporary directory /tmp/ in several VFS parameters; be sure to change them to match a location in your file system.
Now, copy the following HL7 message into a text editor and save it as an
.hl7 file inside the directory you specified with the
transport.vfs.FileURI parameter (
/tmp/in in the above example).
The proxy service is configured to detect
.hl7 files in the
transport.vfs.FileURI directory. We have also configured the VFS content type as the
application/edi-hl7 MIME type with an optional charset encoding. When you save the
.hl7 file to that directory, the proxy service invokes the HL7 builders/formatters and builds the HL7 message into its equivalent XML format. It then prints the XML representation of the message on the WSO2 ESB console and forwards the message to the VFS endpoint ‘/tmp/out’.
For more information on configuring these transports and general properties you can set, see the following topics:
Transferring messages between HL7 and the file system
Now, let's look at how we can send and receive files between an HL7 service and the file system. For this scenario, we will use the HAPI Test Panel to send messages to WSO2 ESB. As with the previous example, ensure that you have the VFS and HL7 transports and their builders/formatters enabled, and replace the temporary directories shown in the sample with actual directories on your file system.
To invoke this proxy, use the HAPI Test Panel to connect to the HL7 service at the specified port and send a test message. When this proxy service runs, an HL7 service will start listening on the port defined in the
transport.hl7.Port parameter. When the HL7 message arrives, the proxy will send an ACK back to the client as specified in the HL7_RESULT_MODE property. The HL7 message is then processed through the ESB and sent to the VFS endpoint, which will save the HL7 message in ‘/tmp/out’.
Transferring messages between HL7 and FTP
The following configuration is similar to the previous example, but it illustrates how to process files between an HL7 endpoint and files accessed through FTP. To run this sample, first set up an endpoint by starting a new receiver connection in the HAPI Test Panel on port 9988. You then configure this endpoint in the Send mediator as shown in the following proxy service example. The proxy service will detect
.hl7 files in the
transport.vfs.FileURI directory and send them to the HL7 endpoint.
Once you start the endpoint and the ESB, if you place an HL7 message in the
transport.vfs.FileURI directory, you will be able to see the message passed to the HL7 endpoint in the HAPI Test Panel.