Click here to Skip to main content
12,621,424 members (30,005 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET C#4.0
Hi ALL,

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


Thanks and Regards,
Anilkumar.M
Posted 9-Jan-13 2:48am
Updated 9-Jan-13 3:04am
v2
Comments
aspnet_regiis -i 9-Jan-13 7:52am
   
what ?
ajay.anilmaddi 9-Jan-13 8:05am
   
How to call the Webservice(WebMethods)?
ryanb31 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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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 ]
  Permalink  
Comments
Marcus Kramer 9-Jan-13 9:15am
   
+5.
Krunal Rohit 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.161128.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100