Update, I did try the substitution group approach and got the same results:

I reinstated the PayLoadObject abstract class super class, got rid of the 
ListWrapper and modified PayLoad to be defined as:

@XmlRootElement
@XmlSeeAlso({ PayLoadObject.class, PayLoadString.class })
@XmlType(propOrder = { "responseInfo", "payLoadList" })
public class PayLoad<T extends PayLoadObject> implements Serializable {

    private WSResponseInfo responseInfo;

    @XmlElementWrapper(name="payLoadList")
    @XmlElementRef()
    private List<T> payLoadList;

...

This causes the payLoadList to be generated as an anonymous complex type in the 
WSDL like this:

         <xs:complexType name="payLoad">
            <xs:sequence>
               <xs:element minOccurs="0" name="responseInfo" 
type="tns:wsResponseInfo"/>
               <xs:element minOccurs="0" name="payLoadList">
                  <xs:complexType>
                     <xs:sequence>
                        <xs:choice maxOccurs="unbounded" minOccurs="0">
                           <xs:element ref="tns:payLoadObject"/>
                           <xs:element ref="tns:payLoadString"/>
                           <xs:element ref="tns:myBean"/>
                        </xs:choice>
                     </xs:sequence>
                  </xs:complexType>
               </xs:element>
            </xs:sequence>
         </xs:complexType>

This also produces the response with the desired element node names in the 
payLoadList, just as the ListWrapper approach did.   But, the response:

      <ns2:getMyBeanDataResponse xmlns:ns2="http://mycompany.com";>
         <payLoad>
            <responseInfo>
               <requestId>1026</requestId>
               <service>MyBeanService</service>
               <endpointHandler>GenericPayloadHandler</endpointHandler>
               <operation>GetMyBeanData</operation>
               <parameters><![CDATA[<?xml version="1.0" encoding="UTF-8" 
standalone="yes"?><requestParameters><ipAddress>10.5.20.109</ipAddress><parameters/></requestParameters>]]></parameters>
               <status>COMPLETED</status>
               <rowCount>240</rowCount>
               <purged>false</purged>
               <statusMessage>The request has completed 
successfully.</statusMessage>
               <startTimestamp>2014-05-05T15:02:35.450-05:00</startTimestamp>
               <endTimestamp>2014-05-05T15:02:35.521-05:00</endTimestamp>
               <asynchronous>false</asynchronous>
               <expiration>2014-05-05T15:02:35.521-05:00</expiration>
            </responseInfo>
            <payLoadList>
               <ns2:myBean>
                [..]
               </ns2: myBean >
               <ns2: myBean >
                [..]
               </ns2: myBean >
...

...still fails WSDL validation with error messages like:

line 75: Element not allowed: myBean@http://mycompany.com in element payLoadList



Regards,   Andrew

Reply via email to