Simple SOAP Example in C#

C# has a SOAP bug with a WSDL. I vaguely remember that everything needs an attribute being the cause. Bug information is listed below. You can edit your WSDL to the following to fix the issue:

Before:

<complexType name="ListViewRecord">
  <sequence>
   <element name="columns" type="tns:ListViewRecordColumn" maxOccurs="unbounded"/>
  </sequence>
</complexType>

<complexType name="ListViewRecordColumn">
<sequence>
  <element name="fieldNameOrPath" type="xsd:string"/>
  <element name="value" type="xsd:string" nillable="true"/>
</sequence>
</complexType>

After:

<complexType name="ListViewRecord">
  <sequence>
   <element name="columns" type="tns:ListViewRecordColumn" maxOccurs="unbounded"/>
  </sequence>
  <xsd:attribute name="tmp" type="xsd:string" />
</complexType>

<complexType name="ListViewRecordColumn">
<sequence>
  <element name="fieldNameOrPath" type="xsd:string"/>
  <element name="value" type="xsd:string" nillable="true"/>
</sequence>
<xsd:attribute name="tmp" type="xsd:string" />
</complexType>

Update:

Found the Bug Information:

XmlSerializer Code Generation component cannot handle nested unbounded elements when there is only one element

Salesforce Support on the Issue

Tags:

C#

.Net

Soap