Service Virtualization

  • 1.  How to Read the rows from the excel and represent the data on the webpage .?

    Posted May 24, 2016 06:26 AM

    Hi,

    I have a requirement -

    I have to create the virtual service which should read  the rows from the excel and represent the  read data on the webpage using HTML response .

    I created the virtual service which reads the rows  from  the excel sheet and displays the single row on the webpage:

    But I am stuck where I need to read the rows and represent the data on the webpage dynamically using html response code.

    Please help on this.

     

    Below  is the sample  html response where I am displaying the rows manually by explicitly.

     

    <html>

     

     

    <h2><strong><em>Service HealthCheck</em></strong></h2>

     

     

        <head>

            <style>.datagrid table { border-collapse: collapse; text-align: left; width: 100%; } .datagrid {font: normal 12px/150% Arial, Helvetica, sans-serif; background: #fff; overflow: hidden; border: 1px solid #A65B1A; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }.datagrid table td, .datagrid table th { padding: 3px 10px; }.datagrid table thead th {background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #A65B1A), color-stop(1, #7F4614) );background:-moz-linear-gradient( center top, #A65B1A 5%, #7F4614 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#A65B1A', endColorstr='#7F4614');background-color:#A65B1A; color:#FFFFFF; font-size: 15px; font-weight: bold; border-left: 1px solid #BF691E; } .datagrid table thead th:first-child { border: none; }.datagrid table tbody td { color: #7F4614; border-left: 1px solid #D9CFB8;font-size: 12px;font-weight: normal; }.datagrid table tbody .alt td { background: #F0E5CC; color: #7F4614; }.datagrid table tbody td:first-child { border-left: none; }.datagrid table tbody tr:last-child td { border-bottom: none; }.datagrid table tfoot td div { border-top: 1px solid #A65B1A;background: #F0E5CC;} .datagrid table tfoot td { padding: 0; font-size: 12px } .datagrid table tfoot td div{ padding: 2px; }.datagrid table tfoot td ul { margin: 0; padding:0; list-style: none; text-align: right; }.datagrid table tfoot  li { display: inline; }.datagrid table tfoot li a { text-decoration: none; display: inline-block;  padding: 2px 8px; margin: 1px;color: #FFFFFF;border: 1px solid #A65B1A;-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #A65B1A), color-stop(1, #7F4614) );background:-moz-linear-gradient( center top, #A65B1A 5%, #7F4614 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#A65B1A', endColorstr='#7F4614');background-color:#A65B1A; }.datagrid table tfoot ul.active, .datagrid table tfoot ul a:hover { text-decoration: none;border-color: #7F4614; color: #FFFFFF; background: none; background-color:#A65B1A;}div.dhtmlx_window_active, div.dhx_modal_cover_dv { position: fixed !important; }</style>

            <title>Service HealthCheck </title>

        </head>

        <script type="text/javascript"></script>

        <body>

            <form method="POST" action="http://localhost:8001/GetHealthLink"/>

                <div class="datagrid">

                    <table>

                        <thead>

                            <tr>

                                <th>Application</th>

                                <th>ServiceName</th>

                                <th>URL</th>

                                <th>STATUS</th>

                              

                            </tr>

                        </thead>

                        <tfoot>

                            <tr>

                                <td colspan="4">

                                    <div id="paging">

                                        <ul>

                                            <li>

                                                <a href="#">

                                                    <span>Previous</span>

                                                </a>

                                            </li>

                                            <li>

                                                <a href="#" class="active">

                                                    <span>1</span>

                                                </a>

                                            </li>

                                            <li>

                                                <a href="#">

                                                    <span>2</span>

                                                </a>

                                            </li>

                                            <li>

                                                <a href="#">

                                                    <span>3</span>

                                                </a>

                                            </li>

                                            <li>

                                                <a href="#">

                                                    <span>4</span>

                                                </a>

                                            </li>

                                            <li>

                                                <a href="#">

                                                    <span>5</span>

                                                </a>

                                            </li>

                                            <li>

                                                <a href="#">

                                                    <span>Next</span>

                                                </a>

                                            </li>

                                        </ul>

                                    </div>

                                </tr>

                            </tfoot>

                            <tbody>

                                <tr>

                                    <td>{{Application}}</td>

                                    <td>{{ServiceName}}</td>

                                    <td>{{URL}}</td>

                                    <td bgcolor="green">{{STATUS}}</td>

                                    <td>

                                </tr>

                                <tr >

                                    <td>Internal Portal</td>

                                    <td>getPartyNotificationsV01.02</td>

                                    <td>http://localhost.wsdl</td>

                                    <td bgcolor="green">PASS</td>

                                </tr>

                            </tbody>

                        </table>

                    </div></html>

     

     

    Note :1. I am  creating the VS using rest request as operation as GET.

              2.As I mentioned above I need to display td elements dynamically in the response body.

     

    Regards,

    Ashwath.S



  • 2.  Re: How to Read the rows from the excel and represent the data on the webpage .?

    Posted May 24, 2016 10:53 AM

    ok, so what is the question?

     

    you will need to generate the html as part of the request handling, and then send the constructed html back as the response.

    if this response is unique , then you will have to write some code to handle it..



  • 3.  Re: How to Read the rows from the excel and represent the data on the webpage .?

    Posted Jan 17, 2017 03:56 PM

    Ashwath,

     

    Did Sam's recommendations help you out with this issue?