I have a .NET 4 WCF web service which takes a data contract with an optional enumerable of strings. For example:
Service Code:
[DataMember(IsRequired = true)]
public string Something {
get { return _Something; }
set { _Something= value; }
}
private string _Something;
[DataMember(IsRequired = false)]
public string[] MoreThings {
get { return _MoreThings.ToArray<string>(); }
set { _MoreThings = new List<string>(value); }
}
private List<string> _MoreThings = new List<string>();
WSDL:
<xsd:complexType name="MyDataContract">
<xsd:sequence>
<xsd:element minOccurs="1" name="Something" type="xsd:string" />
<xsd:element minOccurs="0" name="MoreThings" nillable="true" type="q1:ArrayOfstring" xmlns:q1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
</xsd:sequence>
</xsd:complexType>
I'm trying to interface with the service from a number of different platforms, but one is Perl using SOAP::WSDL (and wsdl2perl.pl in particular), which seems to be failing on recognizing "ArrayOfstring". Is there anything I can do in my code so that the WSDL would read like this:
<xsd:complexType name="MyDataContract">
<xsd:sequence>
<xsd:element minOccurs="1" name="Something" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="unbounded" name="MoreThings" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
I'm open to other suggestions, as well. Basically, I'm trying to do something similar to declaring a method MyOperation(string something, params string[] moreThings), where any number of additional moreThings parameters may be passed, but in a way that doesn't cause interop issues with non-.NET platforms.