title: Using Spring-WS and JAXB: can't unmarshall subclasses in XML request
body: <p>I have the following in a schema defining the request/response objects used in my web service request:</p>
  
  <pre><code>&lt;xs:complexType name="loss" abstract="true"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="lossDate" type="xs:dateTime"/&gt;
          &lt;xs:element name="lossDescription" type="xs:string"/&gt;
      &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="autoLoss"&gt;
      &lt;xs:complexContent&gt;
          &lt;xs:extension base="loss"&gt;
              &lt;xs:sequence&gt;
                  &lt;!-- autoLoss specific fields... --&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:extension&gt;
      &lt;/xs:complexContent&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="propLoss"&gt;
      &lt;xs:complexContent&gt;
          &lt;xs:extension base="loss"&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element name="damageDescription" type="xs:string"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:extension&gt;
      &lt;/xs:complexContent&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>And their associated Java classes:</p>
  
  <pre><code>@XmlType
  public abstract class Loss {
      private Date lossDate;
      private String lossDescription;
      //getter &amp; setters w/ JAXB annotations
  }
  
  @XmlType
  public class AutoLoss extends Loss {
      //AutoLoss-specific fields...
      //getter &amp; setters w/ JAXB annotations
  }
  
  @XmlType
  public class PropLoss extends Loss {
      private String damageDescription;
      //getter &amp; setters w/ JAXB annotations
  }
  </code></pre>
  
  <p>The XML request I'm sending:</p>
  
  <pre><code>&lt;testRequest&gt;
      &lt;myLoss xsi:type="propLoss"&gt;
          &lt;lossDate&gt;2001-12-17T09:30:47Z&lt;/lossDate&gt;
          &lt;lossDescription&gt;test&lt;/lossDescription&gt;
          &lt;damageDescription&gt;damageDesc&lt;/damageDescription&gt;
      &lt;/myLoss&gt;
  &lt;/testRequest&gt;
  </code></pre>
  
  <p>The Spring bean definition of the <code>Jaxb2Marshaller</code>:</p>
  
  <pre><code>&lt;bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"&gt;
      &lt;property name="classesToBeBound"&gt;
          &lt;!-- list of classes... --&gt;
      &lt;/property&gt;
      &lt;property name="schema" value="/WEB-INF/mySchema.xsd" /&gt;
      &lt;property name="adapters"&gt;
          &lt;list&gt;
              &lt;bean class="com.lmig.ContactAdapter" /&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>However, I'm getting a fault in the response stating: <code>Unable to create an instance of com.lmig.Loss</code>. If I remove the <code>abstract</code> modifier on <code>Loss</code>, the unmarshalled response object is of the base class type (<code>Loss</code>). How can I use Spring-WS and JAXB to properly unmarshall subclasses of abstract parent classes? </p>