Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 4th, 2008, 06:55 AM
Registered User
 
Join Date: Feb 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to INVOKE any WS on server by WS on client ?

I want to access and "invoke" the web service of server machine by web service of my machine, i have implemented the code as given below but it is not working. means not giving the response back .
Any help will be appreceable
Thanks in advance:


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript" language="javascript" src="scripts/progressbar.js"></script>
</head>
<body>
    <form id="form1" method="post" runat="server">
    <script type="text/javascript" language="javascript">
    function callResponse()
    {
    var url;
    url = "http://localhost/set/Service.asmx";
    startProgressBar();
      postRequest(url);
    }
    /*
    Displays the progress bar and corresponding text
     */
    function startProgressBar()
                {
                    divProgressBar.style.visibility = "visible";
                    pMessage.style.visibility = "visible";
                    progress_update();
                }
    /*
    Hides the progress bar and corresponding text
    */
    function stopProgressBar()
                {
                    divProgressBar.style.visibility = "hidden";
                    pMessage.style.visibility = "hidden";

                    progress_stop();
                }
    /*
        Creates a XMLHTTP async-call to an ASP.NET async handler
    */
    function postRequest(url)
                {



                    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                    //xmlhttp.WaitForExit(4);
                    // 'true' specifies that it's a async call
                    xmlhttp.Open("get", url, true);

                    // Register a callback for the call
                    xmlhttp.onreadystatechange =
                        function ()
                        {
                            if (xmlhttp.readyState == 4)
                            {
                                var response = xmlhttp.responseText;
                                divResponse.innerHTML += "<p>" + response + "</p>";

                                stopProgressBar();
                            }
                        }

                    // Send the actual request
                    xmlhttp.Send();
                }
    </script>
    <div>
        <table id="TABLE1" onclick="return TABLE1_onclick()">

            <tr valign="top">
                <td colspan="3">
                    &nbsp;</td>
            </tr>

            <tr valign="top">

                <td align="left" colspan="3">
                    &nbsp;
                    <input onclick="javascript:callResponse();" type="button" value="START" /></td>
            </tr>
            <tr valign="top">
                <td align="left" style="height: 46px">
                    <p id="pMessage" style="visibility: hidden; position: relative">
                        <b>Processing request...</b>
                    </p>
                </td>
                <td colspan="2" style="height: 46px">
                    <div id="divProgressBar" style="border-right: black 1px solid; padding-right: 2px;
                        border-top: black 1px solid; padding-left: 2px; font-size: 12pt; visibility: hidden;
                        padding-bottom: 2px; border-left: black 1px solid; width: 112px; padding-top: 2px;
                        border-bottom: black 1px solid; position: relative">
                        <span id="progress1">&nbsp;&nbsp;</span> <span id="progress2">&nbsp;&nbsp;</span>
                        <span id="progress3">&nbsp;&nbsp;</span> <span id="progress4">&nbsp;&nbsp;</span>
                        <span id="progress5">&nbsp;&nbsp;</span> <span id="progress6">&nbsp;&nbsp;</span>
                        <span id="progress7">&nbsp;&nbsp;</span> <span id="progress8">&nbsp;&nbsp;</span>
                        <span id="progress9">&nbsp;&nbsp;</span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div id="divResponse"></div>
    </form>
</body>
</html>


Abhinav
 
Old April 4th, 2008, 01:09 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Please explain further what/how it is not working.

-Peter
peterlanoie.blog





Similar Threads
Thread Thread Starter Forum Replies Last Post
WS problem:Unable to connect to the remote server momotr .NET Web Services 8 February 28th, 2008 01:19 PM
WS client sending compressed request? wakeup .NET Web Services 0 October 25th, 2007 04:37 AM
Need help with Macro for Go to in WS Wazar Excel VBA 3 December 31st, 2006 03:44 AM
Calling WS from javascript r_ganesh76 Javascript 5 December 8th, 2004 05:31 AM
Exposing WS Properties r_ganesh76 .NET Web Services 2 October 3rd, 2004 11:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.