Consuming Web service from .net 3.5 web application using ajax

Hi , Before in .net 2005 ,I use to consume the  web service from client side via Ajax and java script. that's just adding web service inside the script manger services.

But  it was not possible with .net 2008 version WEB APPLICATION   , Even it works well with .net 2008 web sites.

 Please help me to solve the issue.

0
maheshwaran
11/19/2008 10:54:48 AM
asp.net.client-side 24353 articles. 1 followers. Follow

5 Replies
1332 Views

Similar Articles

[PageSpeed] 54

I have no idea what you mean. Please post the code that "does not work".

NC...

 

0
NC01
11/19/2008 2:34:49 PM

I have the same problem.  I have a .NET 3.5 Web Application not Web Site.  I fully qualify the web service with the namespace i,e,

    ClientServices.ControlServer.HelloWorld(controlName, SucceededCallbackWithContext, FailedCallback, HTMLtarget);

The webservice it self is decorated with the ScriptService and the WebMethod is decorated with the WebMethod and the ScriptMethod attributes:

        [System.Web.Script.Services.ScriptMethod(ResponseFormat=System.Web.Script.Services.ResponseFormat.Xml,UseHttpGet=true,XmlSerializeString=true)]
        [WebMethod]
        public string HelloWorld(string message)
        {
            return message;
        }

I register the script and the service in the script manager.  I then trigger the function and get the javascript error of 'ClientServices' is not defined

p.s. not sure if this is an IE8.0 bug with the asp.net forum but if you scroll while making a quick reply so it is out of view you lose everything you have just written


Cheers,

Andrew
Blog : andrewrea.co.uk
0
REA_ANDREW
11/19/2008 3:57:44 PM

  Here the error was, 

   To use the web service in java script i use the below code,

   <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Services>
                <asp:ServiceReference Path="MySampleService.asmx" />
            </Services>
        </asp:ScriptManager>

 Which called by using the statement  MySampleService.Helloworld()  in java script, Which works good in 2008 web sites but not in 2008 web applications the script error says "MySampleService was not defined"

 

0
maheshwaran
11/20/2008 4:03:36 AM

 Hi,

I have similar problem and I solved this issue .......

Just simply change the nameSpace

using System.Web.Script.Services;

 

namespace Khalid99h

{

 

    [WebService(Namespace = "http://localhost:49232/Khalid99h/")]

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    [ScriptService]

   public class Service : System.Web.Services.WebService

    {

 

    .............

//rest of your code..........

 }

 

}

 

 

Now you can access this web service like this: 

//Java script OR Code behind file

<script type="text/javascript">

 

    function CallNextDate()

    {

        Khalid99h.Service.HelloWorld( );   //assume there is a function in web service Helloworld()

    }

 </script>

 

 



Hafiz khalid nawaz
Team Lead(.NET)
eSoul consultancy pvt ltd
0
khalid99h
12/23/2008 11:00:04 AM

Hello Thank you very much i will try andlet you know

0
maheshwaran
12/23/2008 11:35:01 AM
Reply:

Similar Artilces:

Cannot call a web service from java script using ajax in .net 3.5 web applications
As like 2005 .net websites i tried to consume a web service from client side java script  using Ajax script manager in  .net 3.5 (2008) version web application it was not working, Event it works with 3.5 web sites, What i have to do to solve the issue. Thanks in advance Hi, can you create the least amount of code to reproduce it and post it? This gives us the ability to check out your code and better guide you. Also please check out this article: Create a Simple WCF Web Service and Use In JavaScript With Visual Studio 2008 and .Net 3.5.  Grz, Kris.Read my blog. Handy Fire...

Issue with clients consuming a web service that was upgraded from .NET 1.1 to .NET 3.5
I am currently working with an application that was converted from Visual Studio 2003 to Visual Studio 2008 and we are having issues with a client consuming the web service portion of the application.  The web services were written in .NET 1.1 using the Web Services Enhancements 2.0 and was upgraded to use the .NET 3.5 framework.  One of our clients application, which is still written in .NET 1.1 was reference the upgraded web service and tried to consume the web service and received the following error: System.Web.Services.Protocols.SoapException: Se...

Using .net AJAX enabled application in non .net Web Application
Hi,Does anyone have similar experience in development?  I want to check if it's possible to run .net ajax object (from one standalone .net framework platform in company) with non .net application (i.e. J2EE web application)?  It is because we want to add certain feature (i.e. office communicator chat) to our exist application (oracle J2ee). Please give me some advice :) Thanks! Hi, .Net AJAX is based on .Net Framework architecture. Thus .Net Framework currently lacks support for other platforms, such as Java. Please check this link: http://www.csharphelp.com/arch...

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

Troubleshoot Web Service; Ajax AutoComplete events do not appear to not fire; Ajax web service appears to not work. .NET
Folks, I had the situation that Ajax AutoComplete events in the web service did not fire after I copied a project out of a folder, renamed it and moved it to a server. The fix was hard to find but easy to solve. I had some web service modules in an ASMX file that provided AutoComplete entries -- i.e., after the user keys in 2 or 3 characters, the list of possible entries with those leading characters is displayed for the user to select. To solve the problem, look at the web service's directive, not the code-behind or the ASMX designer.  Do a right-mouse-click...

Issues with Ajax Web Part using .Net Framework 3.5
 Hi, I have deployed Silverlight Media Viewer WebPart (Silverlight 2 beta 2) on my SharePoint Web Application. Its working fine. But, On this SharePoint Web application, I also have some other AJAX web parts which are developed in VS 2005 with .Net Framework 3.0.When I modified the respective web.config for .Net Framework 3.5, All the other web parts started flickering. How can I stop these Ajax web Parts from flickering? Please help me on this… I am in really need of this.  Thanks in Advance.......

Can WSE 3.0 Web Service be exposed to the web and can it be consumed by non .Net apps?
If I write a WSE 3.0 web service in .Net 2.0, can I expose it to the web like an IIS XML web service.?Also, can this web service be consumed by non .Net apps or .Net 1.1. apps?sun21170 Yes, simply enable your web service project for WSE 3, and this will alter web.config to support WSE 3 web services in IIS.The web service can be consumed by non .Net clients, however .Net 1.1 clients may struggle unless you add WSE support ans generate specific WSE proxies at the client end.  JamesMy Blog: http://www.wintersfamily.plus.com/blogs/JamesWinters...

Converting windows application using web service from Visual C#.net 2003 to Visual Studio.net 2005
Hello, everyone! I have a solution which contains a windows project,a web service project and several other library projects. These projects were coded under visual c#.net 2003. Now I need to converted them to use Visual Studo.net 2005. Does any one know any article providing step-by-step guide  to converting WINDOWS APPLICATION with web service? I can find one under MSDN for converting web project.  But I guess I am a little confused if mine should follow this article since I am using web service in my windows application? Thanks a lot in advance.  ...

How to get a Windows Server 2008 to run .NET 3.5 AJAX Web Applications
Hi, i'm kinda new to the .NET 3.5 framework.. I just developed a very simple web app using Visual studio 2008 beta2, choosing ASP.NET Futures AJAX. I then added a Web Reference that i call from a Silverlight control.. So far so good: i test it, and it runs locally.. I also have a Windows Server 2008 DataCenter Release candidate version, on which i used to run an ASP.NET 3.0 Web Application, that worked just fine.. But I can't figure out how to run this .net 3.5 Web App on my server: i tried installing the .NET 3.5 Framework on the server, but i still can only deploy 3.0 applications....

Deploy 3.5 web app on .NET 3.0 web server?
Hello,I am considering developing an ASP.NET app in VS 2008 using LINQ.  I know LINQ is .NET 3.5 specific but the IIS6 web server I need to deploy to only has .NET 3.0 installed (and I can't change that).So my question: can I compile and deploy a .NET 3.5 app on a web server with .NET 3.0 on it?  If so, how - and is there any official MSFT documentation? thanks,Justin Try this out it may work, if not you won't be using Linq unless they upgrade. http://linqinaction.net/blogs/main/archive/2007/09/05/linq-support-on-net-2.0.aspx- WilliamPlease mark the most helpful rep...

Consuming a .NET web service in Delphi 2010 using a service reference
Hi, I've been asked to modify one of my existing applications (D2010 Win32) to interact with a web service written under VS2010/.Net 4. The information I have so far is :- "As communication is secured by .NET WsHttpBinding data encrypting, In order to consume it you have to add to your application a Service Reference (not a web reference) that joins the service available at the URL: http://ctm.mobilling.it/SmsComApi/Sms.svc . Assuming that the binding created in your app.confing is named "WSHttpBinding_ISms" you have to instantiate a client as shown below: {c...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

How to call .net web service from Java web application?
Hi all,  I have a vb .net web service.How do i call .net web service from Java web application?What all resources I need?Can you please provide a sample application where a java application is invoking methods of .net web service? Thank you Hi, First I am not familiar with java language, but web services are universal operating system and language independent. It doesn't matter where the services is or in what language is written you just invoke it  and it gives you "replay".  Probably you must reffer to java consuming web services.   Regard...

using non .net DLL in .net web application
Is it possible to use a non .NET DLL in a .NET web application ?I have a vb.net web application, and I am thinking of purchasing a pascal DLL to use in it.  I am not sure if its possible, or if there are any downsides?  I really don't want to run anything that could cause any problems or complications.Thanks! mike123 Yes, it's perfectly possible to use non-.NET DLLs. The way to do it is called Interop. If you Google for that, you'll find plenty on it.  just add reference ... compile ....and use...Please click Mark as Answer on this post if it helps y...

Web resources about - Consuming Web service from .net 3.5 web application using ajax - asp.net.client-side

Application - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Pre-Christmas job application rush hits Australian public service
Speed required for pre-Christmas job window opening for public servants. Check out who is hiring.

Cloud application adoption increases 71 percent in 2015
The adoption of cloud applications is soaring, up by 71 percent in the last year according to the results of a new survey. The latest Cloud ...

Tashfeen Malik's visa application under scrutiny - Business Insider Deutschland
The US government has released the visa application for Tashfeen Malik, who along with her husband killed 14 people in an attack in San Bernardino, ...

MBA: Mortgage Applications Increase in Latest MBA Weekly Survey, Purchase Applications up 37% YoY
From the MBA: Refinance, Purchase Applications Both Up in Latest MBA Weekly Survey Mortgage applications increased 7.3 percent from one week ...

German-Based Spirea Promotes Decentralized PV Applications In Uruguay
... Its technical operations specialist, Laurie Lawrence, pointed out that Uruguay [&hellip German-Based Spirea Promotes Decentralized PV Applications ...

Visa application of San Bernardino shooter released
CNN Visa application of San Bernardino shooter released CNN (CNN) The visa application of one of the San Bernardino shooters was released ...

ZTE to develop smartphone application processors in house
ZTE has stepped up its efforts to internally develop smartphone chipset solutions, aiming to re-capture the title as one of the top-three smartphone ...

Pre-K Applications Begin Jan 25, a Month Earlier Than Last Year, City Says
The DOE has moved the process up to Jan. 25 on the heels of a similar schedule shift for kindergarten. MANHATTAN — The application period for ...

NASA accepting applications for the position of 'astronaut'
Wanted ads aren't usually newsworthy, unless the company is NASA and the job is "going to space." The US space agency has started recruiting ...

Resources last updated: 12/23/2015 3:18:41 PM