using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using umbraco.presentation.nodeFactory;
namespace ParvusProductSearch { /// <summary> /// Summary description for WebService1 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] public class WebService1 : System.Web.Services.WebService {
[WebMethod] public string[] GetNames(string prefixText) { List<String> namn = new List<String>(); Node node = new umbraco.presentation.nodeFactory.Node(1079); foreach (Node child in node.Children) { foreach (Node child2 in child.Children) {
I have not got this working yet. Im thinking that the webservice is not found(placed in the usercontrol folder along with the ascx file with this ServicePath="~/WebService1.asmx" in the ascx
Other things ive tried with without further success:
1. Uncommented this line: // [System.Web.Script.Services.ScriptService]. It's needed.
2. Used this signature: publicstring[]GetNames(string prefixText, int count)
I'm having a similar problem. Did you ever get it to work? I've also tried moving the webservice file to the /build folder as it is referenced in my usercontrol as ServicePath="~/Webservice.asmx". This does not fire the webservice either.
Don't have much experience with this, but are you able to access the webservice directly in your browser? You might need to exclude it from Umbraco's handlers in the web.config (key umbracoReservedUrls I believe) or place it in the umbraco folder as this is excluded already. Also, wouldn't /WebService.asmx look on the root of the site, so in that case shouldn't the webservice be placed in the root (/)?
Tom, thank you. Accessing it directly enabled me to spot a bug, which once fixed meant I could properly access it in the browser...and also then worked properly from the UserControl on the Umbraco page. The /build folder is indeed my site root, so yes the webservice is in the root (not sure if this is a good idea or not), but it all works fine now without modifying umbracoReservedUrls.
Can't get this to work properly, what's the problem? (Usercontrol, Ajax, Webservice)
I'm trying to create a Autocomplete search in Ajax using ajax toolkit 4.
I get no errors with the following code but the control does not work at all.
Ascx and asmx are placed in the usercontrol folder and the dll in the bin folder.
As I see it there could be two possible problems:
ascx.cs file
ascx markup
Webservice
I have not got this working yet. Im thinking that the webservice is not found(placed in the usercontrol folder along with the ascx file with this ServicePath="~/WebService1.asmx" in the ascx
Other things ive tried with without further success:
1. Uncommented this line: // [System.Web.Script.Services.ScriptService]. It's needed.
2. Used this signature: public string[] GetNames(string prefixText, int count)
3. Removed this: UseContextKey="True"
I'm having a similar problem. Did you ever get it to work? I've also tried moving the webservice file to the /build folder as it is referenced in my usercontrol as ServicePath="~/Webservice.asmx". This does not fire the webservice either.
cheers
Rory
Don't have much experience with this, but are you able to access the webservice directly in your browser? You might need to exclude it from Umbraco's handlers in the web.config (key umbracoReservedUrls I believe) or place it in the umbraco folder as this is excluded already. Also, wouldn't /WebService.asmx look on the root of the site, so in that case shouldn't the webservice be placed in the root (/)?
Tom, thank you. Accessing it directly enabled me to spot a bug, which once fixed meant I could properly access it in the browser...and also then worked properly from the UserControl on the Umbraco page. The /build folder is indeed my site root, so yes the webservice is in the root (not sure if this is a good idea or not), but it all works fine now without modifying umbracoReservedUrls.
Thanks
Rory
is working on a reply...