Click here to Skip to main content
15,920,513 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi ALL,

How many ways we can call webmehod in web service?
Which is the best way ?


Thanks and Regards,
Anilkumar.M
Posted
Updated 9-Jan-13 2:04am
v2
Comments
bbirajdar 9-Jan-13 7:52am    
what ?
ajay.anilmaddi 9-Jan-13 8:05am    
How to call the Webservice(WebMethods)?
ZurdoDev 9-Jan-13 8:28am    
There is no best way, that depends on what you are doing. Can you be more clear on exactly what you need?

1 solution

If the web service is basic asmx web serivce,then you can use WSDL.exe tool to create client proxy class for the XML Web service and add this generated client proxy class to your project,finally you can use the web method of web service.

1,Web Services Description Language Tool (Wsdl.exe)
http://msdn.microsoft.com/en-us/library/7h3ystb6(v=vs.71).aspx

As suresh_g_v2002 mentioned, you can also call Web Service or WCF REST Service asynchronously using ScriptManager.

2,Consuming a WCF / ASMX / REST Service using jQuery
Consuming a WCF / ASMX / REST Service using jQuery

If the web service is ordinary WCF service,you can directly add service reference within the project explorer or use svcutil.exe to generate client proxy class.

and

In .Net without adding reference to the project we can call in the following ways

1. Using HttpWebRequest of System.Net namspace..,

2. We can also call webservice asynchronously using Scriptmanager.

[ Bit of googling can solve the problem ]
 
Share this answer
 
Comments
fjdiewornncalwe 9-Jan-13 9:15am    
+5.
[no name] 9-Jan-13 9:17am    
Thanks Marcus...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900