Re: mandatory fields....
From: Ollie (why)
Date: 11/13/04
- Previous message: Waldek: "Permition certificate private key from webservice"
- In reply to: Dan Rogers: "RE: mandatory fields...."
- Next in thread: Dan Rogers: "Re: mandatory fields...."
- Reply: Dan Rogers: "Re: mandatory fields...."
- Messages sorted by: [ date ] [ thread ]
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
>>
>>
>>
>>
>>
>>
>>
>
- Previous message: Waldek: "Permition certificate private key from webservice"
- In reply to: Dan Rogers: "RE: mandatory fields...."
- Next in thread: Dan Rogers: "Re: mandatory fields...."
- Reply: Dan Rogers: "Re: mandatory fields...."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|