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.

Recommended Answers

All 4 Replies

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.

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.

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.