Problem with generating WebService proxy using svcutil

可紊 提交于 2019-11-29 06:51:27
an phu

The schema used by the wsdl does not conform to the Data Contract Serializer's Schema Reference.

Problems:

  1. "All elements must be qualified for a schema to be supported by DataContractSerializer".

    Your schema omits the elementFormDefault attribute on the tag so the default, "unqualified" is in effect. You need to add the following attribute name/value pair to the <schema> element so that the Data Contract Serializer (DCS) can resolve the local elements/types.

    elementFormDefault="qualified"

  2. maxOccurs and minOccurs attributes on <sequence> tag must be 1 or omitted (default is 1).

    So, remove maxOccurs="unbounded" on the <sequence>.

  3. Add maxOccurs="unbounded" on the <row> tag to get a nested collection data contract generated for the DataSet field.

    For example,

    <xsd:element name="DataSet"> <xsd:complexType> <xsd:sequence> <xsd:element name="row" minOccurs="0" maxOccurs="unbounded"/>

I had to get rid of the use of "element" and much rather just used the "complexType"s.

So I removed the enclosing elements on the DataContracts and in the Messages, I set the type attribute instead of the element attribute. Now it works, thank you very much. :)

Hey I'm not sure how you generated your wsdl and stuff, but datasets has a few oddities.

When generating my proxy with a ds I need to reference this assembly:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll

Cheers, Stian

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