Geeks With Blogs
Patrice Calve Life's short, have fun

So,

You have a Web Service and a test client.  They (server + client) have been working great for months and all over sudden you're getting weird values.  The values sent from the server seem good, but the Xml/SOAP received doesn't get de-serialized correctly, and everything (or some properties) is set to default values (int=0, guid={00000000-0000-0000-0000-000000000000}, ...).  Read on !

The test client has a web reference to your Web Service.  A few web methods are returning objects (simple objects like Country(Id, NameEn, NameFr, etc.)).

When you run the Web Service from IE, the result is as expected:

  <?xml version="1.0" encoding="utf-8" ?>
- <ArrayOfCountry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/People">
- <Country>
  <CountryId>1</CountryId>
  <NameEn>Canada</NameEn>
  <NameFr>Canada</NameFr>
  <ISOCode>CA</ISOCode>
  <Provinces />
  </Country>
  </ArrayOfCountry>

But for a reason or another, when you run it from your Test Client, every darn CountryId is set to 0.  If the the Id is a Guid, every row has a MyId = {00000000-0000-0000-0000-000000000000}.

Try updating your Web Reference(s)!  Right click the Web References -> Update Web Reference. 

Restart your test client.

How many times have I fallen in this trap? 

I hope this post will make me remember this mental note, and enlighten you!

Have fun, life's short

Pat

Posted on Wednesday, May 28, 2008 1:32 PM | Back to top


Comments on this post: Problem with .Net Web Services having values set incorrectly?

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Patrice Calvé | Powered by: GeeksWithBlogs.net