LostInComputer
LostInComputer

Reputation: 15420

WCF wsdl string array

How do I tell WCF to make use of wsdl arrayType? Like this:

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

This is what WCF is doing (The not expected)

<complexType name="ArrayOfstring">
    <sequence>
       <element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true"       type="xs:string"/>
     </sequence>
    <element name="ArrayOfstring" nillable="true" type="tns:ArrayOfstring"/>
</complexType>

Upvotes: 1

Views: 2035

Answers (2)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364249

I think WCF doesn't support it out of the box because that is WSDL extension to standard XSD description of data type. Both XmlSerializer and DataContractSerializer should work with standard XSD in scenarios where web services are not involved at all so it uses the plain XSD approach.

If you need the first approach you can either write WSDL + XSDs yourselves or you can try to implement custom export extension - to use that for WCF client generation you will also need custom import extension.

Upvotes: 0

LostInComputer
LostInComputer

Reputation: 15420

Found the solution. I have to add this to make it work: [XmlSerializerFormat(Style = OperationFormatStyle.Rpc, Use = OperationFormatUse.Encoded)]

Upvotes: 1

Related Questions