WebService 接收带有“,”的十进制值。或“。”
我有一个 .Net Web 服务,其 Web 方法接收 Decimal 类型参数。仅当 Web 服务调用者使用“.”时,它才有效。作为分隔符。
由于我公司系统的“多元文化”性质,我希望能够使用逗号或点分隔符接收此值。
我尝试创建一个自定义 SoapExtension 来读取发送的原始 XML,并将“,”替换为“.”。不幸的是,我可以读取原始 XML,但无法更改它。
有更简单的方法吗?
I have a .Net webservice with a webmethod which receives a Decimal type parameter. It only works if the webservice caller uses '.' as separator.
I want to be able to receive this value either with comma or point separator, due to the "multi-culture" nature of my company's system.
I've tried to create a custom SoapExtension to read the raw XML that was sent, and replace "," with ".". Unfortunately I could read the raw XML but coudn't change it.
Is there a easier way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用多种区域性,将该区域性添加到请求标头或作为属性,那么在 C# 中,您可以通过让以下操作轻松地以正确的方式处理日期和数字值:将那些处于不同文化中的值视为正在运行的服务器。
或者,简单地请求他们以您独特的格式向您发送,将该格式附加到您的方法的标头部分,以便在使用时可以将其附加到 WSDL
If you have several cultures that you work with, either add that culture to a request header or as a property, then in C# you can easily treat the Dates and Numeric values the correct way by letting the action that treat those values that they are in a different culture as the running server.
or, simple request them to send you in your unique format, append that format to the header section of your method so it can be appended to the WSDL when consumed