| | |
Unable to access asp.net web service from javascript
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2008
Posts: 35
Reputation:
Solved Threads: 3
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.
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
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.
•
•
Join Date: Feb 2009
Posts: 12
Reputation:
Solved Threads: 1
What if:
1. you first create the follwing in the web.config file
2. Then you add
3. in the page load method:
Will this help?
/Frank
1. you first create the follwing in the web.config file
xml Syntax (Toggle Plain Text)
<appSettings> <add key="servicePath" value="http://yourmachin/MyService/Service.asmx"/> </appSettings>
using System.Configuration; in the source file3. in the page load method:
ASP.NET Syntax (Toggle Plain Text)
protected void Page_Load(object sender, EventArgs e) { ScriptManager1.Services.Add(new ServiceReference(ConfigurationManager.AppSettings["servicePath"].ToString())); }
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.
•
•
Join Date: Jan 2008
Posts: 35
Reputation:
Solved Threads: 3
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
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
•
•
Join Date: Feb 2009
Posts: 12
Reputation:
Solved Threads: 1
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
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
Frank
![]() |
Similar Threads
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
- rootmap help??urgent plz.. (PHP)
Other Threads in the ASP.NET Forum
- Previous Thread: no output
- Next Thread: Dynamic page set up
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox click commonfunctions compatible confirmationcodegeneration content contenttype courier css dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dropdownmenu edit expose flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list listbox login menu microsoft mono mouse mssql multistepregistration nameisnotdeclared news numerical objects order panelmasterpagebuttoncontrols problem radio ratings reportemail rotatepage save schoolproject search security serializesmo.table silverlight smartcard software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webprogramming webservice wizard xml youareanotmemberofthedebuggerusers





