locked
Decimal value ignored at WCF Test Client but Local RRS feed

  • Question

  • User2099148801 posted

    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!

    Monday, January 14, 2013 3:46 PM

Answers

All replies

  • User281315223 posted

    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.

    //Using precision > 28
    150.56 => 15056
    
    //Using precision <= 28
    150.56 => 150.56
    

    You can find a large discussion of the issue here.

    Monday, January 14, 2013 3:51 PM
  • User2099148801 posted

    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.

    Monday, January 14, 2013 4:26 PM
  • User281315223 posted

    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)

    Monday, January 14, 2013 4:46 PM
  • User2099148801 posted

    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.

    Tuesday, January 15, 2013 8:53 AM
  • User281315223 posted

    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.)

    Tuesday, January 15, 2013 9:06 AM
  • User2099148801 posted

    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?

    Tuesday, January 15, 2013 9:34 AM
  • User281315223 posted

    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.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 15, 2013 9:39 AM
  • User2099148801 posted

    Thanks for the links, I'll check them at work.

    Wednesday, January 16, 2013 9:24 PM