How to define a validating type in WCF which appears in the WSDL RRS feed

  • Question

  • I have a wsdl from which I need to generate WCF service code. The wsdl has some simpleTypes defined which are being used in as data types in other parts of the wsdl. for example:


    - <xs:simpleType name="sourceSystem">
    -    <xs:restriction base="xs:string">
             <xs:pattern value="[a-zA-Z0-9]{4}" />


      <xs:import namespace="" />
    -  <xs:element name="withholdingDeterminationRequest">
    -   <xs:complexType>
    -     <xs:complexContent>
    -      <xs:extension base="commons:baseVersionableType">
    -       <xs:sequence>
              <xs:element name="requestingSourceSystem" type="commons:sourceSystem" />
              <xs:element name="creationTimestamp" type="xs:dateTime" />
    -         <xs:element name="payment">

    -         .....

    jWhen i take the wsdl and generate the code using both wsdl.exe or WSCF blue, the simple type definition is always ignored by the code generator. the generated code looks like this


    publicpartialclassWithholdingDeterminationRequest : BaseVersionableType     {                  privatestring requestingSourceSystemField;                  private System.DateTime creationTimestampField;                  privateWithholdingDeterminationRequestPayment paymentField;                  privateWithholdingDeterminationRequestTrade tradeField;                  privateChangeNotifcationRequest changeNotifcationField;                  /// <remarks/>         [System.Xml.Serialization.XmlElementAttribute(Order=0, ElementName="requestingSourceSystem")]         publicstring RequestingSourceSystem         {             get             {                 returnthis.requestingSourceSystemField;             }             set             {                 this.requestingSourceSystemField = value;                              }         }

    As we can see that the RequestSourceSystemProperty is defined as a string , though in actual it should be defined

    as of type sourceSystem.

    Even the wsdl emitted from the generated code does not have the definition of simple types.

    Please help ..


    Tuesday, January 28, 2014 7:03 PM