Search Results

Search found 47 results on 2 pages for 'webmethods'.

Page 1/2 | 1 2  | Next Page >

  • JQuery, ASCX and webmethods not seems to be working

    - by Karthik K
    Hi all, I have a cascading dropdown (3 of them) Type, Categories and Sub Categories. Type loads first and upon selection of Type, Category load and selection of Category, Sub Category loads. Also i have 2 buttons, "Add Category" and "Add Sub Category" Upon clicking on these buttons, i call a JQuery Modal Form to add them. I use Webmethod in code behind to add them to database This works perfectly in ASPX page. Since I need use this in 3-4 pages, i thought of making the above as User control (ASCX). When i try to use this in a webpage, the webmethods in ASCX don't get called. Is my approach correct? what should be done for my scenario lOoking forward for your suggestions. Thanks in advance Karthik

    Read the article

  • Programmatically call webmethods in C#

    - by hancock
    I'm trying to write a function that can call a webmethod from a webserive given the method's name and URL of the webservice. I've found some code on a blog that does this just fine except for one detail. It requires that the request XML be provided as well. The goal here is to get the request XML template from the webservice itself. I'm sure this is possible somehow because I can see both the request and response XML templates if I access a webservice's URL in my browser. This is the code which calls the webmethod programmatically: XmlDocument doc = new XmlDocument(); //this is the problem. I need to get this automatically doc.Load("../../request.xml"); HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://localhost/dummyws/dummyws.asmx?op=HelloWorld"); req.ContentType = "text/xml;charset=\"utf-8\""; req.Accept = "text/xml"; req.Method = "POST"; Stream stm = req.GetRequestStream(); doc.Save(stm); stm.Close(); WebResponse resp = req.GetResponse(); stm = resp.GetResponseStream(); StreamReader r = new StreamReader(stm); Console.WriteLine(r.ReadToEnd());

    Read the article

  • JQuery ajax call to httpget webmethod (c#) not working

    - by Tim Jarvis
    I am trying to get an ajax get to a webmethod in code behind. The problem is I keep getting the error "parserror" from the JQuery onfail method. If I change the GET to a POST everything works fine. Please see my code below. Ajax Call <script type="text/javascript"> var id = "li1234"; function AjaxGet() { $.ajax({ type: "GET", url: "webmethods.aspx/AjaxGet", data: "{ 'id' : '" + id + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: false, success: function(msg) { alert("success"); }, error: function(msg, text) { alert(text); } }); } </script> Code Behind [System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod(UseHttpGet = true, ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)] public static string AjaxGet(string id) { return id; } Web.config <webServices> <protocols> <add name="HttpGet"/> </protocols> </webServices> The URL being used ......../webmethods.aspx/AjaxGet?{%20%27id%27%20:%20%27li1234%27} As part of the response it is returning the html for the page webmethods. Any help will be greatly appreciated.

    Read the article

  • Calling WebMethods / WebService using jquery is blocking

    - by Sir Psycho
    Hi, I'm generating a file on the server which takes some time. For this, I have a hidden iframe which I then set the .src attribute to an aspx file i.e iframe.src = "/downloadFile.aspx" While this is taking place, I'd like to have a call to a web service return the progress. To do this, I thought I could use window.setInterval or window.setTimeout but Javascript seems to be blocked as soon as I set the iframe src attribute. Does anyone know how to get around this or perhaps try a different approach? I have also tried handlers, but the request never gets to the server so I'm assuming is a browser/javascript issue.

    Read the article

  • How to access WebMethods in ASP.NET

    - by Quandary
    When i define an AJAX WebMethod like this in an ASPX page (ui.aspx): [System.Web.Services.WebMethod(Description = "Get Import Progress-Report")] [System.Web.Script.Services.ScriptMethod(UseHttpGet = false, ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)] public static string GetProgress() { System.Web.Script.Serialization.JavaScriptSerializer JSONserializer = new System.Web.Script.Serialization.JavaScriptSerializer(); return JSONserializer.Serialize("an Object/Instance here"); } // End WebMethod-Function GetProgress Can I access the description for the corresponding service somewhere ? E.g. when I want to call the webmethod with my own JavaScript, how do I do that ? I investigated the axd files, and found the xmlhttprequest to open ui.aspx/GetProgress But when I type the address in my browser, I get redirected to ui.aspx

    Read the article

  • Best practice when using WebMethods and session

    - by Abdel Olakara
    Hi all, I want to reduce postback in one of my application page and use ajax instead. I used the WebMethod to do so.. I have a static WebMethod that needs to access the session variables and modify. and on the client side, i am calling this method using jQuery. I tried accessing the session as follows: [WebMethod] public static void TestWebMethod() { if (HttpContext.Current.Session["pitems"] != null) { log.Debug("Using the existing list"); Product prod = (Product)HttpContext.Current.Session["pitems"]; List<Configs> confs = cart.GetConfigs(); foreach (Configs citem in confis) { log.Info(citem.Description); } } log.Info("Inside the method!"); } The values are displayed correctly and seems to work.. but i would like to know if this practice is allowed as the method is a static methods and would like to know how it will behave if multiple people access the application. I would also like to know how developers do these kind of tasks in ASP if this is not the right method. Thanks in advance for your suggestions and ideas, Abdel Olakara

    Read the article

  • Use python decorators on class methods and subclass methods

    - by AlexH
    Goal: Make it possible to decorate class methods. When a class method gets decorated, it gets stored in a dictionary so that other class methods can reference it by a string name. Motivation: I want to implement the equivalent of ASP.Net's WebMethods. I am building this on top of google app engine, but that does not affect the point of difficulty that I am having. How it Would look if it worked: class UsefulClass(WebmethodBaseClass): def someMethod(self, blah): print(blah) @webmethod def webby(self, blah): print(blah) # the implementation of this class could be completely different, it does not matter # the only important thing is having access to the web methods defined in sub classes class WebmethodBaseClass(): def post(self, methodName): webmethods[methodName]("kapow") ... a = UsefulClass() a.post("someMethod") # should error a.post("webby") # prints "kapow" There could be other ways to go about this. I am very open to suggestions

    Read the article

  • string extension method - Not available through WebMethod

    - by Peter Bridger
    I've written a simple extension method for a web project, it sits in a class file called StringExtensions.cs which contains the following code: using System; using System.Collections.Generic; using System.Linq; using System.Web; /// <summary> /// Useful extensions for string /// </summary> static class StringExtensions { /// <summary> /// Is string empty /// </summary> /// <param name="value"></param> /// <returns></returns> public static bool IsEmpty(this string value) { return value.Trim().Length == 0; } } I can access this extension method from all the classes I have within the App_Code directory. However I have a web page called JSON.aspx that contains a series of [WebMethods] - within these I cannot see the extension method - I must be missing something very obvious!

    Read the article

  • Passing jQuery object and WebMethod return value to an OnSuccess function

    - by iboeno
    I am calling a WebMethod from this code: if($(this).attr("checked")) { .. MyWebMethod(variable1, variable2, onSuccessFunction); } The MyWebMethod returns an integer, and I want to set $(this).attr("id") of the jQuery object above to the returned integer. Basically, I'm trying to do the equivalent of an MVC Ajax.ActionLink...AjaxOptions {UpdateTargetID =...} However, I can't figure out how to get both a reference to $(this) as well as the returned value. For example, if I do: MyWebMethod(variable1, variable2, onSuccessFunction($(this))); I can succesfully manipulate the jQuery object, but obviously it doesn't have the return value from the MyWebMethod. Alternatively, the first code block with a method signature of onSuccessFunction(returnValue) has the correct return value from MyWebMethod, but no concept of the jQuery object I'm looking for. Am I going about this all wrong?

    Read the article

  • i want to send 20000 messages from JMeter to JMS Queue through web methods and get/capture responses

    - by sam
    Blockquote Hi i'm trying to post JMS messages to JMS queue through web methods,JNDI. i want to post 20000 messages using one connection. i want to read the responses back once returned by wMethods. i want to capture the request & response for all 20000 messages i'm using JMeter is there any other opensource, easily usable tool available for this testing? thanks in advance. regards, Sam Blockquote

    Read the article

  • ASP.NET Client to Server communication

    - by Nelson
    Can you help me make sense of all the different ways to communicate from browser to client in ASP.NET? I have made this a community wiki so feel free to edit my post to improve it. Specifically, I'm trying to understand in which scenario to use each one by listing how each works. I'm a little fuzzy on UpdatePanel vs CallBack (with ViewState): I know UpdatePanel always returns HTML while CallBack can return JSON. Any other major differences? ...and CallBack (without ViewState) vs WebMethod. CallBack goes through most of the Page lifecycle, WebMethod doesn't. Any other major differences? IHttpHandler Custom handler for anything (page, image, etc.) Only does what you tell it to do (light server processing) Page is an implementation of IHttpHandler If you don't need what Page provides, create a custom IHttpHandler If you are using Page but overriding Render() and not generating HTML, you probably can do it with a custom IHttpHandler (e.g. writing binary data such as images) By default can use the .axd or .ashx file extensions -- both are functionally similar .ashx doesn't have any built-in endpoints, so it's preferred by convention Regular PostBack (System.Web.UI.Page : IHttpHandler) Inherits Page Full PostBack, including ViewState and HTML control values (heavy traffic) Full Page lifecycle (heavy server processing) No JavaScript required Webpage flickers/scrolls since everything is reloaded in browser Returns full page HTML (heavy traffic) UpdatePanel (Control) Control inside Page Full PostBack, including ViewState and HTML control values (heavy traffic) Full Page lifecycle (heavy server processing) Controls outside the UpdatePanel do Render(NullTextWriter) Must use ScriptManager If no client-side JavaScript, it can fall back to regular PostBack with no JavaScript (?) No flicker/scroll since it's an async call, unless it falls back to regular postback. Can be used with master pages and user controls Has built-in support for progress bar Returns HTML for controls inside UpdatePanel (medium traffic) Client CallBack (Page, System.Web.UI.ICallbackEventHandler) Inherits Page Most of Page lifecycle (heavy server processing) Takes only data you specify (light traffic) and optionally ViewState (?) (medium traffic) Client must support JavaScript and use ScriptManager No flicker/scroll since it's an async call Can be used with master pages and user controls Returns only data you specify in format you specify (e.g. JSON, XML...) (?) (light traffic) WebMethod Class implements System.Web.Service.WebService HttpContext available through this.Context Takes only data you specify (light traffic) Server only runs the called method (light server processing) Client must support JavaScript No flicker/scroll since it's an async call Can be used with master pages and user controls Returns only data you specify, typically JSON (light traffic) Can create instance of server control to render HTML and sent back as string, but events, paging in GridView, etc. won't work PageMethods Essentially a WebMethod contained in the Page class, so most of WebMethod's bullet's apply Method must be public static, therefore no Page instance accessible HttpContext available through HttpContext.Current Accessed directly by URL Page.aspx/MethodName (e.g. with XMLHttpRequest directly or with library such as jQuery) Setting ScriptManager property EnablePageMethods="True" generates a JavaScript proxy for each WebMethod Cannot be used directly in user controls with master pages and user controls Any others?

    Read the article

  • JavaScript: How to get the instance name of an object

    - by Quandary
    I use the below code to write code to query a web method in a specified interval. now in the this.Poll function I have to do this.tmo = setTimeout(this.strInstanceName + ".Poll()", this.iInterval); instead of this.tmo = setTimeout(this.Poll(), this.iInterval); because IE looses the this object after setTimeout So I have to pass the class it's instance name: var objPoll = new cPoll("objPoll"); How can I get the instance name without passing it as parameter ? I want to have it outta there ! <!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> <title>Intervall-Test</title> <script type="text/javascript" language="javascript"> function test() { alert("Test"); test.tmo = setTimeout(test, 2000); test.Clear = function() { clearTimeout(test.tmo); } } function cPoll(strInstanceName) { this.strInstanceName = strInstanceName ; this.iInterval = 2000; this.tmo=null; this.cbFunction=null; alert(this.Name ); this.Poll = function() { this.cbFunction(); this.tmo = setTimeout(this.strInstanceName + ".Poll()", this.iInterval); } this.Start = function(pCallBackFunction, iIntervalParameter) { if(this.tmo != null) this.Stop(); if(iIntervalParameter && iIntervalParameter > 0) this.iInterval=iIntervalParameter; this.cbFunction=pCallBackFunction; if(this.cbFunction!=null) this.Poll(); else alert("Invalid or no callback function specified"); } this.Stop = function() { if(this.tmo != null) { clearTimeout(this.tmo); this.tmo=null; } } } function CallBackFunction() { alert("PollCallBack"); } // test(); // test.Clear(); var objPoll = new cPoll("objPoll"); </script> </head> <body> <h1>Test</h1> <input type="Button" value="Start polling" onclick="objPoll.Start(CallBackFunction,3000);" /> <input type="Button" value="Stop polling" onclick="objPoll.Stop();" /> </body> </html>

    Read the article

  • How do I avoid web method parameters using proxy classes?

    - by Alex Angas
    I have a serializable POCO called DataUnification.ClientData.ClientInfo in a .NET class library project A. It's used in a parameter for a web service defined in project B: public XmlDocument CreateNewClient(ClientInfo ci, string system) I now wish to call this web method from project C and use the original DataUnification.ClientData.ClientInfo type in the parameter. However due to the generated proxy class it has now become a different type: WebServices.ClientDataUnification.DataUnificationWebService.ClientInfo. As far as .NET is concerned these are not the same types. How can I get around this?

    Read the article

  • ASP.NET WebMethod Returns JSON wrapped in quotes

    - by CL4NCY
    Hi, I have an asp.net page with a WebMethod on it to pass JSON back to my javascript. Bellow is the web method: [WebMethod] public static string getData(Dictionary<string, string> d) { string response = "{ \"firstname\": \"John\", \"lastname\": \"Smith\" }"; return response; } When this is returned to the client it is formatted as follows: { \"d\": \"{ \"firstname\": \"John\", \"lastname\": \"Smith\" }\" } The problem is the double quotes wrapping everything under 'd'. Is there something I've missed in the web method or some other means of returning the data without the quotes? I don't really want to be stripping it out on the client everytime. Also I've seen other articles where this doesn't happen. Any help would be appreciated thanks.

    Read the article

  • Error when passing quotes to webservice by AJAX

    - by Radu
    I'm passing data using .ajax and here are my data and contentType attributes: data: '{ "UserInput" : "' + $('#txtInput').val() + '","Options" : { "Foo1":' + bar1 + ', "Foo2":' + Bar2 + ', "Flags":"' + flags + '", "Immunity":' + immunity + '}}', contentType: 'application/json; charset=utf-8', Server side my code looks like this: <WebMethod()> _ Public Shared Function ParseData(ByVal UserInput As String, ByVal Options As Options) As String The userinput is obvious but the Options structure is like the following: Public Structure Options Dim Foo1 As Boolean Dim Foo2 As Boolean Dim Flags As String Dim Immunity As Integer End Structure Everything works fine when $('#txtInput') contains no double-quotes but if they are present I get an error (for an input of asd"): {"Message":"Invalid object passed in, \u0027:\u0027 or \u0027}\u0027 expected. (22): { \"UserInput\" : \"asd\"\",\"Options\" : { \"Foo1\":false, \"Foo2\":false, \"Flags\":\"\", \"Immunity\":0}}","StackTrace":" at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32 depth)\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"} Any idea how I can avoid this error? Also, when I pass the same input with quotes directly it works fine.

    Read the article

  • What happens to orphaned/killed async AJAX WebMethod or PageMethod calls?

    - by Armchair Bronco
    What happens behind the scenes if I make an AJAX PageMethod or WebMethod call from, say, "Default.aspx" and then I quickly navigate away to a different page, say, "Settings.aspx" before the initial PageMethod has returned? What kind of housekeeping, if any, takes place on either the browser or the ASP.NET back end? In other words, where do abandoned AJAX PageMethod calls go to die...and what is their funeral like?

    Read the article

  • WebMethod Return xml

    - by BabelFish
    I keep reading how everyone states to return XmlDocument when you want to return XML. Is there a way to return raw XML as a string? I have used many web services (written by others) that return string and the string contains XML. If you return XmlDocument how is that method consumed by users that are not on .Net? What is the method to just return the raw XML as string without it having being wrapped with <string></string> Thanks!

    Read the article

  • how to call 2 webmethods from a single webservice in a single activity in android?

    - by Jassi
    hello, I am new in android. i am able to called single webmethod from a .net webservice. i am usuing ksoap2 to implement soap. But in my .net webservice there are many web methods. I want to call more than one web methods. So please give some idea on this matter. Even i have tried by taking 2 soap_action and 2 method_name with single namespace then it works in first request but in 2nd request it gives xmlpullparserException error. thanx in advance,

    Read the article

  • Should I implement BackBone.js into my ASP.NET WebForms applications?

    - by Walter Stabosz
    Background I'm trying to improve my group's current web app development pattern. Our current pattern is something we came up with while trying to rich web apps on top of ASP.NET WebForms (none of us knew ASP.NET MVC). This is the current pattern: ! Our application is using the WinForms Framework. Our ASPX pages are essentially just HTML, we use almost no WebControls. We use JavaScript/jQuery to perform all of our UI events and AJAX calls. For a single ASPX page, we have a single .js file. All of our AJAX calls are POSTs (not RESTful at all) Our AJAX calls contact WebMethods which we have defined in a series of ASMX files. One ASMX file per business object. Why Change? I want to revise our pattern a bit for a couple of reasons: We're starting to find that our JavaScript files are getting a bit unwieldy. We're using a hodgepodge of methods for keeping our local data and DOM updates in sync. We seem to spend too much time writing code to keep things in sync, and it can get tricky to debug. I've been reading Developing Backbone.js Applications and I like a lot of what Backbone has to offer in terms of code organization and separation of concerns. However, I've gotten to the chapter on RESTful app, I started to feel some hesitation about using Backbone. The Problem The problem is our WebMethods do not really fit into the RESTful pattern, which seems to be the way Backbone wants to consume them. For now, I'd only like to address our issue of disorganized client side code. I'd like to avoid major rewrites to our WebMethods. My Questions Is it possible to use Backbone (or a similar library) to clean up our client code, while not majorly impacting our data access WebMethods? Or would trying to use Backbone in this manner be a bastardization of it's intended use? Anyone have any suggestions for improving our pattern in the area of code organization and spending less time writing DOM and data sync code?

    Read the article

  • How to set WCF threads to schedual differently

    - by Gilad
    Hi, I'm running a winservice that has 2 main objectives. Execute/Handle exposed webmethods. Run Inner processes that consume allot of CPU. The problem is that when I execute many inner processes |(as tasks) that are queued to the threadpool or taskpool, the execution of the webmethods takes much more time as WCF also queues its executions to the same threadpool. This even happens when setting the inner processes task priority to lowest and setting the webmethods thread priority to heights. I hoped that Framework 4.0 would improve this, and they have, but still it takes quite allot of time for the system to handle the WCF queued tasks if the CPU is handling other inner tasks. Is it possible to change the Threadpool that WCF uses to a different one? Is it possible to manually change the task queue (global task queue, local task queue). Is it possible to manually handle 2 task queues that behave differently ? Any help in the subject would be appropriated. Gilad.

    Read the article

1 2  | Next Page >