I wonder if this is related to the Java packages created for my data beans, or 
some kind of mistake during stub generation.  I don't understand from looking 
at my WSDL and my SOAP messages how they mis-match.

I have managed to create a test case that I believe exemplifies this problem.  
For this I modified the calculator example.  I instead of performing a 
calculation, my service now requires an integer.  In response to this integer 
the service creates the specified number of Person instances, each of which 
have one Address.

The WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:axis2="http://quickstart.samples/"; xmlns:ns1="http://calculate.vegas.com"; 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:ns0="http://data.test.vegas.com/xsd"; 
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://quickstart.samples/";>
    <wsdl:documentation>doCalculate</wsdl:documentation>
    <wsdl:types>
        <xs:schema xmlns:ax21="http://data.test.vegas.com/xsd"; 
attributeFormDefault="qualified" elementFormDefault="qualified" 
targetNamespace="http://data.test.vegas.com/xsd";>
            <xs:complexType name="Person">
                <xs:sequence>
                    <xs:element minOccurs="0" name="address" nillable="true" 
type="ax21: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>
        <xs:schema xmlns:ns="http://calculate.vegas.com"; 
attributeFormDefault="qualified" elementFormDefault="qualified" 
targetNamespace="http://calculate.vegas.com";>
            <xs:element name="getPersonResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="return" nillable="true" 
type="ns0: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>
    </wsdl:types>
    <wsdl:message name="getPeopleRequest">
        <wsdl:part name="parameters" element="ns1:getPeople"/>
    </wsdl:message>
    <wsdl:message name="getPeopleResponse">
        <wsdl:part name="parameters" element="ns1:getPeopleResponse"/>
    </wsdl:message>
    <wsdl:message name="getPersonRequest"/>
    <wsdl:message name="getPersonResponse">
        <wsdl:part name="parameters" element="ns1:getPersonResponse"/>
    </wsdl:message>
    <wsdl:portType name="doCalculatePortType">
        <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="doCalculateSOAP11Binding" 
type="axis2:doCalculatePortType">
        <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="doCalculateSOAP12Binding" 
type="axis2:doCalculatePortType">
        <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="doCalculateHttpBinding" 
type="axis2:doCalculatePortType">
        <http:binding verb="POST"/>
        <wsdl:operation name="getPeople">
            <http:operation location="doCalculate/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="doCalculate/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="doCalculate">
        <wsdl:port name="doCalculateSOAP11port_http" 
binding="axis2:doCalculateSOAP11Binding">
            <soap:address 
location="http://localhost:8080/axis2/services/doCalculate"/>
        </wsdl:port>
        <wsdl:port name="doCalculateSOAP12port_http" 
binding="axis2:doCalculateSOAP12Binding">
            <soap12:address 
location="http://localhost:8080/axis2/services/doCalculate"/>
        </wsdl:port>
        <wsdl:port name="doCalculateHttpport" 
binding="axis2:doCalculateHttpBinding">
            <http:address 
location="http://localhost:8080/axis2/services/doCalculate"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>


The Request:

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
  <soapenv:Body>
    <ns2:getPeople xmlns:ns2="http://calculate.vegas.com";>
      <ns2:numPeople>5</ns2:numPeople>
    </ns2:getPeople>
  </soapenv:Body>
</soapenv:Envelope>


The 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://calculate.vegas.com"; 
xmlns:ax21="http://data.test.vegas.com/xsd";>
  <ns:return type="com.vegas.test.data.Person">
    <ax21:address type="com.vegas.test.data.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.data.Person">
    <ax21:address type="com.vegas.test.data.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.data.Person">
    <ax21:address type="com.vegas.test.data.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.data.Person">
    <ax21:address type="com.vegas.test.data.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.data.Person">
    <ax21:address type="com.vegas.test.data.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>


I generated the stubs using the following command:

wsdl2java -uri http://localhost:8080/axis2/services/doCalculate?wsdl -p 
com.vegas.test -u


Is there some obvious cause that I've overlooked?

Thank you,
Nate Roe

-----Original Message-----
From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 22, 2008 5:45 AM
To: [email protected]
Subject: Re: What might cause "Unexpected subelement return"?

Nate,

The message indicates that the unexpected subelement is called "return".
Look at your WSDL to determine what the expected message structure
should be, and compare it to the actual message returned.

Anne

On Fri, Mar 21, 2008 at 5:04 PM, Nate Roe <[EMAIL PROTECTED]> wrote:
>
>  I have tested a few theories about the cause of this exception, but so far 
> they've come up negative.
>
>  Is there a way to get Axis2 to tell me which specific subelement was 
> unexpected?
>
>  Thanks,
>  Nate Roe
>
>
>
>  -----Original Message-----
>  From: Nate Roe [mailto:[EMAIL PROTECTED]
>  Sent: Thursday, March 20, 2008 5:59 PM
>  To: '[email protected]'
>  Subject: What might cause "Unexpected subelement return"?
>
>  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.  Responses from this service cause an 
> ADBExceptoion: "Unexpected subelement return".
>
>  The subelements in this case are child objects, collections, etc.
>
>  What are some causes of this exception?  Unfortunately I cannot share 
> SOAP/WSDL corresponding to this specific problem.  I hope that this problem 
> has some known causes that I can look into.  If I cannot identify the cause 
> in this way then I will try to write some smaller, sharable demonstration.
>
>  I found JIRA #1746, but it was closed more than a year ago: 
> http://issues.apache.org/jira/browse/AXIS2-1746
>
>  Thanks,
>  Nate Roe
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to