I'm having a bit trouble getting this to work... I've made a very simple WebService, tested it etc. Everything works fine, I can even call it 'from a normal website as usual', but when I call it from this Extender I keep getting an error:
WebService call failed: 500
This is a snippet from the Extendersetup:
<
atlasToolkit:DynamicPopulateExtenderID="dp"runat="server"><atlasToolkit:DynamicPopulateProperties
TargetControlID="Panel1"
ClearContentsDuringUpdate="true"
PopulateTriggerControlID="Label1"
ServicePath=http://localhost/wstest/service.asmx
ContextKey="kkl"
ServiceMethod="GetHtml"
/>
</atlasToolkit:DynamicPopulateExtender>
And from the WebService:
[System.Web.Services.WebMethod]
publicstring GetHtml(string contextKey)
{
System.Threading.Thread.Sleep(250);
string value ="";
if (contextKey =="U")
{
value =DateTime.UtcNow.ToString();
}
else
{
value =String.Format("{0:" + contextKey +"}",DateTime.Now);
}
returnString.Format("<span style='font-family:courier new;font-weight:bold;'>{0}</span>", value);
}
Everything is just taken from the samples, but exposed like a WebService.
Any good ideas with this can be??![]()
Kind regards
Make sure you have the webservice stuff in your web.config. The easiest thing to do is to make sure you're starting with a new "Atlas" Website, since it's already set up. If not, I think this is all you need:
<
configSections><
sectionname="webServices"type="Microsoft.Web.Configuration.WebServicesSection"requirePermission="false"/></configSection>
<
microsoft.web><webServicesenableBrowserAccess="true"/></microsoft.web>
I've all that in my Web.config - I used the Atlastemplate when I started the project. I've also updated all Atlasfiles to the latest versions.
I've just tested the AtlasControlToolkit and DynamicPopulate and the testharness, i've added the ServicePath right between these:
TargetControlID
="Panel1"ServicePath=http://localhost/wstest/service.asmx
PopulateTriggerControlID="Label1"ServiceMethod="GetHtml"
Page Method Update:
WebService call failed: 500
Script Method Update:
Script Success
// (c) Copyright Microsoft Corporation. // This source is subject to the Microsoft Permissive License. // See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. // All other rights reserved. // Script objects that should be loaded before we run var typeDependencies = ['AtlasControlToolkit.DynamicPopulateBehavior']; // Test Harness var testHarness = null; var panel1, panel2, dp1, dp2; var webServiceResult, scriptResult, customResult; function fireUpdate(targetId) { var target = testHarness.getElement(targetId); testHarness.fireEvent(target, 'onclick'); } function webServiceComplete() { return webServiceResult; } function scriptComplete() { return scriptResult; } function customComplete() { return customResult; } function webServiceSuccess() { testHarness.assertEqual(webServiceResult, "Web Service Success", "Web service call failed: " + webServiceResult); return true; } function scriptSuccess() { testHarness.assertEqual(scriptResult, "Script Success", "Script call failed: " + scriptResult); return true; } function customSuccess() { testHarness.assertEqual(customResult, "Custom Success", "DOM call failed: " + customResult); return true; } function onWebServicePopulated(s, e) { webServiceResult = panel1.innerHTML; } function onScriptPopulated(s, e) { scriptResult = panel2.innerHTML; } function onCustomPopulated(s, e) { customResult = panel1.innerHTML; } function testCustom() { dp1.populated.remove(onWebServicePopulated); dp1.populated.add(onCustomPopulated); dp1.populate("Custom Fail 1"); dp1.populate("Custom Fail 2"); dp1.populate("Custom Success"); } // Register the tests function registerTests(harness) { testHarness = harness; // Get the controls on the page panel1 = testHarness.getElement('ctl00_ContentPlaceHolder1_Panel1'); panel2 = testHarness.getElement('ctl00_ContentPlaceHolder1_Panel2'); dp1 = testHarness.getObject('dp1'); dp1.populated.add(onWebServicePopulated); dp2 = testHarness.getObject('dp2'); dp2.populated.add(onScriptPopulated); var test = testHarness.addTest('Test Page Method'); test.addStep(function(){fireUpdate('ctl00_ContentPlaceHolder1_Label1');}, webServiceComplete, webServiceSuccess); var test = testHarness.addTest('Test Script Method'); test.addStep(function(){fireUpdate('ctl00_ContentPlaceHolder1_Label2');}, scriptComplete, scriptSuccess); var test = testHarness.addTest('Test Custom'); test.addStep(testCustom, customComplete, customSuccess); }var PageMethods = new function() {var cm=Sys.Net.PageMethod.createProxyMethod;cm(this,"GetHtml","contextKey");}
But still an error... Could there be something wrong with the WebService? An Error 500 is a bit hard to work with. For developing the WebService I just took the ASP.NET WebService-template. I've uploaded the WebService in a folder under the Default Web Site, as you can see in the servicepath. As I mentioned earlier the WebService is working fine if I just manually inputs the path into the browser, also I've checked that the WebMethod satifyes the required signature!
Kind regards
i had the same problem with ajax-toolkit and cascadingdropdown-extender (which is calling a local webservice).
--> WebService call failed: 500
as soon as i deleted the attribute enableBrowserAccess="true" inside <webservice>-section, everything worked as expected. !?
No comments:
Post a Comment