Hi all,

i'm just new to HL7 development and try to implement my own HL7Server.
I'm using the HL7Server class for receiving messages.
Now i ran into a problem. After starting the server, i send a message via the 
example client or 7Edit.
After the server receives the message and sending an ACK the server gets into a 
cycle and i don't know why.
Just found out, that directly opening a new connection instead adding a 
connection to ConnectionHub avoids this, but i still can't send messages via 
7Edit.

I hope you guys know why this happens and how to avoid it.

Things i've tested:
- SimpleServer works, HL7Server doesn't
- Different messages/versions, same problem
- Not using ConnectionHub works
- 7Edit doesn't work with HL7Server (SimpleServer works)
- Doesn't work with different or none ReceivingApplications

Thanks in advance,
Valentin

The debug output of the cycle:
DEBUG [Thread-5] (HapiLogImpl.java:33) - In cycle()
INFO [Thread-5] (HapiLogImpl.java:78) - End of input stream reached.
DEBUG [Thread-4] (HapiLogImpl.java:33) -  Locally driven  
TransportLayer.receive() returned null.
INFO [Thread-5] (HapiLogImpl.java:78) - Received: null
DEBUG [Thread-5] (HapiLogImpl.java:33) - Received no message
DEBUG [Thread-5] (HapiLogImpl.java:33) - Remotely driven 
TransportLayer.receive() returned null.
DEBUG [Thread-4] (HapiLogImpl.java:33) - Exiting cycle()
DEBUG [Thread-4] (HapiLogImpl.java:33) - In cycle()
INFO [Thread-4] (HapiLogImpl.java:78) - End of input stream reached.
INFO [Thread-4] (HapiLogImpl.java:78) - Received: null
DEBUG [Thread-4] (HapiLogImpl.java:33) - Received no message
DEBUG [Thread-4] (HapiLogImpl.java:33) -  Locally driven  
TransportLayer.receive() returned null.
DEBUG [Thread-5] (HapiLogImpl.java:33) - Exiting cycle()

This is how i start my server:

public boolean startServer(int port, String version) {
            try {
                  ServerSocket serverSocket = new ServerSocket(port);
                  ApplicationRouter appRouter = new ApplicationRouterImpl();
                  SafeStorage safeStorage = new NullSafeStorage();

                  ReceivingApplication ra_adta02_22 = new ADT_A02_22();
                  AppRoutingData rd_adta02_22 = new AppRoutingDataImpl("ADT",
                             "A02", "P", "2.2");
                  appRouter.bindApplication(rd_adta02_22, ra_adta02_22);

                  ReceivingApplication ra_adta02_24 = new ADT_A02_24();
                  AppRoutingData rd_adta02_24 = new AppRoutingDataImpl("ADT",
                             "A02", "P", "2.4");
                  appRouter.bindApplication(rd_adta02_24, ra_adta02_24);

                  ReceivingApplication ra_adta01_24 = new PIDHandler24();
                  AppRoutingData rd_adta01_24 = new AppRoutingDataImpl("ADT",
                             "A01", "P", "2.4");
                  appRouter.bindApplication(rd_adta01_24, ra_adta01_24);

                  hl7server = new HL7Server(serverSocket, appRouter,
                             safeStorage);
                  hl7server.start("127.0.0.1");
            } catch (IOException e1) {
                  e1.printStackTrace();
            }
            return true;
      }


This is my Client:

      public static void main(String args[]) throws Exception {
            String msg = 
"MSH|^~\\&|HIS|RIH|EKG|EKG|199904140038||ADT^A01|12345|P|2.2\r"
                          + 
"PID|0001|00009874|00001122|A00977|SMITH^JOHN^M|MOM|19581119|F|NOTREAL^LINDA^M|C|564
 SPRING 
ST^^NEEDHAM^MA^02494^US|0002|(818)565-1551|(425)828-3344|E|S|C|0000444444|252-00-4414||||SA|||SA||||NONE|V1|0001|I|D.ER^50A^M110^01|ER|P00055|11B^M011^02|070615^BATMAN^GEORGE^L|555888^NOTREAL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^NOTREAL^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|199904101200||||5555112333|||666097^NOTREAL^MANNY^P\r"
                          + "NK1|0222555|NOTREAL^JAMES^R|FA|STREET^OTHER 
STREET^CITY^ST^55566|(222)111-3333|(888)999-0000|||||||ORGANIZATION\r"
                          + 
"PV1|0001|I|D.ER^1F^M950^01|ER|P000998|11B^M011^02|070615^BATMAN^GEORGE^L|555888^OKNEL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^VOICE^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|||||5555112333|||666097^DNOTREAL^MANNY^P\r"
                          + "PV2|||0112^TESTING|55555^PATIENT IS 
NORMAL|NONE|||19990225|19990226|1|1|TESTING|555888^NOTREAL^BOB^K^DR^MD||||||||||PROD^003^099|02|ER||NONE|19990225|19990223|19990316|NONE\r"
                          + "AL1||SEV|001^POLLEN\r"
                          + "GT1||0222PL|NOTREAL^BOB^B||STREET^OTHER 
STREET^CITY^ST^77787|(444)999-3333|(222)777-5555||||MO|111-33-5555||||NOTREAL 
GILL N|STREET^OTHER STREET^CITY^ST^99999|(111)222-3333\r"
                          + "IN1||022254P|4558PD|BLUE CROSS|STREET^OTHER 
STREET^CITY^ST^00990||(333)333-6666||221K|LENIX|||19980515|19990515|||PATIENT01 
TEST D||||||||||||||||||02LL|022LP554";

            Parser p = new GenericParser();
            Message adt = p.parse(msg);
            ConnectionHub connectionHub = ConnectionHub.getInstance();

            // A connection object represents a socket attached to an HL7 server
//          Connection connection = connectionHub.attach("localhost", 31337,
//                      new PipeParser(), MinLowerLayerProtocol.class);

            Connection testcon = new Connection(new PipeParser(), 
LowerLayerProtocol.makeLLP(), new Socket("127.0.0.1", 31337));
            // The initiator is used to transmit unsolicited messages
            Initiator initiator = testcon.getInitiator();
            Message response = initiator.sendAndReceive(adt);
            PipeParser parser = new PipeParser();
            String responseString = parser.encode(response);
            System.out.println("Received response:\n" + responseString);

//          connectionHub.discard(connection);
      }
}
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to