View Single Post
  #6 (permalink)  
Old January 27th, 2012, 02:12 PM
Christos8 Christos8 is offline
Registered User
Points: 14, Level: 1
Points: 14, Level: 1 Points: 14, Level: 1 Points: 14, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem on client side for web servcice

Thanks, Imar for you direct responce.

the code in Web Sevice Demo page is the following

Code:
<%@ Page Title="Web Services Demo" Language="C#" MasterPageFile="~/MasterPages/Frontend.master" AutoEventWireup="true" CodeFile="WebServices.aspx.cs" Inherits="Demos_WebServices" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    <Services>
        <asp:ServiceReference Path="~/WebServices/NameService.asmx" />
    </Services>
</asp:ScriptManagerProxy>
<script type="text/javascript">
    function HelloWorld() {
        var yourName = $get('YourName').value;
        NameService.HelloWorld(yourName, HelloWorldCallback, ErrorCallback);
    }
    function HelloWorldCallback(result) {
        alert(result);
    }
    function ErrorCallback(error) {
        alert(error.get_message);
    }
    $addHandler($get('sayHello'), 'click', HelloWorld());
</script>
<input id="YourName" type="text" />
<input id="SayHello" type="button" value="Say Hello" />
</asp:Content>
The Web service does work. I have tested many times. So the problem is not surely in the web service. Hence, I don't post the coressponding code.

No, I didn't debug my code.

Thank you in advance for your help.

By the chance, your book is really amazing. I have read it from the cover to the 354 page and I hadn't any problem. Also I have learned many things until know.

Christos
Reply With Quote