我有一个 wsdl 并想生成一个使用该 wsdl 的 web 服务。因此我使用 wsdl.exe 来生成我可以使用的类。( > wsdl.exe foobar.wsdl /server
)
wsdl 文件包含这样的一行
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2000/09/xmldsig#"/>
wsdl.exe 将其翻译为
private System.Xml.XmlElement[] anyField;
/// <remarks/>
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlElement[] Any {
get {
return this.anyField;
}
set {
this.anyField = value;
}
}
相反,我希望签名被“解析”以生成这样的代码:
private SignatureType[] signatureField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute ("Signature", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
public SignatureType[] Signature
{
get
{
return this.signatureField;
}
set
{
this.signatureField = value;
}
}
有没有办法做到这一点?我可以告诉 wsdl.exe 将此 xmldsig“解析”为签名,如命名空间中指向的 xsd 中所述吗?( http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd ) 是否有原始 wsdl 对我生成的代码仍然有效?