C# SOAP 复杂类型参数
我正在 C# 中开发 SOAP 客户端,使用我在 PHP 中使用 NuSoap 公开的服务。从消费的角度来看,我的 Web 服务运行得很好,但我遇到的麻烦与传递复杂类型作为参数有关。
使用方法返回的复杂类型并不麻烦,但我似乎无法弄清楚如何在 C# 中实际操作我的复杂类型。
除非有人确实请求,否则我现在将省去冗长的 WSDL。但我尝试使用的复杂类型是另一个复杂类型的列表。我需要在 C# 应用程序中添加和删除列表中的项目,但我似乎不知道如何操作。
有人能指出我正确的方向吗?可根据要求提供更多信息。
I am working on a SOAP Client in C#, consuming a service I've exposed in PHP using NuSoap. My web service is working great from a consumption standpoint, but the trouble I'm running into has to do with passing a complex type as an argument.
Working with a complex type returned by a method is no trouble, but I can't seem to figure out how to actually manipulate my complex type in C#.
Unless someone actually requests it, I'll spare the lengthy WSDL for now. But the complex type I'm trying to work with is a list of another complex type. What I need to do in my C# app is add and remove items from the list, but I can't seem to figure out how.
Could anyone point me in the right direction? More information can be provided upon request.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以,这就是我的阅读方式:
如果您在 Visual Studio 中生成代理,则可以选择将数组转换为强类型列表对象(添加服务引用 -> 高级 -> 集合类型:System.Collections。通用列表)。这样你就可以调用commandList.Add()。
另外,我不知道为什么从 getCommands() 返回的类型名称是 List。
So, this is how I read this:
If you are generating the proxy in Visual Studio, there is an option to turn the arrays into strongly typed List objects (Add Service Reference -> Advanced -> Collection type: System.Collections.Generic.List). This way you can just call commandList.Add().
Also, I don't know why the name of the type that is returned from getCommands() is List.
您不确定如何实际使用为您生成的 C# SOAP 客户端?
像这样的东西应该可以工作...
[编辑] 正如 Nicholas 在他的回答中推断的那样,您的 SOAP 服务定义应该避免使用常见的类型名称,例如“List”,因为它会与 System.Web.Services 冲突。 Collections.Generic.List。
Are you unsure how to actually use the C# SOAP client which has been generated for you?
Something like this should work...
[Edit] As Nicholas infers in his answer, your SOAP service definition should avoid using common type names such as "List" because it will conflict with
System.Collections.Generic.List<T>
.