Hi,

I am working with HAPI. I am gettting error while executing  the statement
"Message response = initiator.sendAndReceive(adt);" as "Network Time Out
Error".

The code I used :

int port = 3306; // The port to listen on
    LowerLayerProtocol llp = LowerLayerProtocol.makeLLP(); // The transport
protocol
    PipeParser parser = new PipeParser(); // The message parser
    SimpleServer server = new SimpleServer(port, llp, parser);
    Application handler = new ADTA01_process();
    server.registerApplication("ADT", "A01", handler);
    server.start();
    try{
            System.out.println("GenerateMEssage pid=:"+pid);
            ADTA01 adtobj=new ADTA01();
            String retvalue=adtobj.exportADTA01Message(pid); //String
Message
            Parser p = new GenericParser();
            Message adt = p.parse(retvalue);
               ConnectionHub connectionHub = ConnectionHub.getInstance();
               //  A connection object represents a socket attached to an
HL7 server
               Connection connection = connectionHub.attach("localhost",
port, new PipeParser(), MinLowerLayerProtocol.class);
               // The initiator is used to transmit unsolicited messages
               Initiator initiator = connection.getInitiator();
            Message response = initiator.sendAndReceive(adt);
            System.out.println("response: "+response);
            responseString = parser.encode(response);
            System.out.println("Received response:\n" + responseString);
            connection.close();
           server.stop();
            return responseString;
    }
    catch(Exception e)
    {
        System.out.println("Error generating  message "+e);
        return responseString;
    }




Please help me in finding this issue.

Thanks & Regards

Shrinivas N
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to