Method overloading in web services

I have 2 questions related to web services.

  • How do we achieve method overloads in web services.
  • How to implement security (authentication) in web services.
+5
source share
2 answers

Good for overload:

[WebMethod(MessageName = "MaxInt", Description = "Compare two int values 
and return the max value", EnableSession = true)]
public int MaxValue(int a, int b)
{
   return (a > b ? a : b);
}
[WebMethod(MessageName = "MaxFloat", Description = "Compare two float values 
and return the max value", EnableSession = true)]
public float MaxValue(float a, float b)
{
   return (a > b ? a : b);
}

What do you mean by authentication? Obviously, you can use the validation key to access the web service. The question is confused. Make sure please.

+3
source

How we achieve method overloading in web services.

SOAP, . WSDL. . , WCF [OperationContract], :

[ServiceContract]
public interface IMyService
{
    [OperationContract(Name = "Foo")]
    void Foo();

    [OperationContract(Name = "FooWithId")]
    void Foo(int id);
}

() -.

- WCF.

+7

All Articles