我们开发了一个使用消息契约作为参数的WCF。当我为它们生成WSDL时,对于某些Message契约,WCF正在添加http://schemas.datacontract.org/2004/07/ Namesapce,即使我使用自定义命名空间覆盖MessageContract的namespace属性。请帮我改写默认命名空间(http://schemas.datacontract.org/2004/07/)。
以下是Contracts和WSDL的示例代码
[ServiceBehavior(Namespace="http://www.example.com/unh0/xwds/wd/service/0")]
public class WithholdingDeterminationLiteService : IWithholdingDeterminationLiteService
{
public withholdingDeterminationResponse WithholdingDeterminationLite(withholdingDeterminationLiteRequest request)
{
throw new NotImplementedException();
}
}
[MessageContract(WrapperNamespace = "http://www.example.com/unh0/xwds/wd/lite/request/1")]
public class withholdingDeterminationLiteRequest : baseVersionableType
{
…
private withholdingDeterminationLiteRequestTrade tradeField;
…
/// <remarks/>
[MessageBodyMember(Namespace = "http://example.com/xods/common/1")]
public withholdingDeterminationLiteRequestTrade trade
{
Get { return this.tradeField; } set { this.tradeField = value; }
}
…
}
WSDL生成的具有
<wsdl:definitions …>
<wsdl:types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.example.com/unh0/xwds/wd/lite/request/1">
<xsd:element name="withholdingDeterminationLiteRequest">
<xsd:complexType>
<xsd:sequence>
…
<xsd:element xmlns:q2="http://schemas.datacontract.org/2004/07/" minOccurs="1" name="trade" type="q2:withholdingDeterminationLiteRequestTrade"/>
…
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:tns="http://schemas.datacontract.org/2004/07/" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/">
…
<xsd:complexType name="withholdingDeterminationLiteRequestTrade">
…
</xs
d:complexType>
<xsd:element name="withholdingDeterminationLiteRequestTrade" type="tns:withholdingDeterminationLiteRequestTrade"/>
..
</xsd:schema>
</wsdl:types>
…
</wsdl:definitions>
非常感谢任何帮助。