throws EnvelopeMarshallerException, JMSException
{
String status = msg.getStringProperty("status");
if (status == null)
{
throw new EnvelopeMarshallerException("'status' property not found in reply");
}
if (!(msg instanceof TextMessage))
{
throw new EnvelopeMarshallerException("JMS message is not a TextMessage");
}
RplyEnvelope rplyEnvelope;
if (status.equals(EnvelopeConstants.V_OK))
{
String xmlRply = ((TextMessage)msg).getText();
String sessionData = msg.getStringProperty("sessionData");
rplyEnvelope = new RplyEnvelopeOk(xmlRply,sessionData);
}
else if (status.equals(EnvelopeConstants.V_NOK))
{
String xmlRply = ((TextMessage)msg).getText();
rplyEnvelope = ErrorMarshallerXML.unmarshallError(xmlRply);
}
else
{
throw new EnvelopeMarshallerException("Invalid 'status' property: " + status);
}
return rplyEnvelope;
}