AnsweredAssumed Answered

Variable Substitution in binary JMS Payload

Question asked by poca on Jul 17, 2017
Latest reply on Oct 2, 2017 by Maddy007

Hi

 

We are using DevTest 9.1.0 for service virtualization. The use case here is asynchronous messaging (JMS).

The model and the image of our VS are self-made (not using the recording option), based on RR data (XML files).

 

What our VS has to do is the following:

1) Receive JMS request message from input-queue

2) Parse some (custom) JMS header properties from the request

3) Identify the response XML file that corresponds to the request message (match style: operation)

4) Substitute the {{…}} placeholders in the response XML payload by some of the parsed values

5) Set some JMS header properties for the response (using some other parsed values)

6) Send the response to an output-queue

 

This is working all fine, we already managed to set up several VS this way.

 

In the current use case we want to do the exact same thing, but the response message from the VS needs to be a BytesMessages now, instead of a TextMessage as before.

 

So we started the same way we would for TextMessages, but now in the transactions tab of the image, we changed the content type of the body of the response to be “General=>Binary” instead of “XML=>XML Document”. Additionally, for the meta data of the response we changed the field “msg.type” from javax.jms.TextMessage to javax.jms.BytesMessage.

 

This basically works, and the VS is responding with the binary equivalent of the response XML, as desired. However, the {{…}} placeholders in the XML payload are no longer replaced by content, but left as is in the response.

 

We know the problem can’t be related to the variables and/or the values within the variables. This is because even if we take the exact same variable for a meta data field and within the payload, only the meta data one gets substituted. The one in the payload works for TextMessages, and stops working when we switch to Bytes (leaving all as is apart from the two modifications mentioned above).

 

Our model is rather simple and (besides some irrelevant intermediate steps) basically just includes the steps Listen => VS Image Response Selection => Respond.

Please note that we use the VSE Listen step instead of the JMS Send Receive step due to some external tools used in the automatic generation/deployment process of VS. Therefore the values that should be injected in the response payload typically come from lisa.jms.Recv.PropertyMap.<PropertyName>. But as mentioned above, the replacement works fine in the meta data and for TextMessages payload, so this should not be relevant to the problem.

 

We really think that the problem is simply the fact that DevTest is unable to substitute variables in binary payload. Is this possible?

 

Any suggestions how to fix this?

 

The perfect solution for us would be to build the VS exactly the same way as we do for TextMessages and to then (probably in an additional step) explicitly transform the payload from XML to Binary and to overwrite the msg.type to javax.jms.BytesMessages just before actually sending the response (but after the substitution took place ofc). Is there a way to do this?

 

Any other solution would be highly appreciated as well...

 

Thank you very much!

Outcomes