通过 Nusoap 向 WCF 发送 GUID
我正在使用 Nusoap 调用 WCF 服务。以前所有的函数都有“string”或“int”,但这次我们有Guid。它会起作用吗?我需要在两边做一些特别的事情吗?当然,可以重新映射调用,以便它采用字符串而不是 Guid,但如果我不能这样做怎么办?
I am using Nusoap to call a WCF service. Previously all the functions had "string" or "int", but this time we have Guid. Will it work? Do I need to do something special on either side? Certainly it is possible to have the call remapped so that it takes a string instead of a Guid, but what if I cannot do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 NuSoap 方面,只要字符串的格式是合法的 Guid 格式(例如
12345678-1234-1234-1234-1234567890AB
、123456781234123412341234567890AB
等)。在WCF端,它将被解析为强类型的Guid,否则该消息将被拒绝。这样想,作为 WCF 服务,您并不关心谁在调用您,只要他们根据您的描述传递有效的 XML 文档即可。他们可以使用字符串连接或通过加载文件并替换其中的值来构建整个事物,您不知道也不应该关心。只要他们传递给您的 XML 和值与您同意的架构相匹配,一切都会“正常工作”。
On the NuSoap side it shouldn't matter if you use a string as long as the format of the string is a legal Guid format (e.g.
12345678-1234-1234-1234-1234567890AB
,123456781234123412341234567890AB
, etc). On the WCF side it will be parsed into a strongly typed Guid, otherwise the message will be rejected.Think about it this way, as the WCF service you don't care who's calling you as long as they are passing valid XML documents per your description. They could build the entire thing up using string concatenation or by loading files and replacing values in them, you don't know and shouldn't care. As long as the XML and values they pass you match the schema you've agreed on everything will "just work".