?
Solved

What do WebMethod Attribute do exactly in Dot.Net

Posted on 2007-11-13
4
Medium Priority
?
1,061 Views
Last Modified: 2013-11-07
I read some articles about basics of Attributes in net. But I do not get a pretty good understanding of how to use them instead of putting some information into assebly. There are some attributes I see like when creating a web service. [WebMethod]
What does it do?
0
Comment
Question by:karanba
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 20275114
when web service is called, it calls only one method out of all methods for that particular web service. [WebMethod] prefix defines which one of the methods will be the default method for that web service
0
 
LVL 18

Accepted Solution

by:
mdougan earned 2000 total points
ID: 20275117
Webmethod tells the compiler to make this method visible when people query the WSDL to see what methods are available to call in your Webservice.

So, any method that you want someone to be able to call in your webservice needs to have this attribute.  If some method inside your webservice needs to call another method inside the webservice, then that method doesn't need the attribute, because it doesn't have to be visible to the outside world.
0
 
LVL 35

Expert Comment

by:YZlat
ID: 20275141
In other words [WebMethod] prefix marks the function as the one being exposed by the web service
0
 
LVL 18

Expert Comment

by:mdougan
ID: 20275145
You can define more than one Webmethod in a webservice.  Any method that you'd like to be able to call from outside the webservice, can be declared with Webmethod.  If you define more than one, I'm not sure which would be considered the "default" though.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question