Echo message problem

Oct 19, 2010 at 3:59 PM

Sorry if this is a very basic question, but I am having problems with the echo test. I am getting the following error:

Client from 172.31.189.154:35616 is connected
Client: 172.31.189.154:35616
Request: 0001B2000812345678
Parsing header and code of message 0001B2000812345678...
Searching for implementor of B2...
Found implementor ThalesSim.Core.HostCommands.BuildIn.EchoTest_B2, instantiating...
Calling AcceptMessage()...
Exception while processing message
System.OverflowException: Valor demasiado grande o demasiado pequeño para UInt32.
   en System.ParseNumbers.StringToInt(String s, Int32 radix, Int32 flags, Int32* currPos)
   en System.Convert.ToInt32(String value, Int32 fromBase)
   en ThalesSim.Core.HostCommands.BuildIn.EchoTest_B2.AcceptMessage(Message msg)
   en ThalesSim.Core.ThalesMain.WCMessageArrived(WorkerClient sender, Byte[]& b, Int32 len)
Disconnecting client.
Calling Terminate()...
Implementor to Nothing
Client disconnected.

I have modified the length in the file EchoTest_B2.xml to a value of 12 in order to parse the data after B2 (000812345678). If I set to a lower value (11) I do not get the overflow message but the data is not parsed completely.

Any ideas?

 

Oct 19, 2010 at 7:21 PM

This is not a very basic question.

The modification on the EchoTest_B2.xml is not correct because the length is 4 characters, not twelve. The command *should* work as is. I've a number of test cases for it which are successfully passed:

        Assert.AreEqual("00", TestTran("0000", New EchoTest_B2))
        'Correct - With Data
        Assert.AreEqual("000123456789ABCDEF", TestTran("00100123456789ABCDEF", New EchoTest_B2))
        'Length bigger than data
        Assert.AreEqual("80", TestTran("00100123456789", New EchoTest_B2))
        'Length shorter than data
        Assert.AreEqual("15", TestTran("00090123456789ABCDEF", New EchoTest_B2))

The only problem I'm seeing is that extra character that appears at the end of the message. A correct message would be "0001B2000812345678", broken down as header=0001, command code=B2, length=0008, data=12345678. Can you please let me know what that extra character at the end of the message is?

Oct 20, 2010 at 7:55 AM

Thanks for your quick answer.

OK, EchoTest_B2.xml is correct now (4 characters), but the problem still occurs.

That last character is hexadecimal 19, and that is the "end message delimiter". It is part of the response message, with this format:

 

- Message Header: nA Returned to the host unchanged

- Response Code 2A Value B3

- Error Code 2N 00: no errors. 15: error in input data

- Data nB Data field echoed back

- End Message Delimiter 1C Present only if present in the command message. Value X'19

- Message Trailer nA Present only if present in the command mensage. Maximum length 32 characters.

 

That is the output from the simulator now:

 

Client from 172.31.189.154:34992 is connected

Client: 172.31.189.154:34992

Request: 0001B2000812345678

Parsing header and code of message 0001B2000812345678...

Searching for implementor of B2...

Found implementor ThalesSim.Core.HostCommands.BuildIn.EchoTest_B2, instantiating...

Calling AcceptMessage()...

Error condition encountered during message parsing.

Error code 15 will be returned without calling ConstructResponse().

Attaching header/response code to response...

Sending: 0001B315

Calling Terminate()...

Implementor to Nothing

Client disconnected.

 

 

Thanks for your help.

Oct 20, 2010 at 12:10 PM

The simulator does not currently expect end message delimiter and trailers and that is why you're getting the error. The command implementation thinks that more data are present than specified in the length field and that is why it returns 15.

As far as I know, the end message delimiter and trailer are optional and that's why they are currently not supported. As far as I can remember, I have never encountered a real-world client-side implementation that utilizes them. However, if they are important to you I will seriously consider implementing them in the simulator.

Oct 20, 2010 at 12:19 PM

Hello again.

In this case it is a real system talking to the HSM, so here you have the first implementation :-)

If you take into account the implementation I will really appreciate it. That must not be very complicated I think.

Thanks a million.

Oct 20, 2010 at 12:27 PM

Right. Let me see how it goes and I'll post back.

Oct 20, 2010 at 12:32 PM

This is very easy to implement only if I make the assumption that the end delimiter and trailer will be present in every message. Are you happy with that?

Oct 20, 2010 at 1:06 PM

That should be enough.

Thanks for your help.

Oct 20, 2010 at 1:25 PM

Please download the 56190 change set and let me know if it solves the problem. Be sure to set the ExpectTrailers parameter in the configuration file to True.