webservices change namespace prefix of ASMX Web Service Return
I am creating webservices and using an overall namespace :
[WebService(Namespace = "www.abcdef.com")]
when I ask for wsdl it gives me the namespace like xmlns:abc="www.abcdef.com"
I would like to change the abc
开发者_如何学Goprefix to something else.
Is there a way to change it?
Untested but give it a shot:
[WebService(Namespace = "http://mynamespace/")]
public class Service1 : System.Web.Services.WebService
{
[XmlNamespaceDeclarations]
public XmlSerializerNamespaces xmlns
{
get
{
XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();
xsn.Add("me", "http://mynamespace/");
return xsn;
}
set { /* needed for xml serialization */ }
}
}
精彩评论