I have a library project that includes a standard web service base class. I then inherit that base class for the specific websites that implement the web service.
Here is a simplified example:
[WebService(
Namespace = "http://CanI.InheritThis.com/",
Name = "WebServiceBaseClass",
Description = "This Webservice is overloaded on specific websites")]
public abstract class CustomWebServiceBase : WebService
{
//shared web service guts
}
public class MyService : CustomWebServiceBase
{
//overloaded items
}
When I open up myservice.asmx
it still says I'm using the default namespace (http://tempuri.org
). How do I get the webservice to show the inherited namespace(http://CanI.InheritThis.com/
)?
Update:
I attempted to create a custom attribute that inherits from the WebServiceAttribute
class but found that WebServiceAttribute
is sealed.
Is there a way to add Inherited = true
to WebServiceAttribute
?
Update 2: Even more confusing I followed J0e3gan's advice and created the following in linqpad (with the System.Web.Services.dll added and namespace added.
void Main()
{
Console.WriteLine(typeof(MyService).GetCustomAttributes().First());
}
[WebService(
Namespace = "http://CanI.InheritThis.com/",
Name = "WebServiceBaseClass",
Description = "This Webservice is overloaded on specific websites")]
public abstract class CustomWebServiceBase : WebService
{
//shared web service guts
}
public class MyService : CustomWebServiceBase
{
//overloaded items
}
Which says it's getting the correct attribute, however the asmx page still claims to be using the default namespace.
Update 3: restarted from scratch, checked into bitbucket, same issue Update 4: As @J0e3gan pointed out, the bitbucket project was missing the class library, I've fixed that.