Problem calling Web Service using the DynamicPopulate Extender - Web Service Call Fails: 500

Hi, I'm quite new to ASP.Net AJAX so please forgive my ignorance.

 I have downloaded and installed the RC1 version and am following through some of the tutorial videos.

 I am having a problem with the Dynamic Populate Extender example.  I have created some asp controls with onclick events calling a javascript function.  From there I am attempting to use a dynamic populate extender control to call a web service - it's a function declared on that ASPX page as the tutorial explains in necessary and decorated with the System.Web.Services.WebMEthod AND System.Web.Script.Services.ScriptMethod attributes.

 Everything works as expected until I attempt to pass a parameter to the web services - in fact until I declare the web service function with a parameter. Once I do this, all that is returned to (or at least all that displays in) the control linked to the DynamicPopulateExtender is "Web Service Call Failed: 500".

Can anyone possibly put me on the right track here? (or would I need to post some code examples?)

 Thanks in Advance.

Stu.


Stu
0
shelwig
1/20/2007 11:17:10 AM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

3 Replies
1546 Views

Similar Articles

[PageSpeed] 23

the tutorial is in beta version.

i will post my code for you

ASPX page

 <%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="DynamicPopulateDemo._Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>

</head>
<body>
  
    <form id="form1" runat="server">
     <script  type="text/javascript">

    function updateDateKey(value) {

        var behavior = $find('dpe');

        if (behavior) {
            behavior.populate(value);
        }

    }

    Sys.Application.add_load(function(){updateDateKey('G');});
     </script>

        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <cc1:DynamicPopulateExtender ID="dpe" runat="server" ClearContentsDuringUpdate="true"
            PopulateTriggerControlID="Label1" TargetControlID="pan" ServiceMethod="GetHtml">
        </cc1:DynamicPopulateExtender>
       
    <p>
        <asp:Label ID="Label1" runat="server" Text="Label" CssClass="subheading">Time at the server:</asp:Label> 
        </p>
  Choose a date/time format:<p>
            <label for="r0"><input type="radio" name="rbFormat" id="Radio1" value='G' onclick="updateDateKey(this.value);" checked="checked" />Normal</label><br />
            <label for="r1"><input type="radio" name="rbFormat" id="Radio2" value='d' onclick="updateDateKey(this.value);" />Short Date</label><br />
            <label for="r2"><input type="radio" name="rbFormat" id="Radio3" value='D' onclick="updateDateKey(this.value);" />Long Date</label><br />
            <label for="r3"><input type="radio" name="rbFormat" id="Radio4" value='U' onclick="updateDateKey(this.value);" />UTC Date/Time</label><br />
        </p>
        <br />
        <p>

        This time is dynamically formatted and<br /> returned as HTML from the server:

        <asp:Panel ID="pan" runat="server" BorderColor="#404040" BorderStyle="Solid" BorderWidth="1px" Height="15px" HorizontalAlign="Center" Width="380px">
        </asp:Panel>
        </p>

    </form>


</body>

</html>

ASPX.CS

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace DynamicPopulateDemo
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           
        }
        [System.Web.Script.Services.ScriptMethod]
        [System.Web.Services.WebMethod()]
        public static string GetHtml(string contextKey)
        {
            System.Threading.Thread.Sleep(250);
            string value = string.Empty;

            if (contextKey == "U")
            {
                value = DateTime.UtcNow.ToString();
            }
            else
            {
                value = String.Format("{0:" + contextKey + "}", DateTime.Now);
            }
            return String.Format("<span style='font-family:courier new;font-weight:bold;'>{0}</span>", value);


        }
    }

 


James Wu (MIB426)
.NET is only way to go
MCP, MCSE, MCDBA, MCSD, MCAD
0
MIB426
1/20/2007 3:55:40 PM

Thankyou very much for posting this code.

I have worked through the differences between your version of the tutorial and the code I was trying to get running.  It all boiled down to the name of the parameter on the web service method. I don't understand this yet but if I call the parameter on my web service method, "contextKey" it works, if I call it anything else, it fails.

Is anyone able to shed some light on this for me?

 


Stu
0
shelwig
1/20/2007 11:27:55 PM

In the documentation it states that the paramater must be a string named contextKey

 

[WebMethod]
string DynamicPopulateMethod(string contextKey) { ... }

Note you can replace "DynamicPopulateMethod" with a naming of your choice, but the return type and parameter name and type must exactly match, including case.

0
MickOBrien
2/6/2007 10:04:35 AM
Reply:

Similar Artilces:

problem calling service
I create as proxy for: http://www.flash-db.com/services/ws/barCodes.wsdl When executing the call to 'dobarcodes' (see code below), I get: Powerbuilder Application Execution Error (R00000) Application terminated. Error: Could not find element by name: return Is this a PB issue or something about the service? P.S. Check http://www.flash-db.com/services/?ID=18&sType=Binary for a PHP sample which is doing practically the same thing the PB code does. /* start sampe code */ soapconnection conn barcodesport bc conn = create soapconnection conn.createin...

call, call(), .call, and captures
From S06: sub bar ($a,$b,$c,:$mice) { say $mice } sub foo (\$args) { say $args.perl; &bar.call($args); } The C<.call> method of C<Code> objects accepts a single C<Capture> object, and calls it without introducing a C<CALLER> frame. And from S12: In addition to C<next METHOD>, the special function C<call> dispatches to the next candidate, possibly with a new argument list: call; # calls with the original arguments call(); # calls with no arguments call(1,2,3); # calls ...

Service call failed: Star Wars
I'm having a problem with the Web Box Services. I've removed the Star Wars subscription and added my own (http://ifc.gospelcom.net/index.rdf + http://www.blogs4god.com/index.rdf). But when I click on "Refresh" button in the Admin screen for these subscriptions, nothing happens. I go back to the home page and nothing happens, it's empty (because I've cleared out all content from the Admin screen). But if I view the log file, I keep seeing: "Service call failed: Star Wars" for every time I refreshed "/community/Default.aspx" .. and if I click on that log entry it...

call service
how can we call ASMX webservice method and  SVC method and if any1 could tell about REST service Here is an article which explains how to make client side webservice call in .NET AJAX. http://msdn.microsoft.com/msdnmag/issues/07/01/ExtremeASPNET/ REST http://blogs.msdn.com/dseven/archive/2007/02/10/boise-code-camp-enabling-rest-in-asp-net.aspxDas (http://aspalliance.com/author.aspx?uId=697)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Dont forget to click "Mark as Answer" on the post that helped you. This marks your thread as Resolved so we will all know you have been helped. if ...

Ajax Autocomplete Webservice Call
Ok, so my method in my webservice requires a type to be passed, it is called in the ServiceMethod property of the AutoCompleteExtender, I am fuzzy about how I should do that so I called it like this:ServiceMethod="DropDownLoad<<%=(typeof)subCategory%>>" where subCategory is a page property that looks like this:protected SubCategory subCategory    {        get        {            var subCategory = NHibernateObjectHelper.LoadDataObject<SubCategory>(Convert.ToInt32(Request.QueryString[&q...

Problem calling YAPP SOAP service
Hello All I am trying to call YAPP SOAP service from the PHP code. I have PHP v 4, SOAP package v 0.12. require_once 'SOAP/Client.php'; $client = new SOAP_Client("http://lingua.codegear.com/yapp/ws/yapp.asmx?WSDL"); $response = $client->call("Highlight", array( 'SourceCode' => "begin i := 0; end;", 'LanguageType' => "ltDelphi", 'StartingLine' => 0)); return $response->message( ); The $response is a SOAP_Fault object, containing message "SOAP-ENV:soap:Server Server was unable ...

To use Naming Service...or not to use Naming Service?
That is my question. I want to use clustering and load balancing on my jag servers, so I'm not sure if I need to do this or if the connection object handles this "behind the scenes". In PB does the connection object use the nameservice to do this for you, or do you have to use the JaguarORB.Resolve_Initial_References(), and narrow everything down to the component to take advantage of this? What is "the best way" to instantiate Jag components in PB if you want clustering, fail-over, and load balancing? Thanks for any help. Erik T. The connection ...

Calling .NET 2.0 WebService with Delphi (first call fails)
Hello, i have a simple .NET 2.0 Webservice created with VS2008. The webservice contains a method "HelloWorld" that simply returns "Hello world" as string. The method does not need headers to be sent (no authentication and so on) The client is written in D2007 with all updates applied. When i call the service for the FIRST time i get the following exception: Class EDOMParseError with message 'End tag 'ul' does not match the start tag 'p'. Line: 124 '</ul>'. It seems that this comes from an error message tha...

Problem with SOAP call to PHP services provider
The request is being accepted by the PHP server just fine.  And the response appears to be formatted correctly, but .NET is throwing a system level exception and I don't understand why.  Here is the response, the error and the WSDL: Response: 1 <?xml version="1.0" encoding="ISO-8859-1"?>2 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlso...

?????? Distributed Service Error
(PB 5.0.03) Hi, my problem is still there. We have NVUOs on an applicative server with several functions. When GUI call these functions 'too fast' (for exemple, I call a function when I click a button, if I click too fast ...) we received this message: Distributed Service Error (R0050) Attempt to call remote object while prior call is still executing Please, how can avoid this problem ? -- pal@bsb.be*nospam* Please remove *nospam* before sending email Alberty, Try disabling the button at the beginning of the script and re-enabling upon exit, or more specifically,...

how can I access the session from within a procedure in a class called from a remote service call? AJAX
I have an AJAX application. I need for the user to be able to  upload a file so I cheat and I put an upload control on the page. I do the file uploading thru a regular postback withthe upload control that is put on the page. The uploading is handled in a code behind procedure that is in the code behind of the page and is triggered by a button click (file upload).Since it is a picture that is being upload and itis not sure that it is the right picture, or theat the usert likes it, or chose the right one..... Before my AJAX days I used to upload the picture and put it as an Image object a...

ModalPopup using WebServices (WebService Call Failed: 500)
Hi All,   I am trying to populate a gridview and display the results in a Modal Popup.  I have wired it all together, but when it calls the webservice, it is not dropping into the web service.  It finds the .asmx file which calls a .cs file and begins to run through the process, but it doesnt run the WebMethod.   Here is all the code, your help is greatly appreciated. The asmx File: <%@ WebService Language="C#" CodeBehind="~/App_Code/ModalSerivice.cs" Class="ModalService" %> Here is the WebService: [WebService(Namespace = "http://tempuri.org/")] [WebService...

Service component fails to do an intercomponent call due to NO_PERMISSION
Hello, we have a very urgent request, as we go into production this monday. We have got a service component (ThreadService) looking up the ThreadManager and starting threads for component which should poll an external message queue. This setup works fine till now. Today we deployed to our production machine (Dec 12 14:22:59 2003: JaguarCTS - Component Transaction Server/Version 4.1.2(Build 41210)/P/dce_sun_svr4/SPARC Solaris 2.6/Tue Jul 16 19:27:31 PDT 2002) and got the following error: Dec 12 14:23:13 2003: checkIdentity: CsiCtx == null Dec 12 14:23:13 2003: SystemExceptio...

How to authenticate user while calling WCF service using AJAX?
I have a WCF service which needs to be called directly from the browser. I am using ScriptManager on ASPX page to add a ServiceReference to the WCF service. I am able to call service methods from JavaScript and get the results back.  But I want to deny anonymous users accessing the WCF service. Is there any way to do user authentication before calling a service method from JavaScript?  If you validate before that's cool but someones going to go around it. I honestly haven't tried WCF or MCV yet but first thing I'd try is in the server methods. httpcontext.user.isinr...

Win32 WnetEnumResources() API call fails to retrieve Netware services provider
Hello everyone, I have a very strange problem which can be reproduced when using Netware Novell Client 4.91 (4.91.0.20050216) This happens on both Win2k server with service Pack 4 and Win2k3 server with service pack 1. The Wnet API included on Microsoft SDK provides the function WNetEnumResources. This function can be used to enumerate network resources such network providers, domains, computers, shares etc .... I have written a small piece of code that enumerates all netwrok resources. Part of it enumerates all network providers (which are in my case: NetWare Services, Microsoft...

Web resources about - Problem calling Web Service using the DynamicPopulate Extender - Web Service Call Fails: 500 - asp.net.ajax_control_toolkit

BubbleChart Sample
... BubbleChart Calendar CascadingDropDown CollapsiblePanel ColorPicker ComboBox ConfirmButton DragPanel DropDown DropShadow DynamicPopulate ...

AreaChart Sample
... BubbleChart Calendar CascadingDropDown CollapsiblePanel ColorPicker ComboBox ConfirmButton DragPanel DropDown DropShadow DynamicPopulate ...

ListSearch Sample
... BubbleChart Calendar CascadingDropDown CollapsiblePanel ColorPicker ComboBox ConfirmButton DragPanel DropDown DropShadow DynamicPopulate ...

DynamicPopulate Sample
ContextKey - An arbitrary string value to be passed to the web method. For example, if the element to be populated is within a data-bound repeater, ...

AsyncFileUpload Sample
... BubbleChart Calendar CascadingDropDown CollapsiblePanel ColorPicker ComboBox ConfirmButton DragPanel DropDown DropShadow DynamicPopulate ...

DropDown Sample
... BubbleChart Calendar CascadingDropDown CollapsiblePanel ColorPicker ComboBox ConfirmButton DragPanel DropDown DropShadow DynamicPopulate ...

Ajax Control Toolkit Tutorials - ASP.NET Ajax Library
ASP.NET Home Get Started Learn WEB APPLICATIONS Web Forms MVC Web Pages/Razor Mobile Single Page Apps Common ASP.NET Features WEB SERVICES / ...

LineChart Sample
... BubbleChart Calendar CascadingDropDown CollapsiblePanel ColorPicker ComboBox ConfirmButton DragPanel DropDown DropShadow DynamicPopulate ...

Resources last updated: 11/28/2015 11:20:11 PM