Problem with generating WebService proxy using svcutil

后端 未结 3 527
-上瘾入骨i
-上瘾入骨i 2020-12-17 21:43

In our application we are forced to consume several WebServices. In the beginning we used just the \"Add Service Reference\" menu option, in order to create a WCF proxy.

相关标签:
3条回答
  • 2020-12-17 22:22

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

    0 讨论(0)
  • 2020-12-17 22:34

    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"/>

    0 讨论(0)
  • 2020-12-17 22:38

    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

    0 讨论(0)
提交回复
热议问题