Service Virtualization

  • 1.  VS stitching Request - Response when there are repetitive node values

    Posted Nov 05, 2018 12:27 PM

    Issue: How to stitch Request-Response for a request which contains repetitive node values (arrays) for same request?

     

    NOTE: Based on array count - response too has one or more array count for each request

     

    Question: How to create VSM & VSI so that - manual update of VSI for each array count can be avoided. 

     

    For EX: If request is sent with array count 1 or 4 or 10 - VSI should give unique response for each request.  I should not update VSI to accommodate every time with new array count. A sample project would help me to implement this.

     

    Sample Request XML (array complexType only once):

    <complexType>

    <name>ABC</name>

    <account>1234</account>

    </complexType>

     

    Response:

    <complexBalance>

    <account>1234</account>

    <balance>10</balance>

    </complexBalance>

     

    Sample Request XML (array complexType repeated 2 or more based on user request):

    <complexType>

    <name>ABC</name>

    <account>1234</account>

    </complexType>

    ...

    <complexType>

    <name>XYX</name>

    <account>7890</account>

    </complexType>

     

    Response:

    <complexBalance>

    <account>1234</account>

    <balance>10</balance>

    </complexBalance>

    ..

    <complexBalance>

    <account>7890</account>

    <balance>20</balance>

    </complexBalance>



  • 2.  Re: VS stitching Request - Response when there are repetitive node values
    Best Answer

    Broadcom Employee
    Posted Nov 05, 2018 03:00 PM

    I wrote a blog entry a few months ago, explaining how to do this:

    An Approach for virtualizing optional repeating blocks 



  • 3.  Re: VS stitching Request - Response when there are repetitive node values

    Posted Nov 06, 2018 06:55 AM

    Hi Rick,

     

    This is exactly what I need. I tried to read the doc and was able to understand the logic behind it. Is it possible if you can share Virtual Service implemented with the doc you provided. It will help me to learn and build the VS.



  • 4.  Re: VS stitching Request - Response when there are repetitive node values

    Posted Nov 07, 2018 08:37 AM

    Rick.Brown 

    Hi Rick,

     

    I tried creating the way you suggested. Getting confused with doc you shared. Is it possible if you can share the Sample SV project for this. It would be very helpful for me.



  • 5.  Re: VS stitching Request - Response when there are repetitive node values

    Broadcom Employee
    Posted Nov 07, 2018 01:12 PM

    My work devising the approach is embedded in a project for a customer, with their data inside it and containing assertions that would expose their message structure. If you can share your messages, I'll repeat the approach using your data and post it here.



  • 6.  Re: VS stitching Request - Response when there are repetitive node values

    Posted Nov 19, 2018 07:01 PM

    Hi Rick.Brown

     

    Please find the attached sample Request - Response for 2 blocks. This blocks can be 1 or 2 or n in my cases. If you could share the SV project mentioned in your project based on attached req-rsp - it will really help me.

     

    Request side: currentDetails block repeating 2 times 

    Response side: currentData block repeating 2 times

    Attachment(s)

    zip
    current-req.xml.zip   463 B 1 version
    zip
    current-rsp.xml.zip   513 B 1 version


  • 7.  Re: VS stitching Request - Response when there are repetitive node values

    Broadcom Employee
    Posted Nov 20, 2018 08:19 AM
      |   view attached

    Please find attached a project using my approach against the samples you provided.

     

    I needed to make all the changes that I mentioned in my document, to match the names of your repeating blocks and the placement of your namespace indicators. I also manually removed the repeating parameters from the "master" VSI, and added lines to my request-side scriptable DPH to remove them from the input message after storing them in an array to call the "subset" virtual service.

     

    I tested it with two repeating blocks and with 7 repeating blocks, to ensure the correct number of repeating blocks are being returned in the response.

     

    I reckon it took me about 5 hours to apply the approach and extend the virtual service with the changes mentioned above.

     

    I hope it helps.

     

    Rick

    Attachment(s)



  • 8.  Re: VS stitching Request - Response when there are repetitive node values

    Posted Nov 20, 2018 09:24 AM

    Thanks so much Rick.Brown for providing me this. I will look into the project and try to understand it.

    Really appreciate the effort and time you took to help me out with this issue. All praise to you.

    Many thanks

     

    I will keep you posted on the progress.