@Test public void testSendMessageSimpleXml() throws Exception { String message = // - "MSH|^~\\&|||||200803051508||ADT^A31|2|P|2.5\r" + // - "EVN||200803051509\r" + // - "PID|||ZZZZZZ83M64Z148R^^^SSN^SSN^^20070103\r"; // - message = new DefaultXMLParser().encode(PipeParser.getInstanceWithNoValidation().parse(message)); HohRawClientSimple client = new HohRawClientSimple("localhost", myPort, "/theUri"); client.setAuthorizationCallback(new SingleCredentialClientCallback("hello", "hapiworld")); IReceivable<String> response = client.sendAndReceive(new RawSendable(message)); ourLog.info("Received response"); assertEquals(message, myServerSocketThread.getMessage()); String responseMessage = response.getMessage(); assertTrue(responseMessage, responseMessage.contains("<MSH>")); assertEquals(myServerSocketThread.getReply().encode(), responseMessage); assertEquals(EncodingStyle.XML.getContentType(), myServerSocketThread.getContentType()); assertEquals(EncodingStyle.XML, myServerSocketThread.getEncoding()); }
public static void main(String[] args) throws HL7Exception, JAXBException { String msg = "MSH|^~\\&|1.3.6.1.4.1.12201^1.3.6.1.4.1.12201.101.1|UHN^1.3.6.1.4.1.12201|ConnectingGTA|ConnectingGTA|20130225000100-0500|2954864636aaa|ADT^A11^ADT_A09|142981|T|2.5|||NE|AL|CAN|8859/1|||CGTA_CDR_INPUT_2_0\r" + "EVN||201302250001\r" + "PID|1||7013623^^^1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.101.1^MR~HN3651^^^1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.101.1^PI||Test^Alexfive^^^^^L||19700105|M|||21 jump street^^NORTH YORK^CANON^M3A 1Y8^Can^H||(416)444-4444^PRN^PH^^1^416^4444444||eng^English^HL70296|||||||||||||||N\r" + "PV1|1|I|^^^1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.100.1|R||^^^1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.100.1||1185^Abrams^Howard^^^Dr.^MD^^1.3.6.1.4.1.12201.1.2.1.5&1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.101.1||General Internal Medicine||||||N|13546^Generic^Physician^Moe^^Dr.^MD^^1.3.6.1.4.1.12201.1.2.1.5&1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.101.1||11210000302^^^1.3.6.1.4.1.12201&1.3.6.1.4.1.12201.101.1^VN|||||||||||||||||||||||||20120628105900-0400\r" + "PV2|||^test"; Message parsed = PipeParser.getInstanceWithNoValidation().parse(msg); CgtaHohServlet s = new CgtaHohServlet(); MyApplication application = s.new MyApplication(); application.processMessage(parsed, new HashMap<String, Object>()); }