Developing Using HAPI

Downloading HAPI

HAPI can be downloaded at our Sourceforge Download Site.

Note that if you use Maven as your build system, you may alternately wish to use our Maven Repository to add to your POM.

Adding HAPI to your application

Adding HAPI to your application requires one or more HAPI JARs to be added to your application classpath.

HAPI Libraries

hapi-base-1.2.jarThis is the base HAPI library. It contains parsers, transports, validators, etc.
hapi-structures-vXX-1.2.jarEach HL7 version (2.1, 2.2, etc) has a messsage library contained within a structures JAR. If you are constructing messages of that particular version of HL7, you should include the appropriate JAR.

HAPI Dependencies

HAPI also requires the following JARs to function. Newer versions of these JARs *should* also work.

log4j-1.29.jar commons-logging-1.0.4.jarHAPI uses log4j and Commons Logging for logging and will not work without them. Note that our intention is to remove the dependency on log4j at some point, but this is not yet complete.
xercesImpl-2.4.0.jar xmlParserAPIs-2.6.2.jar xalan-2.7.0.jar jaxen-1.0-FCS-2.7.0.jar saxpath-1.0-FCS.jar jdom-1.1.jarThese JARs are used for the various XML operations within HAPI, including generation of XML encoded messages, parsing conformance profiles. If you are not using XML in your application, you may not need them.

Using Maven

If you use Maven to build your application, adding HAPI is as easy as adding the following to your repository section:

            <name>HAPI Sourceforge Repository</name>

And then adding the following to your dependencies section (add the structures versions you need). Note that the example below assumes you are using HAPI release 1.2. Adjust the version accordingly if you are using a different release.

             Add hapi-structures-v22, v23, etc. depending on which versions 
             of HL7 you need to create or parse