I have a ASP.NET web service (.asmx
) with methods that receives int
arrays (int[]
) and nullable int
arrays (int?[]
) as parameters. I also have a test web application for consuming this web service via a Service Reference.
The problem is that every time I change something in the web service code, recompile it and update the service reference at the test application, a different type of parameter is generated for the web service methods on the test application. For example:
On the first build and service update, the method signature generated by Visual Studio at the test app is:
void MyMethod(int[] firstParam, int?[] secondParam)
.
Then I make some changes, do it again and get something like:
void MyMethod(ArrayOfInt fistParam, ArrayOfInt1 secondParam)
(with ArrayOfInt
being the equivalent of int[]
and ArrayOfInt1
being the equivalent of int?[]
).
Once more, and I get:
void MyMethod(ArrayOfInt1 firstParam, ArrayOfInt secondParam)
,
with ArrayOfInt
and ArrayOfInt1
swaped (ArrayOfInt1
being now the equivalent of int[]
and ArrayOfInt
being the equivalent of int?[]
).
What I really want is to use the simple int[]
and int?[]
types (no matter how many times I recompile and update the service reference!). How can I achieve this?
Try using wsdl.exe tool to generate web service proxy instead using Visual Studio.
This work for me!