Wednesday, August 20, 2014

Explain how to document web services.

ASP.NET web services are considered as self documenting as they provides all information about what methods are available and what parameters they require using XML based standard called WSDL. We can also provide addition information about the web services using their WebService and WebMethod attributes.

You can add descriptions to each method through the Description property of the WebMethod attribute and to the entire web service as a whole using the Description property of the WebService attribute. You can also apply a descriptive name to the web service using the Name property of the WebService attribute. The attributes have name, description and namespace as properties which are shown in following example:
[WebService(Name = "Customer Service", Description = "Retrieve the Customer details",Namespace=http://www.apress.com/ProASP.NET/)]
public class Customer : System.Web.Services.WebService
{
     [WebMethod(Description = "Returns Customer Count")]
     public int GetCustomerCount()
     { ... }
     [WebMethod(Description = "Returns the list of Customer")]
     public DataSet GetCustomer()
     { ... }
}
Namespace allows your web service to be uniquely identified. By default, ASP.NET web services use the default XML namespace http://tempuri.org/, which is suitable only for testing. XML namespace simply identifies your web service. XML namespaces usually look like URLs. However, they don't need to correspond to a valid Internet location.

Related Posts:

  • Explain the protocols a .Net Web Service uses. In .Net, a web service is bind with three different protocols such as HTTP/POST,  HTTP/GET, and SOAP. This allows client with three options to choose for  communication. The protocols are included in the WSD… Read More
  • What is .Net Web Service? Web service is the way to publish application's function on web that can be accessible to the rest of the world. Web services are the components that can be used by other applications ASP.NET offers easy way… Read More
  • Define the specifications that help in the discovery of a web service. DISCO DISCO, an abbreviation of discovery, is a file that groups together a list of related web services. A company that offers web services publishes a DISCO file on its server that has links of all the web services it pr… Read More
  • Testing and consuming a .Net web service. Testing a Web Service .NET has a test web page that ASP.NET uses automatically when you request the URL of an .asmx file in a browser. This page uses reflection to read and show information about the web services, such as … Read More
  • Deploying a Web Service Deploying the .Net Web Services is as simple as any ASP.NET application. Similar to ASP.NET applications, you need to copy or upload the .ASMX file and the .DISCO files to the appropriate directories, and that's it.  … Read More

0 comments:

Post a Comment