0

hi,

i have created an ASP.net web service that contain a webmothod that return the string. now i want to add an other method into that method. like following

[WebMethod]
    public string hello()
    {
       sum();
       return "abc";
    }
  
    public int sum()
    {
          return 10;
         // it does not make sense but just for example.
    }

now i want to access sum method from my client. how can i do it.

thanks and best regards,
Nice Candy.

Edited by __avd: Added [code] tags.

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Fortinbra
0

Deploy ur webservice on server, goto add reference in ur VS add the web reference to ur project and then instaniate the webservice object then you can access the web method.

Edited by Pgmer: n/a

0

i have access it successfully but the problem is that how can i access my add method that i have callled inside the hello method from the client side because i want to make my add method invisible from the client when he access my webservice.

0

Write seperate class in webservice, write ur method in that class which u want to hide... call where ever u want it

0

What you have as an example would theoretically work, you just need to change the permission on the method. Instead of Public, make it private or protected.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.