Unable to access asp.net web service from javascript

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2008
Posts: 35
Reputation: anish.anick is an unknown quantity at this point 
Solved Threads: 3
anish.anick anish.anick is offline Offline
Light Poster

Unable to access asp.net web service from javascript

 
0
  #1
Feb 17th, 2009
Hi All,
I am having issue in calling asp.net web service from javascript. The web service resides in one of our development machine and i am trying to call the web service from my local machine. (The application works fine if the webservice resides in my local machine) The reference for webservice is added to Scriptmanager.
ScriptManager1.Services.Add(new ServiceReference("http://xxx.xxx.xx.xx/MyService/Service.asmx");
I debugged the code.. The scriptmanager takes the correct webservice reference. The client proxy files (jsdebug) are also generating correctly. But when i call the webservice it seems to take localhost as the root instead of the development machine ip (noticed using firebug). Please help me to solve this issue

Thanks
Last edited by peter_budo; Feb 19th, 2009 at 4:04 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 12
Reputation: frank@furnes.nu is an unknown quantity at this point 
Solved Threads: 1
frank@furnes.nu frank@furnes.nu is offline Offline
Newbie Poster

Re: Unable to access asp.net web service from javascript

 
0
  #2
Feb 17th, 2009
What if:
1. you first create the follwing in the web.config file
  1. <appSettings>
  2. <add key="servicePath" value="http://yourmachin/MyService/Service.asmx"/>
  3. </appSettings>
2. Then you add
using System.Configuration; in the source file
3. in the page load method:
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. ScriptManager1.Services.Add(new ServiceReference(ConfigurationManager.AppSettings["servicePath"].ToString()));
  4. }

Will this help?

/Frank
Last edited by peter_budo; Feb 19th, 2009 at 4:05 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 35
Reputation: anish.anick is an unknown quantity at this point 
Solved Threads: 3
anish.anick anish.anick is offline Offline
Light Poster

Re: Unable to access asp.net web service from javascript

 
0
  #3
Feb 18th, 2009
Hi Frank,
I am also doing the same procedure. While debugging i can see that the ScriptManager takes the correct webservice path as in the webconfig file. The scriptmanager also creates the client proxy files correctly. But once the page gets loaded in the browser the web service URL is changed back to localhost instead of the development machine URL ("http://xxx.xxx.xx.xx/.....") . I can also see that the URL is correctly redendered in the source file.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 12
Reputation: frank@furnes.nu is an unknown quantity at this point 
Solved Threads: 1
frank@furnes.nu frank@furnes.nu is offline Offline
Newbie Poster

Re: Unable to access asp.net web service from javascript

 
0
  #4
Feb 18th, 2009
Hi Again
It seems like you have to create a webservice wrapper, when calling "external" webservices with ajax

I found some info on these sites:
http://msdn.microsoft.com/en-us/magazine/cc163499.aspx
http://www.developer.com/net/asp/art...0917_3657826_4
http://forums.asp.net/t/1111617.aspx

Hope this helps
/Regards
Frank
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC