我有一个ASP.NET Web服务(的.asmx
)与接收 INT
阵列方法( INT []
)和可空 INT
阵列(诠释?[]
)作为参数。我也有一个测试Web应用程序通过服务引用消费该Web服务。
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.
现在的问题是,每一次我改变一些在Web服务中code,重新编译和更新的测试应用程序的服务引用,是对测试应用程序的Web服务方法产生的不同类型的参数。例如:
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:
在第一个构建和服务更新,由Visual Studio的测试应用程序生成的方法签名是:
On the first build and service update, the method signature generated by Visual Studio at the test app is:
无效的MyMethod(INT [] firstParam,INT?[] secondParam)
。
然后,我做出一些改变,做一遍,并得到这样的:
Then I make some changes, do it again and get something like:
无效的MyMethod(ArrayOfInt fistParam,ArrayOfInt1 secondParam)
(用 ArrayOfInt
是 INT []
和 ArrayOfInt1 是相当于
诠释?[]
)。
一旦多了,我得到:
无效的MyMethod(ArrayOfInt1 firstParam,ArrayOfInt secondParam)
,
与 ArrayOfInt
和 ArrayOfInt1
swaped( ArrayOfInt1
是现在相当于 INT []
和 ArrayOfInt
是相当于诠释?[]
)。
with ArrayOfInt
and ArrayOfInt1
swaped (ArrayOfInt1
being now the equivalent of int[]
and ArrayOfInt
being the equivalent of int?[]
).
我真正想要的是使用简单的 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?
尝试使用的 Wsdl.exe用工具,而不是使用Visual Studio的生成Web服务代理。
Try using wsdl.exe tool to generate web service proxy instead using Visual Studio.
这为我工作!
下一篇:静态单身一辈子的安卓静态、单身