2

I have an ASMX web service which has a method -

void DoSomething(List<string> list);

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

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

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Unmesh Kondolikar
  • 9,256
  • 4
  • 38
  • 51
  • BTW, you are using WSE. Did you know that it is very obsolete? – John Saunders Nov 24 '10 at 20:36
  • Yes John, we are using WSE. We are moving to WCF since some of our customers are moving to Windows Server 2008. However, most of the customers are not and we have to support it for them. I also found your blog post on MSDN Forums http://social.msdn.microsoft.com/Forums/en/asmxandxml/thread/65224159-b7bf-44dc-937b-94fe2440ba70. Will try to use it to get the upgrade stories prioritized :). – Unmesh Kondolikar Nov 25 '10 at 05:36

1 Answers1

6

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.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • Ahh ok. Then may be it is better if I change the service method to accept string[] instead of a List. – Unmesh Kondolikar Nov 23 '10 at 09:09
  • Well it is really up to you. It wouldn't make any difference but if you prefer to have the exact same signature then yes you may change it. – Darin Dimitrov Nov 23 '10 at 09:12
  • @Unmesh: you don't have to change anything. In fact, if you had used "Add Service Reference" to create the client, then the "Advanced" button would have displayed a dialog allowing you to use `List` instead of `T[]`. – John Saunders Nov 24 '10 at 20:37