Problem with arrays

May 8, 2012 at 11:49 AM
Edited May 8, 2012 at 11:58 AM

Hi,

When generating a service from wsdl which returns a array of strings(maxOccurs="unbounded") the generation fails.  Seems that the tool tries to create a wrapper around the parameter.

I get the following "CODEGEN" error:
"Parameter 'Output' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'System.Xml.Serialization.XmlElementAttribute'."

This is the wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:pws="http://test/2012/01/01/Test" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tt="http://test/2012/01/01/Test" targetNamespace="http://test/2012/01/01/Test">
	<types>
		<xs:schema elementFormDefault="qualified" targetNamespace="http://test/2012/01/01/Test">
			<xs:element name="TestOperation">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="InputParam" type="xs:string"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="TestOperationResponse">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Output" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:schema>
	</types>
	<message name="TestOperationSoapIn">
		<part name="parameters" element="pws:TestOperation"/>
	</message>
	<message name="TestOperationResponseSoapOut">
		<part name="parameters" element="pws:TestOperationResponse"/>
	</message>
	<portType name="TestServiceSoap">
		<operation name="TestOperation">
			<input message="pws:TestOperationSoapIn"/>
			<output message="pws:TestOperationResponseSoapOut"/>
		</operation>
	</portType>
	<binding name="TestServiceSoap" type="pws:TestServiceSoap">
		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
		<operation name="TestOperation">
			<soap:operation soapAction="http://test/2012/01/01/Test/TestOperation" style="document"/>
			<input>
				<soap:body use="literal"/>
			</input>
			<output>
				<soap:body use="literal"/>
			</output>
		</operation>				
	</binding>
	<service name="TestService">
		<port name="TestServiceSoap" binding="pws:TestServiceSoap">
			<soap:address location="			" _mce_href="http://localhost/TestService.svc">null nullnullnull">http://localhost/TestService.svc"/>
		</port>
	</service>
</definitions>

This is the code:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://test/2012/01/01/Test", ConfigurationName="TestServiceSoap")]
public interface TestServiceSoap
{
   
    // CODEGEN: Parameter 'Output' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'System.Xml.Serialization.XmlElementAttribute'.
    [System.ServiceModel.OperationContractAttribute(Action="http://test/2012/01/01/Test/TestOperation", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute()]
    [return: System.ServiceModel.MessageParameterAttribute(Name="Output")]
    TestOperationResponse TestOperation(TestOperationRequest request);
}

What I want is this:
string[] TestOperation(string InputParam);

Thanks,
B