private Connection getConnection(String targetEPR, ConnectionHub hub) throws AxisFault {
try {
URI url = new URI(targetEPR);
String targetHost = url.getHost();
int targetPort = url.getPort();
return hub.attach(targetHost, targetPort, new PipeParser(),
MinLowerLayerProtocol.class);
} catch (URISyntaxException e) {
handleException("Malformed HL7 URI syntax: " + targetEPR, e);
} catch (HL7Exception e) {
handleException("Error while obtaining HL7 connection to: " + targetEPR, e);