Service Virtualization

  • 1.  How to generate a response that comes back to the user as a picture (jpg)?  Do we need to encode the picture as CDATA?

    Posted Feb 15, 2016 08:16 AM

    Generate a picture response



  • 2.  Re: How to generate a response that comes back to the user as a picture (jpg)?  Do we need to encode the picture as CDATA?
    Best Answer

    Posted Feb 15, 2016 06:05 PM

    You can add a image response in your VSI.

    • In the Response tab of your transaction, Click the "+" to add a new response.
    • Select the the protocol you are using
    • The in the Body tab click on the "settings" gear image, and select General/Graphic Image
    • Click on the load from file, and select the image you want to send.


  • 3.  Re: How to generate a response that comes back to the user as a picture (jpg)?  Do we need to encode the picture as CDATA?

    Posted Feb 15, 2016 06:50 PM

    Thank you for the quick response.  ...I am giving that a try now and will keep you posted.  Thank you!



  • 4.  Re: How to generate a response that comes back to the user as a picture (jpg)?  Do we need to encode the picture as CDATA?

    Posted Feb 16, 2016 06:24 AM

    Thank you for the suggestion as that did work! ☺

     

    Regards,

    Tom Shokite



  • 5.  Re: How to generate a response that comes back to the user as a picture (jpg)?  Do we need to encode the picture as CDATA?

    Posted Feb 16, 2016 09:22 AM

    As it turns out there are several ways to return a "picture".  Another way is for the xml to contain html and then embed the styling information so that a "generated picture" comes back.  Anyway, thank you for this additional solution as now we have several ways of returning a picture.



  • 6.  Re: How to generate a response that comes back to the user as a picture (jpg)?  Do we need to encode the picture as CDATA?

    Posted Feb 27, 2016 04:10 PM

    I successfully generated the html embedded in xml.  Here is the xml response that generates the picture.  This works successfully for multi-browsers checked so far: Chrome, IE Explorer, Firefox:

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>

    </title></head>
    <body>
        <form name="form1" method="post" action="Default.aspx" id="form1">
    <div>
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE1MTU2MzE5MDhkZPvLjOJEcIy3MmiSgbsJfgZXt/2p" />
    </div>

        <div>
       
            <img id="Image1" src="http://interestgroups.thehartford.com/group/ServiceVirtualization/Lists/Group%20Documents/ECOS.png" style="border-width:0px;" />
       
        </div>
        </form>
    </body>
    </html>



  • 7.  Re: How to generate a response that comes back to the user as a picture (jpg)?  Do we need to encode the picture as CDATA?

    Posted Mar 11, 2016 07:35 AM

    There is yet another way to return a "Picture".  I am putting here just to be complete and for future reference.  This technique references a "png" image file that resides at our local SharePoint site.  Advantages of this method is that it keeps the DevTest image file (vsi) very small which is a nice advantage if we need to return a lot of images. Here is the response.  It is returned with the "GET /" command:

     

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>

    </title></head>
    <body>
        <form name="form1" method="post" action="Default.aspx" id="form1">
    <div>
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE1MTU2MzE5MDhkZPvLjOJEcIy3MmiSgbsJfgZXt/2p" />
    </div>

        <div>
            <img id="Image1" src="http://interestgroups.thehartford.com/group/ServiceVirtualization/Lists/Group%20Documents/ECOS.png" style="border-width:0px;" />
        </div>
        </form>
    </body>
    </html>



  • 8.  Re: How to generate a response that comes back to the user as a picture (jpg)?  Do we need to encode the picture as CDATA?

    Broadcom Employee
    Posted Mar 11, 2016 11:06 AM

    Thanks Mr T for all this useful information!