Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Overloading a Web Service

Status
Not open for further replies.

tshad

Programmer
Jul 15, 2004
386
0
0
US
I have found tons of articles that tell you how to overload a Web Service but none that tell you how to call it.

You can do something like this:

Code:
namespace TestOverloadingWebService
{
    [WebService(Namespace = "[URL unfurl="true"]http://tempuri.org/")[/URL]]
    public class OverloadingInWebService : System.Web.Services.WebService
    {
        [WebMethod(MessageName = "AddInt", EnableSession = true)]
        public int Add(int a, int b)
        {
            return (a + b);
        }


        [WebMethod(MessageName = "AddFloat", EnableSession = true)]
        public float Add(float a, float b)
        {
            return (a + b);
        }
    }
}

This example is used all over the place but if you try to call the 2nd method I get an error on compile. In a project that is in the same solution.

The service compiles fine and when you run it you will see 2 services with the MessageName listed below.

How do you get this to work and how do you call it?

Thanks,

Tom
 
Yes, I did see both of the web sites.

I found the issue to be that I needed to update the web reference. Even though it was compiling, the web reference had to be updated. Didn't know about that.

It seems to work fine now. You do call it the same way.

It doesn't really spell that out and there were no examples of doing the call, so I wasnt't sure.

Thanks,

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top