Hello and thanks for beeing so quick!
I think my problem might be related to what you say at the end,
"connectionHub shared??" I am gonna post a little bit of the code that I
have for the client:
.............................
ConnectionHub connectionHub = ConnectionHub.getInstance();
// A connection object represents a socket attached to an HL7
server
Connection connection = connectionHub.attach(SERVER, PORT,
new PipeParser(), MinLowerLayerProtocol.class);
// The initiator is used to transmit unsolicited messages
Initiator initiator = connection.getInitiator();
System.setProperty("ca.uhn.hl7v2.app.initiator.timeout",
Integer.toString(timeout));
.................................................................
But the server doesn't have any reference made to "connectionHub", should
it? this is the main code for the server:
.........................................
SimpleServer server = new SimpleServer(PORT, llp, parser);
Application handler = new ExampleReceiverApplication();
server.registerApplication("ADT", "A01", handler);
server.start();
.........................................
Thanks again!
VIOT Yves wrote:
>
> Hi Lucas,
> As i said this doesn't seem to be a real timeout. This is a timeout for
> waiting an ACK with a corresponding message ID. The ACK field MSA-2 must
> match this ID you sent in your message into the MSH-10. First of all,
> put a sniffer like "Wireshark". Take a look at messages between client
> and server, compare the two fields ( near sure you'll get an ACK but
> with an unmatching ID or empty).
> Another way is to trace values. Trace the value that the Initiator get
> from your message in line 136 (String messID = t.get("/MSH-10");). This
> is the value that the ACK must return in MSA-2 and put in the recipents
> hashmap with the Connection.reserveResponse(String messageID). Then when
> the ack is incoming the MSA-2 is extracted and checked in the recipients
> hashmap with the Connection.findRecipient(String ackID) method. Check
> values and you have the beginning of your answer (i hope)...
> What's interesting is that you talk about one class... Don't really
> understand what you mean but if you had split your code, probably the
> Connection object is not shared correctly cause of the ConnectionHub.
> Hope it helps....
>
> Yves
>
>
> Lucas Gonz a écrit :
>> Hello!
>> Thanks for the help, but it doesn't work yet. The default timeout is 10
>> seconds no? I think it should be time enough in order to receive an
>> answer,
>> anyway I changed it to 30 as you suggested and it doesn't work neither, I
>> have tried both scenario, running client and server in different PC's and
>> in
>> the same PC, and I got the same behaviour, the server recieves the
>> message
>> but the client timesOut.. :( I am gonna put again the error I get so you
>> can try to guess what is happening...
>>
>> ca.uhn.hl7v2.HL7Exception: Timeout waiting for response to message with
>> control ID 'null
>> at ca.uhn.hl7v2.app.Initiator.sendAndReceive(Initiator.java:148)
>> at cliente.ClienteEnviaMsg.main(ClienteEnviaMsg.java:104)
>>
>> I think the error must be related to the fact of "control ID'null", maybe
>> the server is sending back the ACK but by any reason it looses the ID or
>> something or the client expects a different one and timesOut since the
>> one
>> it receives is not right. What I dont understand is why the example works
>> when I run it all in one class???
>>
>> Thank you again!
>>
>>
>>
>> Torben Greiser wrote:
>>
>>> Hi Lucas,
>>>
>>> just set the initiator timeout value to as high as needed:
>>>
>>> int timeout = 30000;
>>> System.setProperty("ca.uhn.hl7v2.app.initiator.timeout",
>>> Integer.toString(timeout));
>>>
>>> Greets
>>> Torben
>>>
>>> Lucas Gonz schrieb:
>>>
>>>> Hello you all!!
>>>>
>>>> I am starting in this HL7 world.... and after a couples of days I
>>>> almost
>>>> give up, hopefully I found this forum...
>>>>
>>>> I am having problems with "sendAndReceive", If I run the example class
>>>> SendAndReceiveAMessage in my PC everything works fine, but if I split
>>>> the
>>>> code from the example class SendAndReceiveAMessage into two classes,
>>>> one
>>>> for
>>>> the client and another for the server and I run them, the server
>>>> receives
>>>> the message but at the client I get a time out:
>>>>
>>>> ca.uhn.hl7v2.HL7Exception: Timeout waiting for response to message with
>>>> control ID 'null
>>>>
>>>> I touch nothing relevant from the example code, and I am sending the
>>>> same
>>>> message.
>>>> I can't understand why joined into one class it works and separated
>>>> no...
>>>>
>>>> Has anybody any idea??
>>>>
>>>> Thanks in advance!!
>>>>
>>>>
>>>>
>>>> VIOT Yves wrote:
>>>>
>>>>> Hi aj,
>>>>> I had a problem like that one. My problem was not really a time out. I
>>>>> had a timeout for the expected ack. It is because i received an ack
>>>>> with
>>>>> the MSA-2 (Message control ID) empty, so it receive an ack with no
>>>>> corresponding original message. I've noticed that it also return an
>>>>> ack /err for the not well-formed ack check for you will probably have
>>>>> an answer.
>>>>> The ack of the ack looks like , in my case:
>>>>> MSH|^~\&|||||20080109104510.904+0100||ACK|15|T|2.5
>>>>> MSA|AR|20080109104510420|No appropriate destination could be found to
>>>>> which this message could be routed.
>>>>> ERR|^^^207&Application Internal Error&HL70357\x0d
>>>>>
>>>>> Hope it helps...
>>>>> Yves
>>>>>
>>>>> Greetings All,
>>>>> My application was successfully able to connect to the server but it
>>>>> times out and give following error. Any help is appreciated.
>>>>>
>>>>> ca.uhn.hl7v2.HL7Exception: Timeout waiting for response to message
>>>>> with
>>>>> control ID '1339497
>>>>> at ca.uhn.hl7v2.app.Initiator.sendAndReceive(Initiator.java:148)
>>>>>
>>>>>
>>>>> Thanks,
>>>>> aj
>>>>>
>>>>> -------------------------------------------------------------------------
>>>>> Check out the new SourceForge.net Marketplace.
>>>>> It's the best place to buy or sell services for
>>>>> just about anything Open Source.
>>>>> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
>>>>> _______________________________________________
>>>>> Hl7api-devel mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>>>>>
>>>>>
>>>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Hl7api-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>>>
>>>
>>>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
--
View this message in context:
http://www.nabble.com/Re%3A-Timeout-on-sendAndreceive-tp14762009p15131413.html
Sent from the hl7api-devel mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel