Service Virtualization

  • 1.  How to virtualize this

    Posted Jun 28, 2017 04:16 AM

    How can i virtualize following request/response over http?

     

    Request:

    Body=AUTH=<DIST_ID>49FB001</DIST_ID><AUTH_PROC_ID>ABCde3CbVYCosy6nwdPVUWF</AUTH_PROC_ID><MEAN_ID>SDBL</MEAN_ID><EAI_AUTH_TYPE>SDBL</EAI_AUTH_TYPE><EBANKING_USER_ID><SMID>5555555555</SMID></EBANKING_USER_ID><EBANKING_USER_AUTHENTICITY_VALIDATION><AUTHENTICATION_MEAN_ID>21</AUTHENTICATION_MEAN_ID></EBANKING_USER_AUTHENTICITY_VALIDATION>

     

     

    Response (JSON):

    {"value":"/SEEA-pa01/SEEAServer","businessMessageBulk":{"messages":[],"pewCode":null,"globalIndicator":null,"text":null}}

     

    If possible the AUTH_PROC_ID should be dynamic, but i cannot alter it via a request data manager.

    I tried to create via request/response pairs, but it is giving me a weird vsi, which i'm not familiar with.



  • 2.  Re: How to virtualize this
    Best Answer

    Broadcom Employee
    Posted Jun 28, 2017 09:39 AM

    I'm concerned about your "Body=AUTH=" prefix to the XML. Perhaps you need to find some way to remove that (I would do it in a scriptable DPH, but I'm sure there are many other mechanisms just as good).

    Without an XML stanza at the start of the body ("<?xml version=...>" etc), DevTest will not automatically identify your request as valid XML, so you'll want to select that in the "Data Protocol" screen in the generation wizard.

     

    When you successfully create your VSI, simply click the "mass request change" button. You want to set the match to "Anything" where the argument is "AUTH_PROC_ID"



  • 3.  Re: How to virtualize this

    Posted Jun 29, 2017 03:17 AM

    Thanks Rick, I followed your advice, but it is giving me an error.

     

    During the wizard I have added a scripted DPH and an XML DPH as shown below:

     

    The script contains the following code:

    %beanshell%
    // Manipulate request body text
    String theBody = lisa_vse_request.getBodyText();
    lisa_vse_request.setBodyText(theBody.substring(10));

     

    When clicking next, I receive the following error:

     

    I thought selecting the XML DPH would add the ("<?xml version=...>" etc) or at least recognize it, but it does not seem to be the case. Any ideas?

     

    Thanks,

    Dave



  • 4.  Re: How to virtualize this

    Broadcom Employee
    Posted Jun 29, 2017 06:03 AM

    Hi Dave --

     

    The request, as it currently stands, is a XML snippet rather than a document, so the SAX parser is saying "the document is not well formed". To make the XML well formed, you need to put it into a document. The easiest way to do this is to edit your script. The line:
       lisa_vse_request.setBodyText(theBody.substring(10));

    should be changed to:
       lisa_vse_request.setBodyText("<body>" + theBody.substring(10) + "</body>");

    In this way, the XML is all inside one "body" document, and the SAX parser won't choke on it.

     

    I would try it without the JSON response DPH, too, so you can compare what you get in a JSON view against what you get in an XML view (SV supports both).

     

    Rick



  • 5.  Re: How to virtualize this

    Posted Jun 29, 2017 09:43 AM

    Thanks a lot for the assistance, Rick.

    It's much appreciated.