.NET Web service unable to generate a temporary class

你离开我真会死。 提交于 2019-12-30 20:00:48

问题


I'm trying to instantiate a web service in my .NET web application. But as soon as it hits this line:

registerService register = new registerService();

Then i get the following error:

Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'Test.Website.ProxyTest.registerType[]' to 'Test.Website.ProxyTest.registerType'

I didn't write the web service. But does this mean the web service has an error somewhere (in an XSD or something)?

Does this mean that the 3rd party developers need to fix this web service?


回答1:


It seems to be a Known issue and the details can be found here

Cause: A known issue with WSDL.EXE included in the .NET Framework can cause a proxy class to be generated incorrectly if an array of complex type includes an element that is also an array of complex type for which only one element exists

.

There is no resolution available at this time however there are three available workarounds:

Generate the proxy class manually using WSDL.EXE and then modify the proxy class where the datatype has been inappropriately created as a two-dimensional array (e.g. 'CustomType[][]') and correct it to be a single-dimensional array (e.g. 'CustomType[]'). Modify the datatype in the desired WSDL so that a second, optional element is included in the definition. This can be done by adding an element such as ''. Modify the complex type in the desired WSDL so that the boundary attributes are part of the complex type rather than the element (i.e. move the "minOccurs" and "maxOccurs" attributes to the complex type and remove them from the element).

A similar stackoverflow question



来源:https://stackoverflow.com/questions/15522589/net-web-service-unable-to-generate-a-temporary-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!