Service Virtualization

Expand all | Collapse all

How can we store the request received by LISA in one JavaScript variable??

  • 1.  How can we store the request received by LISA in one JavaScript variable??

    Posted Jun 15, 2017 03:38 AM

    How can we store the request received by LISA in one JavaScript variable.??

     

     

     

    Thanks,

    kartik



  • 2.  Re: How can we store the request received by LISA in one JavaScript variable??
    Best Answer

    Posted Jun 15, 2017 12:10 PM

    This seems to be a bit of a spin off of this post: Virtualization of Soap Request with Dynamic response with LISA (9.5.1.6)  

     

    To answer the question:

    lisa_vse_request is an object of type Request. The Request object holds more than just the body of the request. You seem to be interested in retrieving the body.

     

    String theBody = lisa_vse_request.getBodyAsString();  

     

    Or  String theBody = lisa_vse_request.getBodyText(); although getBodyText() has been deprecated in later versions of DevTest.

     

    Both of these methods return an object of type string.

     

    There is no OOTB method on the Request object that returns an object of type XML Document (i.e., org.w3c.dom.Document). You can parse the body string into a Document object by adding more logic.