Tuesday, 28 August 2018

Web Method Over Loading in Web Service?





  1. Web Method Over Loading in Web Service?

  1.  
  2. [WebService]
  3. public class CustomerService : System.Web.Services.WebService  
  4. {   
  5. [Web Method]
  6.     public int GetAddtionOfNumber(int a,int b)  
  7.     {  
  8.           
  9.         return  a + b;  
  10.     }   
  11. //overload method 
  12. [Web Method]
  13.     public int GetAddtionOfNumber(int a, int b,int c)  
  14.     {  
  15.   
  16.         return a + b + c;  
  17.     }  


This Error Resolving using message name property:

  1. [WebService]
  2. public class CustomerService : System.Web.Services.WebService  
  3. {  
  4.     [WebMethod(MessageName = "AdditionOfTwoNumber")]  
  5.     public int GetAddtionOfNumber(int a,int b)  
  6.     {  
  7.        return a + b;
  8.     }  
  9.     [WebMethod(MessageName = "AdditionOfThreeNumber")]  
  10.     public int GetAddtionOfNumber(int a, int b,int c)  
  11.     { 
  12.         return a + b+c;
  13.     } 
  14. }  







No comments:

Post a Comment

Top Agile Interview Questions & Answers

Top Agile Interview Questions & Answers 1. What is Agile Testing? The first question of agile interview question tests your k...