I have this Web Service that recieves like 20 parameters, two of them are Decimal.
When I run the ws at visual studio at those 2 decimal parameters I write "150.56" and "3580.88" and all goes good. But when I test the ws with the WCF Test Client, those values becomes from "150.56" to "15056" and "3580.88" to "358088". I read it could be
the culture, but I don't know how to solve this.
Thanks to all!
“Computers are like bikinis. They save people a lot of guesswork.”
(Sam Ewing)
Your precision value is likely set too high. When precision is greater than 28 for decimals, then by default an XML data-type is used to store the value.
One of the user's explicitly defined the "." as the seperator for numbers and was able to test his WCF services successfully, so it may be worth a shot. (Unless the Test Client by default reads in all data-types as XML)
As you mentioned this only appeared to be a problem within the Test Client and not the actual implementation right?
(If it is just an issue with the test client - then you should be alright if I understand you correctly.)
I just tested the web service from the browser and it worked. This web service is being invoked from a desktop application, I will check for the configured number separator. So there should be a config file at WCF Test Client to change or configure this?
“Computers are like bikinis. They save people a lot of guesswork.”
(Sam Ewing)
The following Stack Overflow thread discusses the process for disabling autogenerating a configuration file for the WCF Test Client so that you could edit and re-use the same one for all of your subsequent requests :
Rawler
Member
135 Points
210 Posts
Decimal value ignored at WCF Test Client but Local
Jan 14, 2013 07:46 PM|LINK
Hey all!
I have this Web Service that recieves like 20 parameters, two of them are Decimal.
When I run the ws at visual studio at those 2 decimal parameters I write "150.56" and "3580.88" and all goes good. But when I test the ws with the WCF Test Client, those values becomes from "150.56" to "15056" and "3580.88" to "358088". I read it could be the culture, but I don't know how to solve this.
Thanks to all!
(Sam Ewing)
Rion William...
All-Star
27916 Points
4618 Posts
Re: Decimal value ignored at WCF Test Client but Local
Jan 14, 2013 07:51 PM|LINK
Your precision value is likely set too high. When precision is greater than 28 for decimals, then by default an XML data-type is used to store the value.
You can find a large discussion of the issue here.
Rawler
Member
135 Points
210 Posts
Re: Decimal value ignored at WCF Test Client but Local
Jan 14, 2013 08:26 PM|LINK
Those fields are set Decimal(16, 2) and Decimal(8, 4).
And it does work at vs2010 environment, but at WCF Test Client is when all is messed up.
(Sam Ewing)
Rion William...
All-Star
27916 Points
4618 Posts
Re: Decimal value ignored at WCF Test Client but Local
Jan 14, 2013 08:46 PM|LINK
The following Stack Overflow thread discusses a similar issue that relates to the culture / regional settings (as you had mentioned before).
http://stackoverflow.com/questions/2052692/culture-related-issue-with-wcf-and-system-double
One of the user's explicitly defined the "." as the seperator for numbers and was able to test his WCF services successfully, so it may be worth a shot. (Unless the Test Client by default reads in all data-types as XML)
Rawler
Member
135 Points
210 Posts
Re: Decimal value ignored at WCF Test Client but Local
Jan 15, 2013 12:53 PM|LINK
Thanks for the link, I will try changing the separator for numbers, but still if another user wants to use it, should change the configuration aswell?
There should be a .net fix for this, I mean I can't tell every user to change their configuration each time they need to use my WS.
(Sam Ewing)
Rion William...
All-Star
27916 Points
4618 Posts
Re: Decimal value ignored at WCF Test Client but Local
Jan 15, 2013 01:06 PM|LINK
As you mentioned this only appeared to be a problem within the Test Client and not the actual implementation right? (If it is just an issue with the test client - then you should be alright if I understand you correctly.)
Rawler
Member
135 Points
210 Posts
Re: Decimal value ignored at WCF Test Client but Local
Jan 15, 2013 01:34 PM|LINK
I just tested the web service from the browser and it worked. This web service is being invoked from a desktop application, I will check for the configured number separator. So there should be a config file at WCF Test Client to change or configure this?
(Sam Ewing)
Rion William...
All-Star
27916 Points
4618 Posts
Re: Decimal value ignored at WCF Test Client but Local
Jan 15, 2013 01:39 PM|LINK
The following Stack Overflow thread discusses the process for disabling autogenerating a configuration file for the WCF Test Client so that you could edit and re-use the same one for all of your subsequent requests :
http://stackoverflow.com/questions/5271117/wcftestclient-default-config
Here's another long discussion on the same topic in the MSDN forums as well.
Rawler
Member
135 Points
210 Posts
Re: Decimal value ignored at WCF Test Client but Local
Jan 17, 2013 01:24 AM|LINK
Thanks for the links, I'll check them at work.
(Sam Ewing)