I cannot get unbounded elements to work correctly. After generating Java
bindings from the WSDL (using WSDL2Java) I am able to deploy the service and
run it. However, when a client accesses the service, the response is invalid
and the client fails (I've tried several different clients with the same
result). SOAP Arrays seem to work fine.

I've condensed the problem down to the attached WSDL, which shows a request
that works (using SOAP arrays) and one that doesn't (using an unbounded
element). I've also attached a simple implementation of the binding. I see
no reason why both shouldn't work.

Is anyone else experiencing the same problems or does anyone know of a fix -
it's causing serious problems on our project :(

Regards

Max Johnson
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by Max Johnson (DealSpark) -->
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:my="urn:MyArrayTest" targetNamespace="urn:MyArrayTest">
	<types>
		<xsd:schema targetNamespace="urn:MyArrayTest" xmlns:xsd="http://www.w3.org/1999/XMLSchema";>

			<xsd:complexType name="stringArray">
				<xsd:complexContent>
					<xsd:restriction base="soapenc:Array">
						<xsd:sequence>
							<xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
						</xsd:sequence>
					</xsd:restriction>
				</xsd:complexContent>
			</xsd:complexType>
		
			<xsd:complexType name="listItem">
				<xsd:sequence>
					<xsd:element name="foo" type="xsd:string"/>
					<xsd:element name="bar" type="xsd:string"/>
				</xsd:sequence>
			</xsd:complexType>
			<xsd:complexType name="brokenList">
				<xsd:sequence>
					<xsd:element name="complexList" type="my:listItem" maxOccurs="unbounded"/>
				</xsd:sequence>
			</xsd:complexType>
			<xsd:complexType name="goodList">
				<xsd:sequence>
					<xsd:element name="stringList" type="my:stringArray"/>
				</xsd:sequence>
			</xsd:complexType>
		</xsd:schema>
	</types>
	<wsdl:message name="GetBrokenListInput"/>
	<wsdl:message name="GetBrokenListOutput">
		<wsdl:part name="brokenList" type="my:brokenList"/>
	</wsdl:message>
	<wsdl:message name="GetGoodListInput"/>
	<wsdl:message name="GetGoodListOutput">
		<wsdl:part name="goodList" type="my:goodList"/>
	</wsdl:message>
	<portType name="typeName"/>
	<portType name="ArrayTestPortType">
		<operation name="getBrokenList">
			<input message="my:GetBrokenListInput"/>
			<output message="my:GetBrokenListOutput"/>
		</operation>
		<operation name="getGoodList">
			<input message="my:GetGoodListInput"/>
			<output message="my:GetGoodListOutput"/>
		</operation>
	</portType>
	<binding name="ArrayTestBinding" type="my:ArrayTestPortType">
		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
		<operation name="getBrokenList">
			<soap:operation soapAction=""/>
			<input>
				<soap:body use="encoded" namespace="urn:MyArrayTest" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
			</input>
			<output>
				<soap:body use="encoded" namespace="urn:MyArrayTest" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
			</output>
		</operation>
		<operation name="getGoodList">
			<soap:operation soapAction=""/>
			<input>
				<soap:body use="encoded" namespace="urn:MyArrayTest" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
			</input>
			<output>
				<soap:body use="encoded" namespace="urn:MyArrayTest" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
			</output>
		</operation>
	</binding>
	<service name="ArrayTestService">
		<port name="ArrayTestPortType" binding="my:ArrayTestBinding">
			<soap:address location="http://localhost:8080/axis/services/ArrayTest"/>
		</port>
	</service>
</definitions>

Attachment: ArrayTestBindingImpl.java
Description: Binary data

Reply via email to