xmlweb-servicesxsdwsdlwsdl.exe

wsdl.exe code generation for xmldsig


I have a wsdl and want to generate a webservice that uses that wsdl. therefore I use wsdl.exe to generate classes i can use. (> wsdl.exe foobar.wsdl /server)

The wsdl file contains one line like that

<xs:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2000/09/xmldsig#"/>

and wsdl.exe translates it to

private System.Xml.XmlElement[] anyField;

/// <remarks/>
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlElement[] Any {
    get {
        return this.anyField;
    }
    set {
        this.anyField = value;
    }
}

Instead I want the signature to be "resolved" in order to generate code like that:

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;
  }
}

Is there a way to achiev that? Can I tell wsdl.exe to "resolve" this xmldsig to signature as described in the xsd pointed at in the namespace? (http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd) Is there original wsdl still valid for my generated code?


Solution

  • No. no there is no way. its an xml any element and the namespace is not enough to auto generate a signature property. in order to archive that you have to edit the xml upfront.

    like this e.g.:

    <xs:schema xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" 
    (...)
    <xs:element maxOccurs="unbounded" minOccurs="0" ref="dsig:Signature"/>