You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Nate Roe <na...@vegas.com> on 2008/04/01 02:16:39 UTC
Returning an object containing an empty array
I am using Axis2 v1.3 and Rampart v1.3 on JBossAS v4.0.5 running on Java 1.6.0_03.
I'm deploying a POJO service that returns an object containing an array with a single element. When my client reads the response, it throws:
AxisFault thrown. Reason: org.apache.axis2.databinding.ADBException: Unexpected subelement ...
I have also previously tried to return an object containing an empty array, and that also throws with "unexpected subelement".
My WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:axis2="http://person.vegas.com/" xmlns:ns1="http://test.vegas.com/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://person.vegas.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://person.vegas.com/">
<wsdl:documentation>doPersonTest</wsdl:documentation>
<wsdl:types>
<xs:schema xmlns:ns="http://person.vegas.com" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://person.vegas.com">
<xs:element name="getPersonResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="ns1:Person"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getPeople">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="numPeople" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getPeopleResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema xmlns:ax22="http://test.vegas.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://test.vegas.com/xsd">
<xs:complexType name="Person">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="addresses" nillable="true" type="ax22:Address"/>
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Address">
<xs:sequence>
<xs:element minOccurs="0" name="city" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="street" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="getPeopleRequest">
<wsdl:part name="parameters" element="ns0:getPeople"/>
</wsdl:message>
<wsdl:message name="getPeopleResponse">
<wsdl:part name="parameters" element="ns0:getPeopleResponse"/>
</wsdl:message>
<wsdl:message name="getPersonRequest"/>
<wsdl:message name="getPersonResponse">
<wsdl:part name="parameters" element="ns0:getPersonResponse"/>
</wsdl:message>
<wsdl:portType name="doPersonTestPortType">
<wsdl:operation name="getPeople">
<wsdl:input message="axis2:getPeopleRequest" wsaw:Action="urn:getPeople"/>
<wsdl:output message="axis2:getPeopleResponse" wsaw:Action="urn:getPeopleResponse"/>
</wsdl:operation>
<wsdl:operation name="getPerson">
<wsdl:input message="axis2:getPersonRequest" wsaw:Action="urn:getPerson"/>
<wsdl:output message="axis2:getPersonResponse" wsaw:Action="urn:getPersonResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="doPersonTestSOAP11Binding" type="axis2:doPersonTestPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getPeople">
<soap:operation soapAction="urn:getPeople" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getPerson">
<soap:operation soapAction="urn:getPerson" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="doPersonTestSOAP12Binding" type="axis2:doPersonTestPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getPeople">
<soap12:operation soapAction="urn:getPeople" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getPerson">
<soap12:operation soapAction="urn:getPerson" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="doPersonTestHttpBinding" type="axis2:doPersonTestPortType">
<http:binding verb="POST"/>
<wsdl:operation name="getPeople">
<http:operation location="doPersonTest/getPeople"/>
<wsdl:input>
<mime:content type="text/xml" part="getPeople"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="getPeople"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getPerson">
<http:operation location="doPersonTest/getPerson"/>
<wsdl:input>
<mime:content type="text/xml" part="getPerson"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="getPerson"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="doPersonTest">
<wsdl:port name="doPersonTestSOAP11port_http" binding="axis2:doPersonTestSOAP11Binding">
<soap:address location="http://localhost:8080/axis2/services/doPersonTest"/>
</wsdl:port>
<wsdl:port name="doPersonTestSOAP12port_http" binding="axis2:doPersonTestSOAP12Binding">
<soap12:address location="http://localhost:8080/axis2/services/doPersonTest"/>
</wsdl:port>
<wsdl:port name="doPersonTestHttpport" binding="axis2:doPersonTestHttpBinding">
<http:address location="http://localhost:8080/axis2/services/doPersonTest"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The SOAP response:
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:getPeopleResponse xmlns:ns="http://person.vegas.com" xmlns:ax21="http://test.vegas.com/xsd">
<ns:return type="com.vegas.test.Person">
<ax21:address type="com.vegas.test.Address">
<ax21:city>Las Vegas</ax21:city>
<ax21:street>12345 Pecos Road</ax21:street>
</ax21:address>
<ax21:name>Jeff Doe 0</ax21:name>
</ns:return>
<ns:return type="com.vegas.test.Person">
<ax21:address type="com.vegas.test.Address">
<ax21:city>Las Vegas</ax21:city>
<ax21:street>12345 Pecos Road</ax21:street>
</ax21:address>
<ax21:name>Jeff Doe 1</ax21:name>
</ns:return>
<ns:return type="com.vegas.test.Person">
<ax21:address type="com.vegas.test.Address">
<ax21:city>Las Vegas</ax21:city>
<ax21:street>12345 Pecos Road</ax21:street>
</ax21:address>
<ax21:name>Jeff Doe 2</ax21:name>
</ns:return>
<ns:return type="com.vegas.test.Person">
<ax21:address type="com.vegas.test.Address">
<ax21:city>Las Vegas</ax21:city>
<ax21:street>12345 Pecos Road</ax21:street>
</ax21:address>
<ax21:name>Jeff Doe 3</ax21:name>
</ns:return>
<ns:return type="com.vegas.test.Person">
<ax21:address type="com.vegas.test.Address">
<ax21:city>Las Vegas</ax21:city>
<ax21:street>12345 Pecos Road</ax21:street>
</ax21:address>
<ax21:name>Jeff Doe 4</ax21:name>
</ns:return>
</ns:getPeopleResponse>
</soapenv:Body>
</soapenv:Envelope>
Why does this occur?
Thanks,
Nate Roe
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: Returning an object containing an empty array
Posted by Nate Roe <na...@vegas.com>.
I'm sorry, but never mind this one. My test case had several flaws, and correcting those flaws has corrected this error.
Thanks,
Nate Roe
-----Original Message-----
From: Nate Roe [mailto:nate.roe@vegas.com]
Sent: Monday, March 31, 2008 5:17 PM
To: 'axis-user@ws.apache.org'
Subject: Returning an object containing an empty array
I am using Axis2 v1.3 and Rampart v1.3 on JBossAS v4.0.5 running on Java 1.6.0_03.
I'm deploying a POJO service that returns an object containing an array with a single element. When my client reads the response, it throws:
AxisFault thrown. Reason: org.apache.axis2.databinding.ADBException: Unexpected subelement ...
I have also previously tried to return an object containing an empty array, and that also throws with "unexpected subelement".
My WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:axis2="http://person.vegas.com/" xmlns:ns1="http://test.vegas.com/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://person.vegas.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://person.vegas.com/">
<wsdl:documentation>doPersonTest</wsdl:documentation>
<wsdl:types>
<xs:schema xmlns:ns="http://person.vegas.com" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://person.vegas.com">
<xs:element name="getPersonResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="ns1:Person"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getPeople">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="numPeople" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getPeopleResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema xmlns:ax22="http://test.vegas.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://test.vegas.com/xsd">
<xs:complexType name="Person">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="addresses" nillable="true" type="ax22:Address"/>
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Address">
<xs:sequence>
<xs:element minOccurs="0" name="city" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="street" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="getPeopleRequest">
<wsdl:part name="parameters" element="ns0:getPeople"/>
</wsdl:message>
<wsdl:message name="getPeopleResponse">
<wsdl:part name="parameters" element="ns0:getPeopleResponse"/>
</wsdl:message>
<wsdl:message name="getPersonRequest"/>
<wsdl:message name="getPersonResponse">
<wsdl:part name="parameters" element="ns0:getPersonResponse"/>
</wsdl:message>
<wsdl:portType name="doPersonTestPortType">
<wsdl:operation name="getPeople">
<wsdl:input message="axis2:getPeopleRequest" wsaw:Action="urn:getPeople"/>
<wsdl:output message="axis2:getPeopleResponse" wsaw:Action="urn:getPeopleResponse"/>
</wsdl:operation>
<wsdl:operation name="getPerson">
<wsdl:input message="axis2:getPersonRequest" wsaw:Action="urn:getPerson"/>
<wsdl:output message="axis2:getPersonResponse" wsaw:Action="urn:getPersonResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="doPersonTestSOAP11Binding" type="axis2:doPersonTestPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getPeople">
<soap:operation soapAction="urn:getPeople" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getPerson">
<soap:operation soapAction="urn:getPerson" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="doPersonTestSOAP12Binding" type="axis2:doPersonTestPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getPeople">
<soap12:operation soapAction="urn:getPeople" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getPerson">
<soap12:operation soapAction="urn:getPerson" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="doPersonTestHttpBinding" type="axis2:doPersonTestPortType">
<http:binding verb="POST"/>
<wsdl:operation name="getPeople">
<http:operation location="doPersonTest/getPeople"/>
<wsdl:input>
<mime:content type="text/xml" part="getPeople"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="getPeople"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getPerson">
<http:operation location="doPersonTest/getPerson"/>
<wsdl:input>
<mime:content type="text/xml" part="getPerson"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="getPerson"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="doPersonTest">
<wsdl:port name="doPersonTestSOAP11port_http" binding="axis2:doPersonTestSOAP11Binding">
<soap:address location="http://localhost:8080/axis2/services/doPersonTest"/>
</wsdl:port>
<wsdl:port name="doPersonTestSOAP12port_http" binding="axis2:doPersonTestSOAP12Binding">
<soap12:address location="http://localhost:8080/axis2/services/doPersonTest"/>
</wsdl:port>
<wsdl:port name="doPersonTestHttpport" binding="axis2:doPersonTestHttpBinding">
<http:address location="http://localhost:8080/axis2/services/doPersonTest"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The SOAP response:
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:getPeopleResponse xmlns:ns="http://person.vegas.com" xmlns:ax21="http://test.vegas.com/xsd">
<ns:return type="com.vegas.test.Person">
<ax21:address type="com.vegas.test.Address">
<ax21:city>Las Vegas</ax21:city>
<ax21:street>12345 Pecos Road</ax21:street>
</ax21:address>
<ax21:name>Jeff Doe 0</ax21:name>
</ns:return>
<ns:return type="com.vegas.test.Person">
<ax21:address type="com.vegas.test.Address">
<ax21:city>Las Vegas</ax21:city>
<ax21:street>12345 Pecos Road</ax21:street>
</ax21:address>
<ax21:name>Jeff Doe 1</ax21:name>
</ns:return>
<ns:return type="com.vegas.test.Person">
<ax21:address type="com.vegas.test.Address">
<ax21:city>Las Vegas</ax21:city>
<ax21:street>12345 Pecos Road</ax21:street>
</ax21:address>
<ax21:name>Jeff Doe 2</ax21:name>
</ns:return>
<ns:return type="com.vegas.test.Person">
<ax21:address type="com.vegas.test.Address">
<ax21:city>Las Vegas</ax21:city>
<ax21:street>12345 Pecos Road</ax21:street>
</ax21:address>
<ax21:name>Jeff Doe 3</ax21:name>
</ns:return>
<ns:return type="com.vegas.test.Person">
<ax21:address type="com.vegas.test.Address">
<ax21:city>Las Vegas</ax21:city>
<ax21:street>12345 Pecos Road</ax21:street>
</ax21:address>
<ax21:name>Jeff Doe 4</ax21:name>
</ns:return>
</ns:getPeopleResponse>
</soapenv:Body>
</soapenv:Envelope>
Why does this occur?
Thanks,
Nate Roe
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org