Click here to Skip to main content
11,570,352 members (57,786 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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 1:48am
Edited 9-Jan-13 2:04am
v2
Comments
aspnet_regiis -i at 9-Jan-13 7:52am
   
what ?
ajay.anilmaddi at 9-Jan-13 8:05am
   
How to call the Webservice(WebMethods)?
ryanb31 at 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 at 9-Jan-13 9:15am
   
+5.
Krunal Rohit at 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


Advertise | Privacy | Mobile
Web04 | 2.8.150624.2 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2015
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