Service Virtualization

 View Only
  • 1.  Reading an Xml tag using JavaScript in LISA

    Posted Dec 11, 2015 08:37 AM

    Hi,

     

    Can anyone help me in this.

    Am working on LISA.

    Am new to webservice virtualization.

    I need to virtualize a webservice which is having security header.

    I have req&res pair.

    But inorder to magisiting i need to read the request tag and assign the value to a varaibale.

    I tried using javascript step in the VSM and tried to save the value in attribute using the XML path filter.

    But still am unable to get the value into the variable.

    I used the following code to read the XML

     

    import javax.swing.JOptionPane;

    vse_request = testExec.getStateValue("lisa.vse.request");

    String request_bodytext = vse_request.getBodyText();

    testExec.setStateValue("request",request_bodytext);

     

    Can anyone suggest me how to do this.

     

    Thanks in advance.



  • 2.  Re: Reading an Xml tag using JavaScript in LISA

    Broadcom Employee
    Posted Dec 11, 2015 10:17 AM

    Hi Girija,

     

    If you just want to extract a XML tag from your request, you can use Generic XML Payload Parser Data Protocol Handler during recording and create an argument instead of Javascript. Once you have an argument in VSI then you can do the magic string.

     

    Thanks,

    Prema



  • 3.  Re: Reading an Xml tag using JavaScript in LISA

    Posted Dec 12, 2015 02:59 AM

    Thanks Prema.

     

    As the request tag contains huge data and the key value is not straight forward in the tag i thought of using the JavaScript in the VSM, but As suggested by you i used the Generic XML Payload Parser and added the code in match script which worked fine.

     

     

    Thanks alot.

     

    Regards,

    Girija K.



  • 4.  Re: Reading an Xml tag using JavaScript in LISA
    Best Answer

    Posted Dec 23, 2015 01:27 AM

    Hi Prema,

     

    When I used Generic Payload parser Data Protocol and Webservices header Protocol the service is working fine as expected.

     

    But when i tried to merge this subservice with the existing VSI am am facing error.(No Match found).

    The request is not hitting the Subservice.

    The request is coming with name ProcessRequest when we include Web service(SOAP) protocol.

    The VSM has Web service(SOAP) protocol and Webservice Header  protocol.

     

    Could you please help in this.

     

    Thanks in advance.

     

    Regards,

    Girija K.



  • 5.  Re: Reading an Xml tag using JavaScript in LISA

    Broadcom Employee
    Posted Jan 06, 2016 03:12 PM

    Hi Girija,

     

    When you use Generic XML payload parser for creating arguments in VS, the Xpaths will be added to the VSM-->HTTP Listen step-->Filter (Data protocol-Generic XML Payload Parser).

     

    When you combine VSI's, only transactions will be merged. The VSM which you are using for the combined VSI must be missing the XPATHs which might have caused the issue. You can use the VSM which has Xpaths and use the combined VSI and see that helps with the issue.

     

    If you still have the issue, please open a support ticket.



  • 6.  Re: Reading an Xml tag using JavaScript in LISA

    Posted Mar 07, 2016 01:36 AM

    Hi Prema,

    It worked fine for me.

     

    Thanks for your help