How to: Use the WebService Attribute

 Windows Communication Foundation Services and ADO.NET Data Services

You can use the WebService attribute to specify the namespace, which defaults to "http://tempuri.org", and description text for the XML Web service. By default the ASP.NET Web Service project template does not generate a class that includes this attribute. Separate multiple properties with a comma.

To apply the WebService attribute

  • Insert the WebService attribute before the class declaration and set the Namespace and Description properties as shown below:

    <System.Web.Services.WebService( _ 
       Namespace:="https://servername/xmlwebservices/", _ 
       Description:="Some descriptive text could go here.")> _ 
    Public Class Service1
        Inherits System.Web.Services.WebService
        ' Implementation code.
    End Class
    
    [System.Web.Services.WebService( 
       Namespace="https://servername/xmlwebservices/", 
       Description="Some descriptive text could go here.")] 
    public class Service1 : System.Web.Services.WebService
    { 
        // Implementation code.
    }
    

See Also

Reference

WebServiceAttribute

Other Resources

Creating Web Services in Managed Code