0

I've created the following web service

>         [WebMethod(EnableSession = true)]
>   
>         public Transaction<Employee> GetEmployee(string Fname, string Lname, int eid)
>         {
>             
>             return _service.GetEmployee(Fname, Lname, apartmentTypeId, eid);
>         }

I want to make the last parameter optional. Currently, I'm i'm not submitting the eid, its giving an error. How can I make the last parameter optional in this service?

Pranav
  • 9
  • 3

1 Answers1

0

You can't. Web methods doesn't support optional parameters. When you generate proxi for web method, you make get the specific signature, according to which you client and server would exchange the messages. But it can't pass the optional parameters. You can use default parameters on the server side, but no optional.

Web Service Method with Optional Parameters

Pratham
  • 1
  • 1