Service Virtualization

 View Only
Expand all | Collapse all

How do I include a Key/Value in Body-Text for Response for Unknown Stateless Request?

  • 1.  How do I include a Key/Value in Body-Text for Response for Unknown Stateless Request?

    Posted Mar 03, 2016 03:00 PM

    I am working in CA Service Virtualization using HL7 messages with Stateless Transactions.  I have a model that can deliver one to many responses per logical transaction.  However, when there is no match in Meta, I want to log the original HL7 request to make it easier to find.  Being new to SV, my solutions are clunky and would appreciate any help in streamlining my ideas.


    Setup: In the vsi on the Service Image tab, I have added a default response in the "Response for Unknown Stateless Request" section with a type of Text in the Body section.  I have tested this and when there is no match, this response is appropriately logged into the vse_matches.log.


    My approaches to capturing the original message:

    1.  (Clunky way )  In my model, I have created a Numeric Counting Data Set so I can increment a number by 1.  Then in a custom step, I read in a file with the default response that is the same as the response in the Service Image tab and store it in a custom Property.  My next custom step iterates through the list of one to many responses.  At this point in the model, if there is no match, my default response from the Service Image tab will be populated into my response list object.  In Beanshell, I have a conditional statement that compares the response list object with the default response I read into the property.  If the two responses are the same, I know there is no match in Meta.  I then write the original request using lisa.vse.tcp.current.transaction.body to a file (appended by my number) to a folder within the project.  If there are multiple "no matches", then another file is written with the next incremented number.  When the run is completed, I can now go into that folder and look at each text file.  The only problem is that this only works when running the ITR but not after the service is deployed.  It would be nice to know how to get this to run in deployment mode.


    2. (Better way?) I have tried creating a Key/Value pair in the Meta Data tab of the Service Image tab under "Response for Unknown Stateless Request" section.  Key = Message  Value = RawRequest (predefined property)When I add the property to my default response {{Message}} it does not write the contents of this property.  It just appends my default response like the example below.  I have a feeling it is because I have to choose a payload of type Text as I cannot return XML.


    MSH:;~\&:SPC:A:IM:A:20141211165358::ACK:7470223:P:2.2:7470223::AL:::::::2.2bMSA:AA::ACKCreated for Default Response for NO MATCH {{Message}}


    Again, I am new to this and I am in hopes someone has worked with the unknown response before.  Or perhaps relay a better way to log this?


    Thank you!  Jude

  • 2.  Re: How do I include a Key/Value in Body-Text for Response for Unknown Stateless Request?

    Posted Mar 10, 2016 06:27 PM

    >NO MATCH {{Message}}


    one of the side effects of doing this is that the {{Message}} will NOT be replaced by '' if Message is NOT defined.  you will get {{Message}} as the content..


    so you must insure that you ALWAYS set property Message to SOME value even if '' (null string)


    I use only {{output_body}} in my default statement vsi message output area.. and fill it in from my vsm as required.