开发者

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 */ }
            }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜