470,848 Members | 949 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

WS Proxy generator stripping out XSD annotation and enumerations

Hi there,

Here's the problem: our team is working on a web service which formerly
took in two user defined types consisting of mostly simple datatypes.
Recently we decided to move toward an XML schema to define the two types and
the required values to submit rather than having to send .NET-specific types.
So one of our team members generated an XSD with substantial annotation
explaining to consumers of the web service what each element was and why it
was there. There was also one element which had been an enumeration, so he
created a simple type and using restriction specified two integer enumeration
values. The schema validates just fine, but when a client generates a proxy
request through a web reference in VS.NET 2003, all of the annotation
elements are stripped out in the proxy xsd file, as is the enumerated simple
type. The one element which had been specified as that simple type now is
specified as able to accept any int value.

Is this a known issue with VS.NET? For what we are hoping to accomplish,
it's a huge deal breaker.

Please advise.

Thanks very much,

The Man From SQL

May 17 '06 #1
3 1891
Hi,

Could you let me know how you apply the schema to the class? Are you using
the xsd.exe to generate the class? If so, could you post your schema here,
so that I can have a try to repro the problem?

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 18 '06 #2
Hi Kevin,

Thanks for your reply. Please try the following to replicate the problem.

1. Create a simple web service.
2. Add an XSD to that web service.
3. In the XSD, create a simple type called smplEnum based on the integer
datatype and constrain it as an enumeration so that there are only two or
three valid values for that simple type. Somewhere in your schema, create an
element myValue of type smplEnum.
4. Generate a dataset from this XSD. At this point if you open up the
code-behind file you'll notice that the property myValue is listed as an
integer and your enumeration is lost (problem #1).
5. In your web service, create a method which returns the typed DataSet you
generated from your XSD. Build the web service.
6. Now create a small console application and add a web reference to your
web service. The XSD will pull down, as well as the Reference.cs file. Now
not only is your code-behind file missing the enumeration on the client side,
too(problem #1), the simple type you created is now also missing from your
XSD (problem #2). An additional problem is that if you added any annotations
to your XSD file describing the elements on the server side, they are also
stripped out of the client-side XSD (problem #3).

Please let me know if you need any more information to replicate the problem.

Thanks,

Kerry

"Kevin Yu [MSFT]" wrote:
Hi,

Could you let me know how you apply the schema to the class? Are you using
the xsd.exe to generate the class? If so, could you post your schema here,
so that I can have a try to repro the problem?

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 19 '06 #3
Hi Kerry,

The enum type in the XSD was mapped to int because when generating DataSet,
all items are mapped to DataSet columns. Since a DataColumn cannot accept
an enum type as data type, the enum type is mapped to int. The annotations
are stipped out by design to reduce size and communication costs.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 22 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by b_prikls | last post: by
1 post views Thread by wayne_bradney | last post: by
8 posts views Thread by Joe | last post: by
reply views Thread by George Bool | last post: by
1 post views Thread by neokosmos | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.