473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Can a WebMethod be static?

Hi

I have a utility class that I now want to expose via Web Services (using an
empty .asmx file that simply references this assembly).

I decorated the methods that need to be exposed with the WebMethod attribute
(they are static). I also created a public default constructor. But none of
those methods show up in the Web Service description.

So can a Web Method be static?

TIA
PB.
May 8 '07 #1
4 5692
"PB" <PB@discussions.microsoft.comwrote in message
news:B1**********************************@microsof t.com...
Hi

I have a utility class that I now want to expose via Web Services (using
an
empty .asmx file that simply references this assembly).

I decorated the methods that need to be exposed with the WebMethod
attribute
(they are static). I also created a public default constructor. But none
of
those methods show up in the Web Service description.

So can a Web Method be static?
No.
--
John Saunders [MVP]
May 8 '07 #2
Thanks!

So a possible solution would be to create a "Wrapper" instance class that
calls into the static methods and then expose that Class/Methods?

PB.

"John Saunders [MVP]" wrote:
"PB" <PB@discussions.microsoft.comwrote in message
news:B1**********************************@microsof t.com...
Hi

I have a utility class that I now want to expose via Web Services (using
an
empty .asmx file that simply references this assembly).

I decorated the methods that need to be exposed with the WebMethod
attribute
(they are static). I also created a public default constructor. But none
of
those methods show up in the Web Service description.

So can a Web Method be static?

No.
--
John Saunders [MVP]
May 8 '07 #3
"PB" <PB@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
Thanks!

So a possible solution would be to create a "Wrapper" instance class that
calls into the static methods and then expose that Class/Methods?
Yes. That would work.
--
John Saunders [MVP]
May 8 '07 #4
probably a stupid question but neverthless can someone explain why webmethod
cannot be static?

May 9 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Alin Popovici | last post by:
Hi! I have this problem. I am sending as a parameter for a webmethod a string containing '\r\n' sequences. For some reason, when I debug my webmethod, the paramter is received with the carriage...
2
by: Peter McEvoy | last post by:
Folks, I've been building a Webservice API for a contract that will be exposed to the internet at large. There are two endpoints, and each endpoint contains a number of webmethods. Every...
4
by: MattBell | last post by:
I've tried to search for an answer to this without much success, and I think it's probably a common thing to do: I have a web service I want to accept an XmlDocument as an argument which conforms...
1
by: spicyz | last post by:
I'm receiving an exception when my webmethod exits after opening/closing an Access database. I can reproduce this easily enough by creating a new default ASP .NET Web Service in VS.NET 2003. ...
2
by: jojoba | last post by:
Hello to all! I have a fairly simple webservice running in asp.net ajax under c# (vs 2008). I built the service and it runs just dandy when i test it by itself in visual studio. However, to...
0
by: omer013 | last post by:
Hi; I have an aspx page with a WebMethod to redirect the user to another page. The Default.aspx.cs is; public partial class _Default : System.Web.UI.Page { public static void...
2
by: Rory Becker | last post by:
I have been testing a beta feature in Coderush (CodeIssues) which has prompted me with the suggestion that one of my WebMethods in a Webservice, could be Shared/Static and is not. I have never...
5
by: Jeff | last post by:
hi asp.net 2.0 The webmethod below don't get called. I'm not sure what I do wrong here. I think it's something to with the parameters. The GetCompletionList takes 2 parameters. I don't set...
0
by: anithaapr05 | last post by:
Dear All, I have try to call the webmethod inside a master page browser close javascript function.It not working. This is my scriptcode: function BrowserClose() { var getValues =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.