使用泛型集合在ASMX Web服务的参数参数、ASMX、Web

2023-09-04 00:47:53 作者:曲未终人却散

我有一个ASMX的Web服务,它有一个方法 -

I have an ASMX web service which has a method -

void DoSomething(List<string> list);

我已经实现了这个服务,编制和托管在IIS中。我用 wsewsdl3.exe 生成代理。在生成的代理的方法的定义改变为 -

I have implemented this service, compiled and hosted in IIS. I used wsewsdl3.exe to generate the proxy. In the generated proxy the method definition is changed to -

DoSomething(string[] list) { ..

难道不能有列表作为参数传递给了ASMX Web服务?我应该怎么做来解决这个代理?

Is it not possible to have List as a parameter to an ASMX web service? What should I do to fix the proxy?

推荐答案

这是正常的。泛型是一个.NET特定的神器。有没有这样的概念,在生成WSDL。想象一下,它不支持泛型,如PHP,例如一个客户端。这就是为什么你的泛型集合公开为数组的原因。因此,有没有错,你的客户端代理,需要的固定的。

That's normal. Generics are a .NET specific artifact. There's no such notion in the generated WSDL. Imagine a client which doesn't support generics like PHP for example. That's the reason why your generic collection is exposed as an array. So there's nothing wrong with your client proxy that requires fixing.