Hi,
No, there is no way today to make the auto-generated schema reflect the
cardinality requirements of the original schema. This is something you can
handle in one of two ways. Either you publish a hand-corrected or hand
coded WSDL file, or you handle the issue via documentation as a part of
your partner provisioning/SLA terms.
In order to get the value ALWAYS serialized, remember to always call the
MakeSchemaCompliant method on the class. This is where the generated XML
is made schema compliant when XsdObjectGen is used to create classes.
Regards
Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: XsdObjGen and use=required on attributes
thread-index: AcTIqEsqJbD4CpzzT9iBwLvuNQcztw==
X-WBNR-Posting-Host: 62.17.162.113
From: =?Utf-8?B?UGV0ZXIgTWNFdm95?= <Pe*********@discussions.microsoft.com>
Subject: XsdObjGen and use=required on attributes
Date: Fri, 12 Nov 2004 03:11:01 -0800
Lines: 41
Message-ID: <2B**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:7396
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
Hi all,
I wonder has anyone seen this behaviour with XsdObjGen tool, and if so, how
did you get around it?
I have the following in a schema file:
<xs:attribute name="sid" type="xs:long" use="required"/>
Notice the use="required" attribute...
this genenerates the following code:
[XmlAttribute(AttributeName="sid",Form=XmlSchemaFor m.Unqualified,DataType="l
ong")]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public long __sid;
[XmlIgnore]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public bool __sidSpecified;
[XmlIgnore]
public long sid
{
get { return __sid; }
set { __sid = value; __sidSpecified = true; }
}
[XmlAttribute(AttributeName="clientId",Form=XmlSche maForm.Unqualified,DataTy
pe="long")]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public long __clientId;
In turn, when I view the WSDL that is generated by the webservice, I see
that the attribute now has the form:
<s:attribute form="unqualified" name="sid" type="s:long" />
The required attribute is no longer present. Is there anyway around this?
Pete