Order of webmethods

Hi,
I've whole bunch of web methods in my web service and they are all appearing in random order instead of the order specified in the cs file. Can somebody tell me if there is any attribute or setting that will let us specify the order, please? Thanks for your time!

Regards,
Swamy

[295 byte] By [SwamyKanakala] at [2008-3-5]
# 1
Hi,

Can you specify your methods names? I created some 4 sample methods and they appear in the same order as in .CS file.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 2

Thanks for the reply. Here are some sample methods that I used, but they are not getting displayed in order. Thanks!!
[WebMethod]

public void Site_GetProperties()

{

}

[WebMethod]

public void Site_SetProperties()

{

}

[WebMethod]

public void Site_GetNames()

{

}

[WebMethod]

public void SiteSettings_Get_ByAppName()

{

}

[WebMethod]

public void SiteSettings_Get_BySiteId()

{

}

[WebMethod]

public void SiteSettings_SetByAppName()

{

}

[WebMethod]

public void SiteSettings_SetBySiteId()

{

}

[WebMethod]

public void Forum_swap()

{

}

[WebMethod]

public void Forum_GetProperties()

{

}

[WebMethod]

public void ForumGroup_GetProperties()

{

}

[WebMethod]

public void QAWizardLink_CreateUpdateDelete()

{

}

SwamyKanakala at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 3
Hi Swamy Kanakala,

OK, here is my finding. In VS2003, the order remains the same as the .CS file.
In VS2005, this has been changed the WebServices are listed in alphabetical order.
So, its not really random but alphabetical order and I dont see anyway to change this behavior.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 4
Hi Vikram,
Did you try testing with these methods? The order is not remaining the same as in the cs file. Thanks!
SwamyKanakala at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 5
Hi,

Yes, I tried with the method names which you have provided. Like I already mentioned, it got listed in alphabetical order which is different from the .CS source code listing.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 6
No, its not the case. I'm using .NET 1.1 and if we crosss certain limit (around 10), the order is getting random. The methods are appearing neither in alphabetical order nor in the order specified in source file. You must be using WSE? Please let me know. Thanks!

Regards,
Swamy

SwamyKanakala at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 7
Hi,

Your observation is correct. It is not even 10, its just pure random in case of .NET 1.1. In v2.0, its listed alphabetically. You can get it to list alphabetically in .NET v1.1. Follow the steps below:

1. Locate and open the following file:
\WINDOWS\Microsoft.NET\Frame­work\v1.1.4322\CONFIG\DefaultW­sdlHelpGenerator.aspx

2. Search for the following line in the aspx page:
Hashtable methodsTable = new Hashtable();

3. Comment out that line and replace it with the following:
//Hashtable methodsTable = new Hashtable();
SortedList methodsTable = new SortedList();

4. Save the file.

Now the order of the webmethods would appear in alpgabetical order.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 8
Yeah, I've just found it on web. Thanks anyway for your help!

http://www.dotnet247.com/247reference/a.aspx?u=http://www.dotnet247.com/247reference/msgs/12/62668.aspx

http://dotnetjunkies.com/WebLog/razor/archive/2004/03/28/10229.aspx

SwamyKanakala at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...

.NET Development

Site Classified