user3569147
user3569147

Reputation: 102

Display of webservice description

I am after teaching myself Soap Services in asp.net / c#. This a very simple and straightforward little service.

I have one problem, I would like to have a description in what the service does; what the parameters are and what the expected out come is.

How do you this part of webservice?

Web service image

Here is the Code

[WebMethod]
public Boolean IsLessThan(Int64 userVariable, Int64 rangeLimit)
{
    return (rangeLimit > userVariable);
}

Upvotes: 0

Views: 120

Answers (1)

Oakcool
Oakcool

Reputation: 1496

This might help achieve what you want.

namespace WebApplication1
{
    /// <summary>
    /// Summary description for WebService1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/", Description = "Something about your service")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class WebService1 : System.Web.Services.WebService
    {

        [WebMethod(Description = "What this method does")]
        public string HelloWorld()
        {
            return "Hello World";
        }
    }
}

Notice that both WebServiceAttribute and WebMethodAttribute have a description property, that will show up in the page.

Now to the point @John Saunders presented, it is true that "old school" web services are not in favor anymore (I would not go as far as saying you should not use it), and you are better off using the other techs (WCF, Web Api), and depending in what you want to achieve one is better(easier) then the other. So I would take a look at that, and see if you really want to invest your time "old school" web services.

Hope this helps

Upvotes: 1

Related Questions