Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8891499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:45:45+00:00 2026-06-14T22:45:45+00:00

I am building a WCF Client with VS2010. The web service we consume defines

  • 0

I am building a WCF Client with VS2010. The web service we consume defines some data that it returns as xs:nonNegativeInteger. However VS2010, upon generation of the WCF client code, generates classes with properties of type string for these xs:nonNegativeInteger attributes.

I am wondering why that’s the case and if and how I can tell VS2010 to adjust its mappings from xs:nonNegativeInteger to integer rather than string.

(I can’t change the wsdl of the web service we consume… And I am also hesitant of simply changing the generated code in case we need to update the service reference, so some sort of data type mapping via a config would be ideal.)

Thanks all!

Example snippet of the WSDL we consume:

<xs:element minOccurs="0" name="blub" type="xs:nonNegativeInteger" />

Example snippet of the generated WCF client code:

<System.Xml.Serialization.XmlElementAttribute(DataType:="nonNegativeInteger", Order:=0)>  _

Property blub() As String
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:45:46+00:00Added an answer on June 14, 2026 at 10:45 pm

    It seems you’ve configured SvcUtil to use the XmlSerializer instead of the DataContractSerializer. MSDN says XmlSerializer will serialize the xs:nonNegativeInteger to string while DataContractSerializer will serialize it to Int64 (search for ‘nonNegativeInteger’ in each page).

    If you don’t want to use DataContractSerializer for some reason, your best option is to take advantage of the generated proxy classes being partial classes and create a separate property (either int or long) to encapsulate the conversion logic without affecting how WCF serializes/deserializes that field.

    BTW: if that string conversion really annoys you, vote up this issue in CodePlex.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a simple WCF service that has to return some data from
I have a WCF web service that is building up data into classes and
I'm building a mobile web-application.I have a web Service (WCF) and a android client.I
I'm about to start building an iPad client for an existing WCF service that
I'm building an application that uses a WCF client to retrieve data from my
I am building a WCF service now, that has a wsHttpBinding endpoint. The client
I'm building a WCF service,after a client connects to this service,when the service disconnect,
I am building a WCF service that will expose several operations, it will run
I'm building a self hosted WCF service. I'm building a special data structure for
We are building a web service with WCF on .net 4.0. The service will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.