开发者

Consuming WSDL with multidimentional array with WSDL.exe fails

开发者 https://www.devze.com 2023-02-27 00:14 出处:网络
I have the following in a WSDL I am consuming; <xsd:complexType name=\"SomeClassType\"> <xsd:sequence>

I have the following in a WSDL I am consuming;

<xsd:complexType name="SomeClassType">
  <xsd:sequence>
    <xsd:element type="xsd:string" name="errorMessage" minOccurs="1" nillable="true" maxOccurs="1">     </xsd:element>
    <xsd:element type="tp:ArrayOfArrayOfString" name="values" minOccurs="1" nillable="true" maxOccurs="1">     </xsd:element>
    <xsd:element type="xsd:boolean" name="isEmpty" minOccurs="1" maxOccurs="1">      </xsd:element>
  </xsd:sequence>
</xsd:complexType>

where

<xsd:complexType name="ArrayOfArrayOfString">
  <xsd:complexContent>
    <xsd:restriction base="soapenc:Array">
      <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[,]"></xsd:attribute>
    </xsd:restriction>
  </xsd:complexContent>
</xsd:complexType>

However using wsdl.exe from MS (Runtime Version: 1.1.4322.573) generates

    public class SomeClassType {

        /// 
        public string errorMessage;

        /// 
        public strin开发者_开发百科g[] values;

        /// 
        public bool isEmpty;

    }

I expected string[,] values not string[] values

Is there a fix or a work around to this problem? (other than manually changing the generated code)


I had to set the type="tp:ArrayOfArrayOfString" to type="tp:ArrayOfString" and the maxOccurs="unbounded"


I believe you could try the WCF proxy generator (I believe WCF uses some other util, not wsdl.exe) - maybe that would be useful, but if that fails - I think that manually editing the generated code is your only option.


Try svcutil.exe. it is advisable to try a newer version of .net.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号