I have a .Net web services that are called from flex. Our programmer receives the following xml when calling web service function:
<FunctionName xmlns="WSNamespace"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<FunctionName>Xml itself</FunctionName>
He would like to get all the same, but 开发者_如何学编程with no namespace as we do not need them. How can it be done on .Net part?
Use
[WebService(Namespace = "")]
if you want no namespaces. But that is not the preferred way. Instead you can use the XmlNamespaceDeclaration to get a fully qualified namespace. Like this
[XmlNamespaceDeclarations]
public XmlSerializerNamespaces xmlns
{
get
{
XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();
xsn.Add("me", "http://anamespace/");
return xsn;
}
set
{
// needed for serialization
}
}
Check out more info at: http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlnamespacedeclarationsattribute.aspx
精彩评论