Re: mandatory fields....

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Ollie (why)
Date: 11/13/04

  • Next message: lilryno: "re:Secure Connection HTTPWebrequest."
    Date: Sat, 13 Nov 2004 20:22:27 -0000
    
    

    thanks for the respone Dan,

    The question about 'contract first' development was really to try and get a
    consensus of what it actually is....

    I don't like writing WSDL and just wanted to clairfy that you don't have to
    write the WSDL first to adhere to 'contract first' develpoment and that you
    can just define the contract (xsd definition) to follow this development
    paradigm.....

    As for the answer for the validation logic that is contained in the XSD, it
    would be nice if the xsd.exe could generate this in the class BUT even
    better if it could generate it in the SOAP layer or lower in the HTTP layer
    so that it could the validation even before the message is delivered to the
    application from the SOAP layer - I will keep dreaming about this and may be
    creat a piece of software that does it :)

    Cheers for the answer

    Ollie Riches

    "Dan Rogers" <danro@microsoft.com> wrote in message
    news:6tp6IAFyEHA.768@cpmsftngxa10.phx.gbl...
    > Hi Ollie,
    >
    > No, there is no way to make the generated classes perform the complex
    > validation logic defined in the schema. It is a good idea to do a schema
    > validation as a precursor step in a web service validation. This can be
    > done either in WebService Extensions, or in an HTTP Filter in IIS - e.g.
    > intercept the XML.
    >
    > By the time it is in the class, you get what came in, and don't have a
    > great way to make the class enforce the schema rules. You CAN make the
    > class default missing values, etc, but it won't know any of your complex
    > validation rules from your schema. If you're in the class of developers
    > that starts with a schema and then generates a program, you can save
    > yourself some time by not going over the edge in defining validation rules
    > in the schema. You can develop these in code if you want them to run from
    > code, but you'll have to do that as adjunct logic, not generated from the
    > schema. At least not yet.
    >
    > Regards
    >
    > Dan Rogers
    > Microsoft Corporation
    > --------------------
    >>From: "Ollie" <ollie_riches@hotmail.com>
    >>Subject: mandatory fields....
    >>Date: Wed, 13 Oct 2004 15:30:35 +0100
    >>Lines: 58
    >>X-Priority: 3
    >>X-MSMail-Priority: Normal
    >>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
    >>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
    >>Message-ID: <O45xtETsEHA.3200@TK2MSFTNGP14.phx.gbl>
    >>Newsgroups:
    > microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.dotnet
    > framework.webservices
    >>NNTP-Posting-Host: 192.149.119.12
    >>Path:
    > cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
    > phx.gbl
    >>Xref: cpmsftngxa10.phx.gbl
    > microsoft.public.dotnet.framework.webservices:6965
    > microsoft.public.dotnet.framework.aspnet.webservices:26100
    >>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    >>
    >>I have defined a set of SOAP messages using an xsd file, each element in
    > the
    >>xsd has the minoccurs, maxoccurs & nillable attributes defined when I then
    >>use xsd.exe to generation C# classes for these message the attributes are
    >>NOT defined for the class members - e.g.
    >>
    >><xsd:complexType name="Session">
    >> <xsd:sequence>
    >> <xsd:element name="Id" type="xsd:int" nillable="false"
    > minOccurs="1"
    >>maxOccurs="1" />
    >> <xsd:element name="Name" type="xsd:string" nillable="false"
    >>minOccurs="1" maxOccurs="1" />
    >> <xsd:element name="StartDate" type="xsd:date" nillable="false"
    >>minOccurs="1" maxOccurs="1" />
    >> <xsd:element name="EndDate" type="xsd:date" nillable="false"
    >>minOccurs="1" maxOccurs="1" />
    >> </xsd:sequence>
    >></xsd:complexType>
    >>
    >>when the C# class is generated it appears as:
    >>
    >>[System.Xml.Serialization.XmlTypeAttribute(Namespace="uk.org.XXX.esm.v1")]
    >>[System.Xml.Serialization.XmlRootAttribute(Namespace="uk.org.XXX.esm.v1",
    >>IsNullable=false)]
    >>public class Session
    >>{
    >> /// <remarks/>
    >> public int Id;
    >> /// <remarks/>
    >> public string Name;
    >> /// <remarks/>
    >> [System.Xml.Serialization.XmlElementAttribute(DataType="date")]
    >> public System.DateTime StartDate;
    >> /// <remarks/>
    >> [System.Xml.Serialization.XmlElementAttribute(DataType="date")]
    >> public System.DateTime EndDate;
    >>}
    >>
    >>Can I mark the class members as having minoccurs, maxoccurs & nillable
    >>attributes or is this impossible?
    >>
    >>Is it possible to make a WS end point not accept a null value(message)? -
    > if
    >>so will it throw a SOAP exception?
    >>
    >>If I go the contract first way of development for the WS do I have to
    >>manually create the WSDL file after creating the xsd ?
    >>
    >>Anyone know of a good tool for generating the WSDL with the attributes I
    >>want....
    >>
    >>Cheers in advance
    >>
    >>Ollie
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >


  • Next message: lilryno: "re:Secure Connection HTTPWebrequest."

    Relevant Pages

    • Re: dynamic xsd to webservice
      ... with the web service and expose the schema in the wsdl and enable schema ... validation in the web service so as to keep me from having to validate the ... > I'm not 100% certain that you can add external schemas to your WSDL (I've ...
      (microsoft.public.dotnet.framework.aspnet.webservices)
    • RE: Consuming Web Service without Web Reference
      ... Eventhough I extracted schema from WSDL iam not able to call the web service. ... Generally, when you add a web reference, the orchestration web port contains ... You've said you've created a proxy class that is added as a reference to the ...
      (microsoft.public.biztalk.general)
    • Re: XmlValidatingReader - just the FAQS?
      ... > read an xml file and an xsd file and validate the xml file using ... The XML schema is fine, and your instance document is valid by it, ... > Validation Error: The 'Name' element is not declared. ... The XmlSchema constructor should only appear in applications ...
      (microsoft.public.dotnet.xml)
    • Re: validating if a file is a true valid xml file that fits a cert
      ... ValidateXmlFileException if the XML stream or XML Schema fails validation. ... Public Sub ValidateXmlFile(ByVal SchemaNamespace As String, ...
      (microsoft.public.dotnet.languages.vb)
    • Re: problem compiling xsd with xs:choice node
      ... The schema fragment you've posted is invalid - it violates UPA: ... A content model must be formed such that during validation of an element ... sequence in turn can be uniquely determined without examining the content or ...
      (microsoft.public.dotnet.xml)