tags:

views:

103

answers:

2

It should be possible (and it looks like it is), but assume I have the following functions in my ASMX web service:

     [WebMethod(MessageName = "CreateExternalRpt1")]
    public bool CreateExternalRpt(int iProductId, int iOrderProductId, DateTime dtReportTime, string strReportTitle,
        string strReportCategory, string strReportPrintType, out string strSnapshot, string strApplicantFirst, string strApplicantLast,
        string strApplicantMiddle, string strOwnerLast, string strOwnerMiddle, string strOwnerFirst,
        bool blnCurrentReport, int iOrderId, bool blnFlag, string strCustomerId, string strUserId)
  {
       …
    }


    [WebMethod(MessageName = "CreateExternalRpt2")]
    public bool CreateExternalRpt(int iProductId, int iOrderProductId, DateTime dtReportTime, string strReportTitle,
        string strReportCategory, string strReportPrintType, string strReportSnapshot, string strApplicantFirst, string strApplicantLast,
        string strApplicantMiddle, string strOwnerLast, string strOwnerMiddle, string strOwnerFirst,
        bool blnCurrentReport, int iOrderId, bool blnFlag)
    {
    …
  }

With both of these functions defined in my web service, my .NET client app can’t download the metadata and instead throws a generic error message “There was an error downloading…”.

With one of the above methods removed, the .NET client app can successfully download the metadata.

I’ve read that by decorating the WebMethod with a unique name, both functions should be exposed in the service metadata.

This isn’t working. What am I missing?

A: 

Method names must be unique.

michael.lukatchik
-1: That is not the case. See the [`MessageName`](http://msdn.microsoft.com/en-us/library/system.web.services.webmethodattribute.messagename.aspx) property of the `WebMethod` attribute.
John Saunders
A: 

:) - I'm sure once you think about it a minute or two, you'll realize.

Keep in mind that when you're making a traditional call using SOAP, you know a method at the time of the call but don't know the entire signature. You may expect that it contains params A, B, and C, but you're not 100% sure.

As another poster mentioned... http://stackoverflow.com/questions/1522585/can-web-methods-be-overloaded/1522628

There are several ways to overload methods in ASMX by using message-based routers. However, I've never gone that route and have heard many having issues doing so. I'd recommend WCF for overloads. http://jeffbarnes.net/blog/post/2006/09/21/overloading-methods-in-wcf.aspx

Jason N. Gaylord
-1: That is not the case. See the [`MessageName`](http://msdn.microsoft.com/en-us/library/system.web.services.webmethodattribute.messagename.aspx) property of the `WebMethod` attribute.
John Saunders
John, you may not realize this, but he is attemptign to get this to work with COM+.
Jason N. Gaylord