Re...
I don't exactly thinking of a split between client and server 'cause it
is a "normal" situation. No reference to ConnectionHub should be found
in the server. I was thinking about a splitting in the client between
sending and receiving. Could you post the message and what Wireshark or
other sniffer gave you (don't forget to wait the timeout error before
stopping the sniffer) or the two values for the method's parameter
(message ID) for
/Connection.reserveResponse(String messageID)/
and
/Connection.findRecipient(String ackID)/
If you have problems with getting what is received by your server and what is
sent from it (ACK), modify the method
public Message processMessage(Message in) throws ApplicationException
by adding this at the beginning
/String encodedMessage = new PipeParser().encode(theIn);
System.out.println(Level.DEBUG, "Receiving message:\n" +
encodedMessage.substring(0,encodedMessage.length() - 1) + "");
/and adding this before the return
/String strAck = new PipeParser().encode(out);
///System.out.println/(Level.DEBUG, "Sending response:\n" + strAck.substring(0,
strAck.length() - 1)+ "");
/And the post the two tracelogs/
/Bye
Yves
Lucas Gonz a écrit :
> 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
>>
>>
>>
>
>
--
Yves VIOT
C.S.I.S.
130 rue Eugene POTTIER
35200 RENNES
Mail :[EMAIL PROTECTED]
T(Direct) :0952-170-963 (non surtaxé)
T(Siège) :02-23-35-43-55
F(Siège) :02-23-35-43-56
________________
CONFIDENTIALITE : Ce message et les éventuelles pièces attachées sont
confidentiels. Si vous n'êtes pas dans la liste des destinataires, veuillez
informer l'expéditeur immédiatement et ne pas divulguer le contenu à une tierce
personne, ne pas l'utiliser pour quelque raison que ce soit, ne pas stocker ou
copier l'information qu'il contient sur un quelconque support.
-------------------------------------------------------------------------
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