Lucien
8/2/2003 12:02:00 AM
The WSDL is not used for schema validation unless you add this yourself (as
a SoapExtension for instance).
You could create a XSD schema and use that for schema validation (or save a
WSDL file and modify it).
"Brad Quinn" <brad_quinn@yahoo.com> wrote in message
news:ujoa0zEWDHA.384@TK2MSFTNGP12.phx.gbl...
> I'm planning on doing schema validation in a SoapExtension.
>
> I want the consumer of my WebService to be forewarned.
>
> Lets say this is the schema fragment that I'm going to validate with;
>
> <xs:complexType name="Class1"> ...
> <xs:complexType name="Class2"> ...
>
> <xs:choice minOccurs="1" maxOccurs="2">
> <xs:element name="Class1" type="Class1" minOccurs="0" maxOccurs="1"
/>
> <xs:element name="Class2" type="Class2" minOccurs="0" maxOccurs="1"
/>
> </xs:choice>
>
> The corresponding field in C# would look like this;
>
> [System.Xml.Serialization.XmlElementAttribute("Class1",
typeof(Class1))]
> [System.Xml.Serialization.XmlElementAttribute("Class2",
typeof(Class2))]
> public object [] myChoiceClass;
>
> But the generated WSDL looks like this, which isn't quite right;
>
> <s:choice minOccurs="0" maxOccurs="unbounded">
> <s:element minOccurs="0" maxOccurs="1" name="Class1"
type="s1:Class1"
> />
> <s:element minOccurs="0" maxOccurs="1" name="Class2"
type="s1:Class2"
> />
> </s:choice>
>
> It looks pretty close, but looks can be deceiving. I could easily modify
> the schema so that the WSDL wouldn't look like it was mostly correct.
>
> "Lucien" <Xlucienen X@hotmail.com> wrote in message
> news:3f2a8d1d$1@news.microsoft.com...
> > You can express a choice in a class. Use attributes like this:
> >
> > [System.Xml.Serialization.XmlElementAttribute("Class1", typeof(Class1))]
> > [System.Xml.Serialization.XmlElementAttribute("Class2", typeof(Class2))]
> > public object myChoiceClass ...
> > If there would be a schema definition that you couldn't express in a
class
> > you could create the proxy manually by using the WSDL.exe tool. However
> most
> > implementations don't do a full WSDL schema check and it would only fail
> if
> > (de)serialize fails. So you'd have to add the check programmatically if
> you
> > needed to enforce special constraints.
> >
>
> <snip/>
>
>